Why do we need to choose Twilio for sending messages and one-to-one calls? So now we are going to discuss Twilio.
What is Twilio?
Currently, every small or big type of business require communication. Business grows; it means the demand of customer is also increase. So customer satisfaction is also very important in every business and also requires fulfilling customer requirements. So to reach customers easily anywhere, now enterprise developer create its own custom chat massager, telephonic service and for that Twilio is used.
Twilio is a customer engagement platform that create moments with user globally to send SMS, WhatsApp, Voice, Email. More than a million developers and business enterprise use Twilio to develop communication solutions it is also intermediate to connecting customers from web-based applications and telephone.
So now we learn how to send messages using Twillio.
Send Messages using Twilio
To sending, messages use Twilio’s REST API. Using REST API we can send outgoing SMS Message from mobile number to mobile number in whole world.
To send a new outgoing message to any number, need to make http post request with Message Resource attribute of API.
For more Details about message, resource refer link ((https://www.twilio.com/docs/sms/api/message-resource)
We can post data on API using Curl or supported libraries in different languages like C#, Java, Node.js, PHP, and Python.
Use three main parameters to, from, and Body in the message resource attribute to call API.
Now, let’s see how to call REST API in C#.
Now, we see which value we need to pass in message resource attribute
- To: In this parameter, we need to pass the phone number of the person who is received the message. Pass as ‘+’ with country code and phone number.
- From: In this parameter, we need to pass the phone number of the person who is sending the message or the Twillio Phone number. Pass as ‘+’ with country code and phone number.
- Body: In this parameter, we need to pass the text message which we want to send and we can pass maximum 1600 characters.
Twillio Rest API first verifies the number which we pass in from the parameter, if it is verified then give the status like queued, failed, sent, delivered, undelivered like.
So now we learn how to one to one call using Twilio.
One to One Calling using Twilio
First, Prerequisites for calling using Twilio is to purchase a voice-enabled Twilio Phone number. For purchase Twilio phone number go to In the Twilio console,and purchase Twilio Phone number.
We will use this phone number as “From” phone number when we need to pass from attribute in Twilio Outbound Calling REST API.
Some few parameters are required to initiate outbound call. Now, let’s see how to call REST API in C#.
- From: In this parameter passed the phone number which we purchased from the Twilio console.
- To: In this parameter passed the phone number of the person we would like to call.
- Twiml: In this parameter passed the instruction in the TwilML format and this XML is one type of instruction which is send to person phone call when he pick up the call.
Now, we also see what TwilML is:
TwilML is one type of Twilio markup language. We can also say that it is XML type of tag and which is defined by the Twilio. Now see some examples
When we need to respond any incoming call we can use like below TwilML.
When we need to respond any incoming message we can use like below TwilML.
Some verbs are used in TwilML are as bellows:
- Say: This verbs is used for to read text to the caller
- Play: This verbs is used for to play audio file to the caller
- Dial: This verbs is used for to add another person to the call
- Record: This verbs is used for to record the call
- Gather : This verbs is used collect digit from the caller keypad
- SMS: This verbs is used to send message during the call
- Hangup: This verbs is used to disconnect the call
- Queue: This verbs is used when add the caller to any call
- Pause: This verbs is used when we need to wait before executing the instruction
- Reject: This verbs is used when call is declined
- Message: This verbs is used send SMS message reply
About Author
Subscribe to Our Newsletter!
Join us to stay updated with our latest blog updates, marketing tips, service tips, trends, news and announcements!