The CreatorCon Call for Content is officially open! Get started here.

Send SMS notificaiton using REST

Hitesh targe
Tera Expert

Hi All,

is anyone configured SMS notificaiton using REST?

i have a requirement to configure SMS notification. my customer has sms subscription of https://platform.clickatell.com/. How can we send SMS notification using REST ?

it would be great if anyone can share the document.

Thanks.

1 ACCEPTED SOLUTION

One more thing, In the basic authentication, You should be providing the credentials to access clickatell and not your Service Now Id and password, May be this is the issue.



Please Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

15 REPLIES 15

You can try the case for incident P1, My assumption is users phone number will be stored in user profile(mobile_phone)



1) Create a new event in the event registry module (name as incident.priority.1)


2) Create an insert-after business rule with condition as Priority is P1


3) On the business rule call the event gs.eventQueue('incident.priority.1', current, current.assignment_group.sys_id, current.configuration_item.manager.mobile_phone); // Make sure these field names are correct in your instance


4) Create a script action for this event name.


event.parm1 will give you assignment_group sys_id


event.parm2 will give you manager phone number



Clear content field in your Rest message and call the Rest API script for sending SMS to each users. To get phone number of all group members, you will have to loop each record in sys_user_grmember table. Make a list of all phone numbers



Sample Rest API call:   RESTMessageV2



try {


      var r = new sn_ws.RESTMessageV2('Rest Message Name', 'post');


      var content = {"content": "Test Message Text", "to": [list of all numbers]}';   // Your content in correct data format with all mobile numbers


      var json = new JSON();


      r.setRequestBody(json .encode(content));


      var response = sm.executeAsync();


} catch (ex) {


      var message = ex.getMessage();


}



This will take too much time, so you need to learn, understand and perform the change. You will have to work on the remaining part to complete it.



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response