logo

NJP

Send SMS with Twilio, Notify and Flow Designer

Import · Feb 13, 2019 · article

The example I have considered - To send out an SMS to the caller when an incident with priority 1 is updated.

This article involves sending an SMS with the help of Twilio, Notify and Flow designer.

Step 1: Activate the plugin Notify

Plugin Name Notify
ID com.snc.notify

Step 2: Configure Twilio with Notify

We would need a twilio account to configure with notify. Once you signup for a trial version, you would be provided with application SID and authentication token. This is visible in dashboard once you create a project on twilio. Ex. screenshot mentioned

imageimage

  • Now on ServiceNow, go to section Notify → Administration → Twilio Configuration.

image

Step 3: Flow Designer

Here I have used a flow designer to create a trigger when the incident is created with priority 1.To create a flow-Go to Flow Designer → Designer

Trigger

Actions

  • Send SMS through notify
  • Log

Ex. of Flow

image

Send SMS through notify is a custom action which has the code to send SMS to a mobile number provided.

In this action we have added the following code in script -

(

function execute(inputs, outputs) 

{ 

var

 notify = 

new

 sn_notify.NotifyScoped(); 

var

 from = 

'<from>'

; 

var

 to = inputs[

"to"

]; 

new

 notify.sendSMS(from, to, 

"Incident with Number "

 + inputs[

"incident"

][

"number"

] + 

"- "

 + inputs[

"incident"

][

"short_description"

]);
})(inputs, outputs);

image

Step 4: Test

This can be tested from the test button on the Flow

image

This is a very basic example of how to use twilio with ServiceNow.

PS - To use Notify in a scoped application use - sn_notify.NotifyScoped(), else SNC.Notify() would work

Hope it helps!

Labels:

image

View original source

https://www.servicenow.com/community/developer-articles/send-sms-with-twilio-notify-and-flow-designer/ta-p/2309591