Pages

Tuesday, October 20, 2020

How to Connect a Bot to WhatsApp

Through Bot Libre and Bot Libre for Business, you can now send and receive WhatsApp messages with your own bot. Currently, WhatsApp requires users to have a formally approved account to send messages, but this can be avoided by working in a sandbox on Twilio. 

Step 1 - Create a Bot 

First you must create a bot that you want to connect to WhatsApp via Twilio, or you can use one of your existing bots. To create a bot, follow the instructions here: How to create your own chat bot in 10 clicks

Step 2 - Create a Twilio account

Click here to go the Twilio website. To create a trial account, click on the "Sign up and start building" button in the middle of the website.

Enter your information on the following form, then click the "Start your free trial" button.

You will then need to verify your email address. Check your email and click on the link.

You will also need to verify your cell phone number. Enter your cell number and click "Verify".

Once you have received your verification code, enter it on the website and press "Submit" to complete your account creation.

Answer the questions from Twilio or click "Skip to dashboard".

Step 3 - Get a phone number from Twilio

From the menu on the left side of the Twilio website, select the circle and three dots icon, shown in red below, and then select "Phone Numbers"

 

Click the "Get Started" button to begin. Next, click the "Get your first Twilio phone number".

A screen will pop up with a phone number that has been chosen for you. You can accept this phone number by clicking the "Choose this Number" button. If you want to try again for a different phone number, you can click the underlined "Search for a different number" link. Ensure the number you select has voice capabilities.

Step 4 - Connect webhook

Navigate to your bot's page on the Bot Libre website. Go to its admin console by clicking on the gear icon.

Click the "WhatsApp" link to view your bot's Twilio settings. Copy the "Twilio WhatsApp Webhook URL" to your clipboard.

Now return to the Console on the Twilio website and select "Programmable SMS", then "Settings", and finally "WhatsApp Sandbox Settings". 

Next, paste the Twilio WhatsApp Webhook URL into the "When a message comes in" textbox. Scroll to the bottom and press save.

Step 5 - Connecting to your bot on WhatsApp

To join the sandbox, send your join code, found under "Sandbox Participants", to your Twilio number. This will add you to the sandbox where you can begin messaging your bot!

In summary, your bot should now be able to send and receive WhatsApp messages through the sandbox on Twilio. If you encountered any issues, or would like help setting up your bot please email us at support@botlibre.com or upgrade to our Platinum service and we can build your bot for you.

No comments:

Post a Comment