Introduction:
In this article , we will demonstrate how to use Twilio API for sending SMS using Mulesoft.
Architecture Diagram:
![](https://www.mstsolutions.com/wp-content/uploads/2022/10/image-6-28.png)
Prerequisite:
1, Need to have an active account in Twilio.For new Account, signup here.
2. In Anypoint studio, add Twilio connector module from exchange.
Implementation:
![](https://www.mstsolutions.com/wp-content/uploads/2022/10/image-6-27.png)
- Preparing payload for sending SMS through Twilio API
![](https://www.mstsolutions.com/wp-content/uploads/2022/10/image-6-27.png)
Here, we need to pass Twilio Account Mobile number to “From” key and pass recipient mobile number to “To” key. The content of the message can be passed to “Body” key.
- Configuring Twilio Create Message connector
![](https://www.mstsolutions.com/wp-content/uploads/2022/10/image-6-28.png)
Here, In Username, we need to give Account Sid value which will be in Twilio Account, and in Password we need to give authentication token of Twilio Account.
- Checking the status of message sent
Once we have sent the payload to Twilio, it will return the status of message Sample response from the Twilio:
![](https://www.mstsolutions.com/wp-content/uploads/2022/10/image-6-29-1024x486.png)
Conclusion:
![](https://www.mstsolutions.com/wp-content/uploads/2022/10/image-6-30-1024x425.png)
Message was successfully sent to Recipients using the Twilio API.
Reference Link:
For additional information, please check below: