Create Twilio trial account
Create trial Twilio account.
After signing into Twilio, please note down Account SID & Auth Token which you would be using for authentication purpose.
If you are unable to see messaging option click on '+' icon in the left develop pane and select Messaging.
Click on try out and click on send WhatsApp Message and follow the instructions to connect to the sandbox.
Create App-Driven integration in OIC
In the below example, we have shown how to send WhatsApp message to external WhatsApp number using Twilio sandbox number.
Create a App driven OIC integration, expose it as a Rest Integration.
Configure Rest Trigger
Create a Rest Connection to invoke Twilio
Configure security as basic authentication, use Twilio account SID as username and Twilio Auth Token as password as shown in the first step
Use https://api.twilio.com/2010-04-01 as connection URL.
save, test and close connection.
Configure the above connection as invoke in OIC integration. Replace <Account_SID> with your account SID value.
Use /Accounts/<Account_SID>/Messages.json string as URI
Configure query parameter as shown below
Check mark send query parameters as form data in message body as shown below
Click on done and close.
Map the value to invoke configuration.
Activate and test the integration by sending below request payload.
After activation click on 3 dots against the integration and select run option.
Pass below values as part of request payload. Click on run.
From -> Twilio WhatsApp number prefix with "whatsapp:"
To -> Recipient WhatsApp number prefix with "whatsapp:"
You should receive the response as 202 accepted and verify your WhatsApp for the above mess from Twilio.
Thanks for reading this blog. For any queries or question on the above scenario, please drop a comment. We are happy to resolve your queries!