Create a Notification System in ServiceNow using Twilio SMS and Voice
Time to read: 9 minutes
If you're using ServiceNow, you might want a straightforward way to add one-way outbound messaging with voice and conferencing.
This tutorial shows how ServiceNow customers can utilize the out-of-the-box integration with Twilio Messaging and Programmable Voice using the free ServiceNow Notify plugin. The plugin is straightforward to set up, and the business value of implementing it is immense. You can greatly reduce your incidents' time to resolution, shorten the timeline for mobilizing resources to solve incidents and streamline communications with your customers during active incidents.
In this tutorial, you'll implement the ServiceNow and Twilio integration by configuring the following features:
- ServiceNow Notify for basic SMS and conference calls
- Alerts and Notifications using the ServiceNow Workflow Designer
- Alerts and Notifications using ServiceNow Business Rules
ServiceNow and Twilio integrations
This post is Twilio's recommended Crawl integration with ServiceNow. You can learn more about the ServiceNow use case on the Twilio website.
If you'd like to do contextual outbound notifications and update ServiceNow in real-time via SMS or Voice, see our bi-directional incident management framework to integrate Twilio with ServiceNow – Walk.
If you're looking for the most fully-featured Flex and ServiceNow integration, which includes inbound self-service and the ability to escalate to a live agent, see our guide on how to integrate Twilio Studio & Flex with ServiceNow – Run.
Prerequisites
Before you get started, you will need:
- A Twilio account (Sign up for a free trial account and get a $10 credit)
- A ServiceNow account (Sign up for a free developer instance)
Configure Twilio phone numbers
Login to your Twilio account.
Note: Only one Twilio account or subaccount can be configured on a given Notify driver at a time. Ensure that each ServiceNow instance on which you configure Notify uses a different Twilio account.
If you are using a free Twilio account, check out this helpful guide on the ServiceNow community board.
If you are going to follow Part 2 and/or Part 3 of this series, or if you are currently using other phone numbers in the account for a different application, consider implementing this tutorial on a separate account or subaccount. The ServiceNow Notify plugin automatically creates a TwiML "ServiceNowTwilioDirect" for all phone numbers attached to your Twilio account, which will overwrite the current configuration for those phone numbers.
Collect your Account SID and Authentication token under Project Info from the Twilio Console:
You will need at least one Twilio number from which to send messages and place calls.
Buying one Twilio number per Notify Number Group will allow you to group Notify phone numbers, then share workflows across those grouped numbers. For each number group, you can specify a workflow for incoming and outgoing calls.
Under the "Phone Numbers" section of the Twilio Console, view the "Buy a number" section to buy SMS and Voice capable numbers:
Note: If you are going to send notifications to U.S.-based numbers, read about A2P 10DLC on the Twilio website and in the Twilio documentation. For simple testing, this step is not required. For production, we recommend that you perform the A2P 10DLC registration for the messaging service called "ServiceNowTwilioDirect", which will be automatically created by the ServiceNow Notify plugin in the next step.
Configure ServiceNow Notify
If you haven’t already done so, login to your existing ServiceNow account.
Follow this helpful guide on the ServiceNow community board to connect ServiceNow Notify with your Twilio account. In summary, you will need to:
- Install the Plugins for Notify.
- Notify (
com.snc.notify
) plugin - Provides powerful platform features for workflow-driven voice calls, conference calls, and SMS messages. You can activate the Notify plugin if you are an administrator. - Notify - Twilio Direct Driver (
com.snc.notify.twilio_direct
) plugin - Provides next generation integration with Twilio and Notify.
Configure the ServiceNow integration with your Twilio account, then add your account SID and the Auth token. Import the phone numbers associated with your Twilio account to Notify.
Note: Notify automatically creates a TwiML application named "ServiceNowTwilioDirect" and configures the application to use the instance as an endpoint. This is the reason this integration can only use a single Twilio account or subaccount. You cannot have any existing TwiML app configured otherwise this step will fail.
Follow this helpful guide on the ServiceNow community board to set up Notify. We'll walk through the main steps together below.
First, associate your Twilio number with the appropriate Notify Group:
Update the Notify Properties.
Set the glide.enable.notify_on_task
property to 'true'.
Set your Twilio number on the glide.notify.task.phone_number
property.
Set your Twilio number on the com.snc.on_call_rotation.notify_webrtc_number
property.
Convert phone numbers to E.164 format (optional)
You can optionally setup the Phone Number entries to be formatted in the E.164 format. Go to "My Profile", then with the cursor close to "Mobile phone", right click and select "Configure Dictionary":
Change the type to "Phone Number (E164)" and click "Update":
Go back to your testing user record and type your phone number into the Mobile Phone field (e.g. +12121234567). The system will automatically convert it to the E.164 format +1(212)123-4567:
Verify the integration was successful
On the "Filter navigator", type "Incident" and you will see the "Incident" menu. Select "All". Select any of the existing Incidents:
You should be able to see "Send SMS" and "Start Conference Call" links as shown below. If you do not see these links, follow this helpful guide on the ServiceNow community board for the steps needed to test the integration.
At this point, Notify is ready to be used directly from the incident tickets dashboard in ServiceNow to "Send SMS" or "Start Conference Call".
Both options are intuitive and easy to use. Follow this helpful guide on the ServiceNow community board to further test the "Start Conference Call" functionality.
Note: All calls and messages made from tasks are initiated using a single Notify phone number (long code or short code). You can configure which phone number is used on the "Notify - Notify Properties" page as shown below.
Configure a click-to-call button (optional)
You can optionally configure a "Click to Call" button directly from the Incident form using this helpful guide on the ServiceNow community board. This is what it will look like, and you can place the call immediately using this icon:
Configure Alerts and Notifications
Integrating Twilio with ServiceNow can reduce an incident’s time-to-resolution by:
- Sending SMS notifications to the user confirming that the incident was opened and assigned to an engineer.
- Alerting the on-call engineer via SMS that a High Priority incident was just assigned to them.
Watch this How to send SMS from ServiceNow with Twilio video to learn how to build these features. We’ll walk through the steps from the video below.
First, let’s send a message to the customer confirming that the incident was created and provide the engineer’s contact information. We will use the ServiceNow Workflow Designer for this.
Go to the Workflow Editor in the ServiceNow dashboard. To locate it, type "Workflow Editor" in the search bar at the top of the left navigation bar:
A new tab will open. Click on "New Workflow". This window will open:
- Enter a Name for this flow (e.g. NotifyCustomerCaseAssigned)
- Define the Table on which it will run (e.g. Incident[Incident])
- Provide a Description for this workflow (e.g. "Notify customer that ticket was created and assigned to someone").
- Under the Conditions tab, for "If condition matches" select "Run the workflow always". For this example, select "Assigned to" and "is not empty". It should look like this:
Click Submit. You will see your new Workflow created in a new tab:
Delete the arrow connecting the boxes. On the tab "Core" on the right, open "Core Activities" → "Notify" → "Send SMS". Drag and drop the "Send SMS" activity to the "Workflow drawing canvas". A new window will appear to configure the "Send SMS" activity:
- Enter a Name for this workflow activity (e.g. "Notify Case was assigned to someone")
- Leave the Stage blank.
- Select the "From" number. If you click the search icon to the right of the "From" text field, it will show you the available Notify numbers if you added them to the "Notify on Task" group.
- Select the "To" or "To (groups)" fields depending on who you want to receive the notification
In the "To" area, click on the "Select field" icon:
Under "Caller", select "caller_id":
Customize the body of the message in the "Message" field.
Alternatively, you can select any custom fields you want to the right of the "Message" box, to insert dynamic information if needed.
For example, you can use this template:
Click Submit.
In the ServiceNow Console, click the "Begin" box and link it to the "Send SMS" box, click the "Send SMS" box and link it to the "End" box.
Click the Validate icon, which is the checkbox in the top right corner. A screen will appear like the one shown below:
If there are no errors or issues, click "Publish" from the top menu dropdown:
Test the alert and notification functionality
Let’s verify that this new Workflow functions as we expect. First, open a new incident by clicking on "Incident" and then "Create New":
Add information for the "Caller", "Assignment group" and "Assigned to" fields that you want to test. For example:
Click the Submit button. Your "Caller" or customer should receive a notification like this:
Success!
Configure ServiceNow Business Rules
Our last example will be to configure Alerts and Notifications using ServiceNow Business Rules.
ServiceNow Notify has powerful API’s for you to address business challenges like sending a notification for high-severity or stale incidents. We’ll use these APIs and the ServiceNow Business Rules to send a notification to the assigned engineer when a High Priority incident is created.
We will will use the following Notify SMS API:
Type "Business Rules" in the "Filter navigator" of your ServiceNow dashboard:
Select "New":
- Give the new Business Rule a name (e.g. "NotifyAssigneeHighPriority").
- Select "Incident[incident]" under "Table"
- Check "Advanced"
Follow these configuration steps in the "When to run" tab:
- In the dropdown to the right of "When", select "After".
- Check "Insert" to the right of the "When" dropdown.
- Under "Filter Conditions", click on "Add Filter Condition". Set the priority to "Critical" and ensure the "Assigned to" value is "is not empty".
Click the "Advanced" tab, which is to the right of the "When to run" tab. You’ll see a "Script" text box which is where we’ll write the script using the SNC.Notify.sendSMS
API. Here are the parameters we will need:
notifyPhoneNumber
- The Twilio Number to send messages from.toPhoneNumber
- Dynamic number of the user the incident is assigned to (e.g. "+current.assigned_to.mobile_phone").messageBody
- Dynamic message (e.g. ''+current.number + ':' + current.short_description,current")GlideRecord source
- Glide record (e.g. "current").
For example:
Click "Update".
Test the ServiceNow Business Rules setup
Let's test the setup! Go to Incidents and follow these steps:
- Select "New"
- Assign a Caller
- Ensure the "Impact" value is set to "1-High" and the "Urgency" value is set to "1-High". This will set the "Priority" to "1-Critical"
- Assign an engineer
- Provide a "Short description"
- Click "Submit"
The message will be sent automatically:
Success!
Conclusion
In this tutorial, you have learned how to configure ServiceNow Notify for basic SMS and conference calls, and how to configure Alerts and Notifications using the ServiceNow Workflow Designer and ServiceNow Business Rules.
Next steps
The Notify implementation is intuitive and simple to use. However, it is a one-way, outbound-only solution and works only with a single Twilio account or subaccount. If you need more flexibility, check out the other tutorials in the series to see how you can further enhance your ServiceNow integration with Twilio.
Al Kiramoto is a Solutions Engineer at Twilio who enjoys working with customers and solving business problems. He lives in Dallas, TX and enjoys a good barbecue and TexMex food. He can be reached at akiramoto [at] twilio.com.
Additional resources
The following reference resources will provide you with in-depth information on some of the topics mentioned in this post:
- ServiceNow Quebec Notify documentation
- Video: ServiceNow Notify Demo and Training from SAASNow
- Vishal Ingle’s ServiceNow support articles
- Setting up Twilio - How to read the Docs - Twilio Part 1
- Configure Notify with Twilio - How to read the Docs - Twilio Part 2
- Setting up Notify - How to read the Docs - Twilio Part 3
- Testing Notify-Twilio Integration - How to read the Docs - Twilio Part 4
- Using Notify with tasks - How to read the Docs - Twilio Part 5
- Make a call to the Incident Caller - How to read the Docs - Twilio Part 6
- Notify API - allows you to interact with Notify calls and SMS messages using scripts
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.