Twilio
Prerequisite
An HTTPS Endpoint to your bot
- Set the externalUrl field in
botpress.config.json
. - Create an HTTPS tunnel to your machine using Ngrok.
- Using Nginx and Let's Encrypt.
- Set the externalUrl field in
Create a Twilio account and create a phone number
Get your API Credentials
- Go to you Twilio console dashboard.
- Go to the settings tab.
- Scroll down and copy your Account SID and Auth Token from the LIVE credentials section.
Configure Your Bot
- Edit
data/bots/<YOUR_BOT_ID>/bot.config.json
. In themessaging.channels.twilio
section write this configuration:
enabled
: set totrue
accountSID
: paste your account SIDauthToken
: paste your auth tokenYour
bot.config.json
should look like this:
{
// ... other data
"messaging": {
"channels": {
"twilio": {
"enabled": true,
"accountSID": "your_account_sid",
"authToken": "your_auth_token"
}
// ... other channels can also be configured here
}
}
}
- Restart Botpress.
- You should see your webhook endpoint in the console on startup.
Configure Webhook
- Go to the phone numbers section and click Manage, then Active Numbers.
- Click on your registered phone number. If you don't have one, click Buy a new number.
- Scroll down to the messaging webhook section.
- Set 'A Message Comes In' to
<EXTERNAL_URL>/api/v1/messaging/webhooks/<YOUR_BOT_ID/twilio
.
Setting up WhatsApp sandbox
- Go to WhatsApp sandbox settings under messaging section and add the above twilio url in 'A Message Comes In"