Send sms to mobile using twilio sms service

In today’s era, we send sms to mobile from our site for many purpose. It can be for phone number verification at the time of user registration or it can be some other purpose. But this is becoming trending these days to send sms from our website. 90% of website use the twilio service to send sms to mobile. Follow the steps given bellow to implement this in your wordpress site:

Step 1 (Make the account at twilio official website to send sms to mobile)

First of all, you have to make the account in the twilio official website. This is a paid service. There are two kind of account in the twilio website.

  1. Trial account,
  2. Upgraded account.

Note : If you just want to test drive the service, you can make the trial account. There are some limitations for trial account in twilio.

  1. You can send sms to only those numbers which are verified in the official twilio website.
  2. There is a limited account balance using which we can test the service.

but still that amount of balance is enough to test the service.

Step 2 (installing twilio plugin for wordpress)

In the second step, we will install the twilio plugin for wordpress. This plugin provides you the facility to add your twilio account details using simple UI.

You can search in the official website of wordpress for the twilio plugin or you can download it using this link (Download twilio plugin)

Step 3 (setup twilio service in wordpress plugin)

 

Send sms to mobile
twilio setup guide

From the image given above, it is quite clear about the setup.

  1. In the first field, you have to enter the account SID. To get this id, login to your twilio account and after login, you see the “account SID”. Copy that into first input field of plugin.
  2. In the second field, you have to enter the “auth token” which is again present at the same place of twilio website. There will be an icon of “eye”. Just click that eye and you will be there with the auth token for your account.
  3. Third is the “twilio number”. For this, you have to click the button just bellow these two in the twilio website. There you can find the number associated with your twilio account. Copy that into the third field and you are done with the setup.

step 4 (sending test message from site)

Once you have setup the things, its time to test the setup. To test that, you can even send the sms from the same interface. There is tab “test”. Go to that and put the number to whom you want to send sms and write some content in second column and click send.

Note : If you are using the trial account of twilio, you may face error sending message if you haven’t added that number to your twilio account because in twilio trail account, you can send the sms to only those numbers which are verified in the twilio account.

Step 5 (Sending message from any template, post or page using function)

Now is the time to get into the coding part. To send the sms using the code in any custom template or default template of theme, use the following code.

That is all you need. You can send sms to any number. If you have any queries regarding this, you can use our forum to ask the question. Experts from all over the world will help you out for your queries.