AI Assistants is a Twilio Alpha project that's in Developer Preview.
View the current limitations for details about feature limits during developer preview.
There might be situations in which you no longer want your AI Assistant to handle a conversation and instead want it to rely on a more deterministic path using a Twilio Studio Flow. In this guide, you will learn how to have your AI Assistant transition a conversation to Studio.
This Assistant handoff requires your conversation to flow through Twilio Conversations. Follow the guide for using AI Assistants with Twilio Conversations before moving on here.
You will need a Studio Flow that is configured for the Incoming Conversation trigger. From here, you can use any Studio Widget that is compatible with Conversations.
Make sure to deploy your Studio Flow and copy the Flow SID.
If you followed the AI Assistants with Twilio Conversations guide, one of the Twilio Functions that you deployed was a Studio Handover tool.
To use this webhook as an Assistant Tool, you will need your Functions domain from the deployment. If you can't find your Functions domain, head to the Twilio Console and click on Service Details next to your ai-assistants-samples
service. You can find the domain in the Environments section.
Once you have both your Flow SID and your Functions domain, you can go into your AI Assistant in the Twilio Console and create a new Tool with the following configuration:
Field | Example Configuration | Notes |
---|---|---|
Name | Studio Handover | You can modify this if you have multiple handovers. |
Description | You MUST use this if a customer is asking for a refund. | Use this description to tell the AI Assistant when to use the tool. |
Input |
| |
Method | POST | |
URL | https://<your-functions-domain>.twil.io/tools/studio-handover?flowSid=<your-studio-flow-sid> | Make sure to replace <your-functions-domain> and <your-studio-flow-sid> with your own values. |
This Tool reroutes the conversation from your Assistant to Studio, but does not forward the last message from the Assistant to the Studio Flow. Instead, the Tool responds with Conversation handed over
, which might prompt the Assistant to say something like "I handed this conversation over". If you want to manipulate this message, you can pass a different message into the URL configuration using the successMessage
query parameter.
You've now learned how to configure an Assistant to hand off a conversation to a Twilio Studio Flow. See more tutorials below: