Send messages and establish the one to one call through Twilio

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

  1. 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.
  2. 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.
  3. 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#. 


  1. From: In this parameter passed the phone number which we purchased from the Twilio console.
  2. To: In this parameter passed the phone number of the person we would like to call.
  3. 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:

  1. Say: This verbs is used for to read text to the caller
  2. Play: This verbs is used for to play audio file to the caller
  3. Dial: This verbs is used for to add another person to the call
  4. Record: This verbs is used for to record  the call
  5. Gather : This verbs is used  collect digit from the caller keypad
  6. SMS: This verbs is used  to send message during the call
  7. Hangup: This verbs is used  to disconnect the call
  8. Queue: This verbs is used  when add the caller to any call
  9. Pause: This verbs is used  when we need to wait before executing the instruction
  10. Reject: This verbs is used  when call is declined
  11. Message: This verbs is used  send SMS message reply

About Author

Manektech Team

ManekTech Team

ManekTech is a well-known software development and IT consulting company, providing custom software, website, and mobile app development services. ManekTech has own content writing and development team who writes content on various and trending technology that it serves currently.

Need a consultation?

Drop us a line! We are here to answer your questions 24/7

Areas we serve

USA

4100 NW Loop 410,Suite 200San Antonio Texas USA 78229

UK

7 Artisan Place Harrow,HA3 5DS

India

4th Floor, Timber Point,Prahaladnagar Road,Ahmedabad, Gujarat - 380015,

PREV
NEXT