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. Tutorial
- Using Nginx and Let's Encrypt. Tutorial
Create a Twilio account and create a phone number
Steps
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 to true
accountSID: Paste your account SID
authToken: Paste your auth token
Your
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 -> manage -> active numbers
- Click on your registered phone number. If you don't have one, click on 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