Make sure you have the Twilio Serverless Toolkit installed before proceding.
Known issue: This function does not handle creating a conversation correctly when the first WhatsApp message is an attachment. This may result in warnings/errors logged by the Studio Flow. This is not an issue for non-sandbox WhatsApp addresses.
-
Clone this repo.
-
Rename the
.env.example
file to.env
and fill it if your Account SID, Auth Token and the Studio Flow that you use to send the conversations to Flex. -
Run
twilio serverless:deploy
and copy the URL function that will appear in the terminal after the deploy underFunctions:
. -
Go to WhatsApp Sandbox Settings in your Twilio console and register the number you are using for testing. In the Sandbox Configuration section, paste the Function URL into the "WHEN A MESSAGE COMES IN" field.
-
If you haven't registered your WhatsApp number in the sandbox, do that now by following the instructions in the WhatsApp Participants section. You can use this guide on How to join a Twilio Sandbox as well.
-
Note that this registration is valid for 3 days and you will have to re-register after that period.
-
Save your settings.
-
You can now test the WhatsApp integration by sending a message from your WhatsApp to your Sandbox phone number.