ServiceNow and Twilio integrate through ServiceNow's REST Message framework, Business Rules, and Flow Designer to send SMS notifications when incidents are created at critical priority, when SLA breach thresholds are crossed, or when on-call assignment changes, ensuring engineers receive immediate phone alerts rather than relying on email or the ServiceNow notification center. This integration is used by enterprise IT operations teams that run their ITSM processes in ServiceNow and need Twilio's reliable carrier network to deliver high-priority incident alerts to on-call staff who may not be at their desks. The setup uses ServiceNow's outbound HTTP calling capabilities to reach the Twilio REST API, with Business Rules or Flow Designer providing the trigger logic that fires when the specified incident conditions are met.
What You Need Before You Start
You need ServiceNow administrator access to create REST Messages, configure Business Rules, and set up outbound HTTP connections, all of which are managed under the System Web Services and Studio sections of the ServiceNow platform. Create a ServiceNow REST Message record by navigating to System Web Services, then Outbound, then REST Messages, clicking New, naming it Twilio SMS, and setting the Endpoint to https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json where you replace the Account SID with your actual value. Add a Basic Authentication profile to the REST Message by creating a new HTTP Auth Profile linked to the message, setting the type to Basic and entering your Twilio Account SID as the username and Auth Token as the password. From Twilio, collect your Account SID, Auth Token, and SMS-capable phone number, and prepare an on-call roster mapping ServiceNow user sysids or phone fields to mobile phone numbers for SMS delivery.
Step-by-Step Integration Guide
Create a REST Message HTTP Method under your Twilio SMS REST Message record by adding a new HTTP Method named sendSMS, setting the HTTP Method to POST, and in the HTTP Request section adding a Content-Type header set to application/x-www-form-urlencoded and a request body template containing To=${to}&From=${from}&Body=${body} with the three variables as method parameters you will populate at call time. Write a ServiceNow Business Rule on the Incident table by navigating to System Definition, then Business Rules, clicking New, setting the Table to Incident, enabling the When setting to after and checking the Insert and Update checkboxes, and entering a Filter Condition that checks priority equals 1 Critical or priority equals 2 High. In the Business Rule script section, use GlideHTTPRequest or the ServiceNow REST Message API to send the SMS by creating a new sn_ws.RESTMessage object pointing to your Twilio REST Message definition, calling getMethodByName('sendSMS'), setting the variable string for to using the assignee's phone from the sys_user table fetched by the incident's assigned_to field, setting from to your Twilio number, setting body to a string containing the incident number, short description, and priority, and calling execute() to dispatch the HTTP call. Retrieve the assignee's mobile phone by querying the sys_user table using new GlideRecord('sys_user') with the addQuery method filtering on sys_id equal to the incident's assigned_to.sys_id value, then reading the mobile_phone field from the result.
Common Issues and How to Fix Them
ServiceNow Business Rules that make outbound HTTP calls to Twilio can fail with a connection refused or SSL handshake error when the ServiceNow instance is not configured to allow outbound HTTPS calls to external domains. Navigate to System Properties, then Security, then Outbound HTTP Connections and verify that https://api.twilio.com is included in the allowed outbound domains list, as ServiceNow may block all outbound calls by default on tightly locked-down enterprise instances. Business Rule scripts run synchronously within the ServiceNow transaction and if the Twilio API call takes more than a few seconds, the Business Rule times out and the incident record update can fail or rollback. Switch to an asynchronous Business Rule by checking the Async checkbox on the rule, which queues the script to run in a background thread after the transaction commits and prevents the API call latency from affecting the user-facing save operation. SMS messages are sent but arrive with the wrong content when ServiceNow variable substitution in the request body template fails due to special characters in the incident short description, such as ampersands or equals signs that break the URL-encoded body format. URL-encode the body variable in your Business Rule script using the JavaScript encodeURIComponent function before constructing the request body string, or use the ServiceNow GlideStringUtil.urlEncode method to safely escape the message content.
How to Get More from This Integration
Build an on-call rotation resolver in your Business Rule by querying a custom ServiceNow table that stores on-call schedules with start time, end time, and user sysid columns, finding the currently on-call user whose schedule overlaps the current GlideDateTime, and retrieving that user's mobile_phone to use as the SMS recipient rather than hardcoding a phone or using the incident assignee. Create an SLA breach alert by adding a Scheduled Script Execution in ServiceNow under System Scheduler, then Scheduled Script Executions, that runs every 15 minutes, queries the Task SLA table for records where has_breached equals true and modified in the last 15 minutes, and sends a Twilio SMS for each newly breached SLA to the responsible team's on-call phone. Extend the integration to inbound SMS by deploying a Twilio Function or middleware that receives Twilio inbound messages and creates ServiceNow incidents via the ServiceNow REST API at POST https://{instance}.service-now.com/api/now/table/incident with Basic authentication using a ServiceNow integration user's credentials, allowing field technicians to create incidents by SMS without accessing the ServiceNow portal. Use ServiceNow Flow Designer as an alternative to Business Rules by creating a Flow triggered on the Incident table, adding a condition check for priority equals P1, adding a ServiceNow REST Action step pointing to your Twilio REST Message, and using pill variables to map the assignee's phone and the incident details into the action inputs, giving non-developers a visual way to manage the SMS trigger logic.
Conclusion
Twilio and ServiceNow together ensure your on-call engineers receive critical incident alerts by SMS at the moment they are created, bridging the gap between your ITSM platform and the phone your engineers always have with them. Contact Telphi Consulting to design and implement this integration for your ServiceNow instance.
Ready to Transform Your Business Communications?
Get a free consultation with our VoIP experts and discover how we can help you save costs, improve efficiency, and scale your business.
Comments (0)
Join the discussion and share your thoughts (AI-moderated for quality)
Be the first to comment
No comments yet. Share your thoughts below.