In order to move into production using the Twilio API for WhatsApp, you need a WhatsApp Business Profile. WhatsApp is currently limiting access to profiles during their API’s limited availability stage. Business Profiles must be associated with a Twilio number. You can request to enable your Twilio numbers for WhatsApp here. That being said, you can start building your bot with the WhatsApp Sandbox and move it over to a WhatsApp Business Profile when you receive access.
With Twilio Autopilot, you can build Whatsapp bots. On this page, we'll walk you through how to connect your Whatsapp Sandbox to Autopilot so you can get started building your bot.
- Sign up for a Twilio account here if you don't already have one.
- Follow these step-by-step instructions for setting up your Sandbox in the Learn page of the WhatsApp console menu.
- Once configured, you can see all the configuration details in the Sandbox page of the WhatsApp menu. You'll need these for the next set of steps.
Once you have successfully configured your Sandbox, you'll need to connect it to your Autopilot Assistant.
- Go to the Autopilot menu in the console and click into the Assistant you want to connect to WhatsApp.
- Go to the Channels tab in the Assistant Menu and select WhatsApp.
- Copy the URL displayed in the Configuration tab. This is the callback URL used to send incoming messages to your Assistant.
- Go back to the Sandbox page in the WhatsApp console menu. Paste the callback URL where it says 'When a message comes in'.
- Click Save and you're all set!
Now that you have WhatsApp configured it's time to test!
- Open the WhatsApp app
- Tap into the chat window with your WhatsApp bot
- Send your first message, you should get a response from Autopilot
- Check the Autopilot Query logs
First, you need make sure that your Whatsapp Sandbox is setup correctly and that Flex us receiving the messages. Youo can follow the instructions below:
A string representing the unique name of the destination Task. If no TargetTask is provided, the destination task is determined by the natural language understanding.
TargetTask is useful when you want to control what task a user is routed to.
Lets you send Inbound Context to Autopilot. Should be a JSON string containing key-value pairs to insert into the Autopilot memory before starting a dialogue with the bot.
Useful for passing data stored in third party systems like a CRM into Autopilot to deliver a more contextual experience.
Example 1: Using TargetTask parameter at the end of the URL
Any message sent to number or messaging service configured with this URL will land in the handle_appointment_confirmation task.
Example 2: Passing Inbound Context with Memory
Any message sent to a bot with this URL will insert CarModel, CarMake and CarYear into the Autopilot Memory.