Search code examples
twiliodialogflow-estwilio-apitwilio-functionsdialogflow-es-fulfillment

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!


Solution

  • 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.