Send SMS from Chatter Feed with Action Link Template

In this blog, I am going to explain how to send SMS  from chatter feed by using action link templates. I am going to use Twilio rest API to send the SMS. Please refer this link for more information on action link templates Inside Action Link Templates

1. Defining Action Link Group Templates

Go to Setup, enter Action Link Templates in the Quick Find box, then select Action Link Templates create a new one with the below values

Field Value
Name Send Text Messages
Developer Name Send_Text_Messages
Category Primary action
Executions Allowed Once
Hours until Expiration

10.PNG

 

2 . Creating an  Action Link template

Create a new Action link template under the above-created action link group template with the following details.

Field Value
Action Link Group Template Send Text Messages
Action Type Api API Async
Action URL https://api.twilio.com/2010-04-01/Accounts/{!Bindings.accountSID}/SMS/Messages.json
User Visibility Every one can see
HTTP Request Body Body={!Bindings.body}&To={!Bindings.toNumber}&From={!Bindings.fromNumber}
HTTP Headers Authorization: Basic {!Bindings.authToken}
Host: {!Bindings.host}
Content-Length: {!Bindings.lenght}
X-Target-URI: {!Bindings.uri}
Content-Type: {!Bindings.conenttype}
Position 0
Label Key None
Label Text Message
HTTP Method POST

after saving the Action link template its looks as shown below

11.PNG

Go back to the action link group template and publish it

3. Posting it to chatter feed 

Now I am going to use apex to instantiated action link template and post it to chatter.go to developer console and paste the below code.

 

 

Now you can see new action link on the chatter feed as shown below.

12.PNG Once you click on the Text message it will send an SMS and also update the Statis to chatter feed.