Search code examples
twiliotwilio-apitwilio-programmable-chat

Twilio: Autopilot to Initiate Conversation


We're a delivery service company. When an order is placed, we wish to send out a delivery job offer to our drivers. The jobs are first-come-first-serve.

Orders are processed on our NodeJS server. What would be an efficient way to text (SMS) each of our drivers while using Twilio Autopilot to handle the conversation (asking for job details)?

I can't seem to find a way for instructing Autopilot to initiate the conversation for a specified outbound phone number. I've used twilio.messages.create() to send an SMS to a driver (with a job offer) from the same number as Autopilot. But when drivers reply, Autopilot has no context to the original question.


Solution

  • Twilio developer evangelist here.

    You can initiate a session with Twilio Studio! You can message the user without the user greeting the bot by connecting the trigger widget's Rest API trigger event to either a make outgoing call or send message widget, as shown below. Rest API trigger Then, if the call is answered or the message is sent, you can connect those actions to the Send to Autopilot widget.

    send to autopilot widget in dropdown Lastly, under the config section of your Send to Autopilot widget, put in the Collection task you want to run when the outbound call or message is initiated by your Twilio client and not the user.

    send to autopilot customization

    Alternatively, you don't need Twilio Studio: you can also hit the REST API https://www.twilio.com/docs/autopilot/api to kick-off a dialogue.

    Let me know if this helps :D