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..!!!
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
Hope everything works just fine.
Happy coding..!!!
Best work Mr.Tripathi
ReplyDeleteI 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
ReplyDeleteGitHub link does not work.....
ReplyDeleteI already have the Github code, where can I enter it?
ReplyDeleteHi Abhi ,
ReplyDeleteI 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!!!
In Salesforce org
ReplyDeleteNow its working
ReplyDeletePlease 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.
ReplyDeleteHi Abhi ,
ReplyDeleteI figured out the problem , Thanks for the response .
By the way ,its a great blog .Keep it up :)
thanks Sanju
DeleteAbhi , instead of json , can we send the data through xml?
ReplyDeleteHi Abhi,
ReplyDeleteI am getting this issue.
'Phone number is not valid'
Could you help me for this?
Hi Abhi,
DeleteThis Issue has been resolved but i am unable to get message on my Phone number.
Twillio work for only few message to send on a particular number if you using free account. Which type of account you are using ?
DeleteYes 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.
DeletePlease recheck your code, that everything is working fine, and your not getting any exception, are getting response from twillio ?
DeleteI already checked it there is no Exception.
DeleteIf you want I can show you Response Which I got.
Hi Abhi,
DeleteThis 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?
This comment has been removed by the author.
ReplyDeleteI already checked it there is no Exception.
ReplyDeleteIf you want I can show you Response Which I got.
Very neat blog post.
ReplyDeletehttps://www.kitsonlinetrainings.com/course/salesforce-online-training salesforce online training
Angular JS training
Selenium training
DevOps training
Pega training
Servicenow training
nice post.salesforce training
ReplyDeletesalesforce online training
salesforce online course