Saturday, 21 June 2014

#Salesforce Integration With Twilio

I was searching Twilio integration with salesforce on the web but didn't find any, so am posting this a simple POC of sending SMS to the mobile using Twilio from the Salesforce UI.


Its simple but just you need to do something extra two make this functionality working.

We will go step by step for this
First of all create a new account on Twilio click here 
Twilio will provide you a number, via which it will sent you SMS.

Now login to your salesforce account and create a Remote Site Setting.
In Remote Site URL enter https://api.twilio.com, like shown below

And then create a custom setting named as Twilio Configuration.
We are gonna use them in our apex classes.
Create fields on the custom setting you've just created, with same API name as below shown.


Now we need to provide some values to the fields ofthe custom setting click on Manage button shown above.

Before entering any values to the fields click on these links
For Auth Token and Account SID Click Here
For Test Credetials i.e. Test Account SID and Test Auth Token Click Here

For Account Name enter the name from which you registered like your email id.
For From Phone Number enter that number which got when you created account on Twilio.
After that save your custom setting.

Custom Setting should look something like this


After that you can save the code provided here GitHub 

Page will look something like this




See that was a piece of cake :)
Hope everything works just fine.
Happy coding..!!!

22 comments:

  1. I am unable to receive the sms via twilio in sale force see this link I doing correct way are not can some one please help me https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AZPi

    ReplyDelete
  2. GitHub link does not work.....

    ReplyDelete
  3. Salesforce Admin Online Training,
    Salesforce CRM Online Training,
    Salesforce Developer Online Training,
    ONLINE TRAINING – IT SUPPORT – CORPORATE TRAINING
    The 21st Century Software Solutions of India offers one of the Largest conglomerations of Software Training, IT Support, Corporate Training institute in India - +919000444287 - +917386622889 - Visakhapatnam,Hyderabad
    Salesforce Admin Online Training, Salesforce Admin Training, Salesforce Admin, Salesforce Admin Online Training| Salesforce Admin Training| Salesforce Admin|
    Salesforce CRM Online Training, Salesforce CRM Training, Salesforce CRM, Salesforce CRM Online Training| Salesforce CRM Training| Salesforce CRM|
    Salesforce Developer Online Training, Salesforce Developer Training, Salesforce Developer, Salesforce Developer Online Training| Salesforce Developer Training| Salesforce Developer|
    Salesforce Admin Online Training, Salesforce Admin Training, Salesforce Admin, Salesforce Admin Online Training| Salesforce Admin Training| Salesforce Admin|
    Salesforce CRM Online Training, Salesforce CRM Training, Salesforce CRM, Salesforce CRM Online Training| Salesforce CRM Training| Salesforce CRM|
    Salesforce Developer Online Training, Salesforce Developer Training, Salesforce Developer, Salesforce Developer Online Training| Salesforce Developer Training| Salesforce Developer|
    Visit: http://www.21cssindia.com/courses.html

    ReplyDelete
  4. I already have the Github code, where can I enter it?

    ReplyDelete
  5. Hi Abhi ,
    I tried the above integration , but not able to send message ,

    I am getting "Phone number is not valid" issue . Can you please tell me what is the issue .
    I am entering proper mobile number with +91 code .Please help!!!

    ReplyDelete
  6. Please send the issue on force.com community and send me the link I will help you brief there, above code works if you go steps mentioned above.

    ReplyDelete
  7. Hi Abhi ,
    I figured out the problem , Thanks for the response .
    By the way ,its a great blog .Keep it up :)

    ReplyDelete
  8. Abhi , instead of json , can we send the data through xml?

    ReplyDelete
  9. Hi Abhi,

    I am getting this issue.
    'Phone number is not valid'

    Could you help me for this?

    ReplyDelete
    Replies
    1. Hi Abhi,

      This Issue has been resolved but i am unable to get message on my Phone number.

      Delete
    2. Twillio work for only few message to send on a particular number if you using free account. Which type of account you are using ?

      Delete
    3. Yes i am sending Message to the Number which is Verified from Twilio because In case of Trail Account we can only use one number that is verified from Twilio as you said But still Unable to get message on that number.

      Delete
    4. Please recheck your code, that everything is working fine, and your not getting any exception, are getting response from twillio ?

      Delete
    5. I already checked it there is no Exception.
      If you want I can show you Response Which I got.

      Delete
    6. Hi Abhi,

      This Issue has been Resolved Now I am able to Receive Message on Provided Mobile Number.
      Actually there was Some Mobile Network Issue .
      I Talked with Twilio Support and They Solved This Issue.

      Thank you for your Support.
      Still I have one Question Regarding This Integration.
      could You help me for this?

      Delete
  10. This comment has been removed by the author.

    ReplyDelete
  11. I already checked it there is no Exception.
    If you want I can show you Response Which I got.

    ReplyDelete