Override Message Service inbound URL programatically - twilio

I have setup a trial Twilio account and have been investigating their
Programmable SMS service. Within my account I have also setup a Messaging Service. When I send an SMS I am able to set the URL I wish Twilio to send all delivery events (e.g accepted, sent, delivered etc) to, using a field called statusCallback. However, I am wondering if it is also possible to set the URL for which I wish to receive any replies to the message being sent, as part of the send SMS call? I know I can change the incoming request URL within the Messaging Services area of my Twilio account dashboard, but I would like to be able to set this URL on a per SMS basis, as part of the send SMS API call.
Does anyone know if this is possible? I cannot see anything in the docs to suggest it is but I wanted to know definitively.
I hope the question makes sense but if any clarification is needed then please let me know.
Thanks,
Paul

Related

Trying to get inbound text responses in GoHighLevel

I have Twilio integrated with GoHighlevel. I am trying to get inbound SMS responses to appear in the GHL contact. Outbound messages are functioning and logging correctly, but not inbound. Can anyone assist?
Twilio developer evangelist here.
I've not used GoHighLevel, so this is a bit of a stab in the dark.
Incoming messages to a Twilio number trigger a webhook (an HTTP request) to an application to notify the application. If the webhooks aren't set up correctly, then those messages won't make it to the other application (though they are all stored within Twilio).
I would recommend you log in to your Twilio account and check the settings for your numbers. You want to ensure that your numbers have a GoHighLevel URL setup for incoming messages.
In one of the GoHighLevel support topic videos for Twilio I spotted what the webhook URL should probably look like.
https://api.gohighlevel.com/twilio/incoming_message
Check your numbers, make sure they have something like that. And if it is still not working then I would contact GoHighLevel support to find out what the correct settings should be.

twilio stop receiving messages

We are using twilio service to send messages to our customers. We want to provide STOP receiving messages option to our customers.
So when a customer replies STOP, he/she should stop receiving messages. I think twilio has a blacklist to stop sending messages to a customer if the customers chooses to.
However, as an organization, we also want to know if a customer opted out of receiving messages.
How will twilio tell us that a customer opted out of receiving messages? How can we add a web hook such as a rest endpoint in twilio? Is this usecase possible in twilio?
Twilio evangelist here.
This article explains our default keyword handling: https://support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-opt-out-keywords-SMS-STOP-filtering-
tl;dr If someone texts STOP to your Twilio number we add them to our blacklist then pass the message on to you via the normal webhook process.
Hope that helps.

HTTP GET request for user's phone number in fulfillment editor

We are setting up a chat bot through Dialogflow. A user will receive a weblink to the bot in a call or SMS sent through twilio. I'm wondering if it is possible for us to set up an HTTP get request to twilio in fulfillment so that we can set a context parameter to the user's phone number in the fulfillment inline editor in Dialogflow.
I took a look at twilio's api docs but could only find information on HTTP requests regarding numbers purchased or available for purchase through twilio.
So to clarify: in Dialogflow's fulfillment inline editor, we want to set a context parameter equal to the user's phone number that twilio called or sent the SMS to with a weblink to our chat bot.
Thanks!
Twilio developer evangelist here.
If I'm understanding right, you want to send a URL to a user via SMS (or over the phone?) which will link them to a web based chat with your bot. And you want to be able to link that chat back to the original phone number?
If that is the case, then the first thing that comes to mind for me would be to create a unique URL for each phone number you send this message to. If you store a link between the URL and the number it is sent to in a database somewhere, then when th euser clicks through to it you can recover the phone number and apply it to your Dialogflow context.
I don't believe you need to make any requests to the Twilio API for this aside from sending the initial SMS.
I hope this helps.

How to configure Twilio send sms with callback url?

We have a requirement to configure callback URL with a custom parameter.
It's possible to configure the callback http url in Twilio console.
But we have to configure the callback url when we send sms so that when the user replies, twilio will make a call to the specified url mentioned.
Is there any way to configure the callback url programmatically?
Your timely help is much appreciated.
Twilio developer evangelist here.
You can't configure the SMS URL to be different based on different users responding to a Twilio number.
You can, however, direct this within your own system. When Twilio makes the webhook to your application it sends through a bunch of parameters including From, the number that sent you the message.
These parameters are sent as URL encoded parameters in the body of the POST request.
In your application you should be able to use that From parameter to look up your user and then deal with the incoming message for that user.
Let me know if that helps at all.

Twilio Opt-In/Opt-Out API

I am working on an Opt-In /Opt-Out api that integrates with Twilio. The way our Opt-In/Opt-Out works is each company (our customer) signs up for one or more Twilio phone numbers and their customers can opt-in/opt-out into these numbers.
When Twilio receives these opt-in/opt-outs we want Twilio to call us into a webhook URL.
So my question is: how do we register these callback URLs? Do these have to be defined at the time when each company signs up for a phone number? If so whats the API end point for that?
These numbers can be added by different companies at any time. Please advise how to do that. We already have URLs defined for sending and receiving SMS messages with Twilio. In this case we first send the message to Twilio and we specify a callback url in that. Can the Opt-In/Opt-outs work with these already registered end points?
All the phone numbers these companies sing up for are created as a subaccount under us. So is that fine with Twilio and can Twilio call us back on the already registered end points (URLs).
If you have any documentation on how to set up an Opt-In/Opt-Out,please include that. I couldn't find one anywhere. The API method we use for creating subaccounts when companies sign up for a phone number is CreateSubAccount and there is no parameter to specify an call back endpoint URL. I tried contacting their support but they haven't gotten back to us yet.
Twilio developer evangelist here.
I'm not sure exactly what you mean when you say "When Twilio receives these opt-in/opt-outs" as the only thing you will get webhooks for is when a number receives an incoming SMS (or phone call, but we're talking SMS right now).
You can set a different SMS webhook URL per each phone number using the API when you buy the phone number. As part of the POST request to the Incoming Phone Numbers resource you can add the optional parameters SmsUrl and SmsMethod.
Once you have purchased the number, you can also update the webhook URLs for it, by POSTing or PUTing to the instance resource, using the same parameters.
Let me know if this helps at all.

Resources