Sharing is caring!
Mobile devices have opened up a new channel for doing business for digital marketers. Text Messaging or SMS Marketing is fast gaining importance as the most reliable way to communicate with customers. Why? Because Text Messaging not only drives conversions but sparks conversations with your clients. SMS Marketing helps to reach out to the customers in a whole new way.
What Is Twilio?
Twilio makes it easy to send and receive SMS. Twilio is a developer platform for communications used not only to send and receive SMS but for Calls and it is also using its Web service APIs. Twilio’s programmable application program interfaces (APIs), a set of building blocks get used by the developers – to build the desired customer experiences.
In this blog, we will provide insights on the steps to register on Twilio and throw light on how to hit Twilio with Postman and Apex.
What Are The Steps To Register On Twilio?
1. First, you need to Register (Sign Up) On Twilio.
2. Use Login for Signup/Login:
3. Get a link in the Mail.
4. Click on a link so that you can Sign Up.
What Is a Postman?
Postman is a free and easy-to-use development tool for making API calls with a variety of helpful features.
How To Hit Twilio Using Postman For SMS?
- You need to get an Endpoint Url from Twilio Account.
- You also need to get ACCOUNT_SID, AUTH_TOKEN, SenderId, from Twilio Account.
- After that you have to select the post method and enter the endpoint URL.
4. Now you have to set the header as well as the body for the same.
5. Then you need to click on the Send button to hit the Twilio.
6. Now, you have got the response from Twilio.
Now, we will try to hit Twilio by using an Apex class for SMS.
How To Hit Twilio Using Apex Class For SMS?
Here is a code snippet:
Twilio’s Verify API will return HTTP responses and error codes which help you to verify normal behavior and contextualize exceptions as well.
Some Status codes when you hit the Twilio API are mentioned below:
HTTP Status Codes
Status | Reason |
200 OK | Response is correct. The body of the response will include the data requested. |
400 Bad Request | There was an error with the request. The body of the response will have more info. |
429 Too Many Requests | API usage limit. If you reach API usage limits, a 429 will be returned. Please wait until you pass the limit and attempt the call again. |
503 Service Unavailable | There are multiple possible reasons for a HTTP 503 error |
Now, let me give an example to explain “How Twilio SMS works?”
An Example Of Twilio SMS
Scenario: When we sign up on any website then a code is sent in an SMS.
Here is a setup to cover this scenario:
1. You need to create a page for SignUp.
2. Enter the credential for signup as shown in the below screenshot.
3. When you enter the phone number and click on a submit button, as shown in the above figure, then the OTP goes to the specified number.
4. When you enter the correct OTP, as shown above then a pop message appears to confirm that you have signed up successfully.
Conclusion
Mobile devices have opened up a new channel for doing business for digital marketers. SMS Marketing is quickly gaining importance as the most reliable way to communicate with customers. It drives conversions but sparks conversations with your clients. SMS Marketing helps to reach out to the customers in a whole new way. Twilio is a developer platform for communications used not only to send and receive SMS but for Calls and to use its Web service APIs. Twilio’s programmable application program interfaces (APIs) enable the developers to build the desired customer experiences.
Want to streamline data flow with valuable insights into customer data? We at Cloud Analogy will assist you in empowering your business with strengthened business decisions and scalable solutions.
Sachin Arora
Scrum Master and Principal Solutions Architect
Sachin, a renowned Scrum Master and Principal Solutions Architect at Cloud Analogy, has rich experience when it comes to working on process improvement in a fast-paced environment maintaining high level of quality in all deliverables. Sachin's expertise lies in varied hardware and software environments including Cloud technologies such as Salesforce, AWS, Cloud Foundry & Google App Engine and Mobile.Hire the best Salesforce Development Company. Choose certified Salesforce Developers from Cloud Analogy now.