Configuring Twilio WhatsApp for Testing
In addition to setting up SMS and Text-to-Speech in the Twilio configuration, you can configure WhatsApp either in the testing (sandbox) mode or in the production mode with WhatsApp Business Account.
This topic describes configuring WhatsApp in the Twilio sandbox. To use WhatsApp in the production mode, refer to Configuring Twilio WhatsApp for Production.
To configure Twilio WhatsApp for testing:
- Log in to your Twilio console and go to Messaging > Try it out > Send a WhatsApp message to open the WhatsApp sandbox.
-
Connect your device to Twilio sandbox. Do one of the following:
- Scan the provided QR code.
-
Send a WhatsApp message from the desired device to the provided phone number. Copy the code displayed below the phone number as the message text.
- Copy the WhatsApp sandbox number in the Send a WhatsApp message section. It will be used as the outgoing WhatsApp number in Workbench.
- Open Workbench and in Project Explorer, expand your project > Alarms and Notifications > Alert Notifications.
- Expand Twilio Configurations and double-click the default Twilio configuration that you have set up for sending SMS and Text-to Speech, or create one. Learn more
-
In Default WhatsApp Number, enter the number to be used for sending WhatsApp messages via Twilio. Do the following:
- Go to the WhatsApp Numbers tab and select Click here to add new item.
- Name the new item in the Name column and in the WhatsApp Number column, enter the sandbox phone number.
- Go back to the General Settings tab and in Default WhatsApp Number, select the newly added phone number from the drop-down list.
-
Click Apply to save the configuration, and then test the functionality by sending a test WhatsApp message.
- Click Test WhatsApp next to the Default WhatsApp Number box to open the Send a test message form.
-
In To, enter the phone number that you have connected to the Twilio sandbox, and then click Send Message. You should receive the WhatsApp message to the selected number as expected.
The sandbox validation expires in 24 hours, so you need to test within that time frame or connect to the sandbox again.
What's Next?