Skip to main content

ServiceNow Integration

This guide will walk you through integrating Bandwidth Messaging with ServiceNow. This integration will allow you to send messages from your ServiceNow instance using Bandwidth's Messaging API.

Prerequisites

Before you can integrate Bandwidth Messaging with ServiceNow, you will need to ensure the following:

  1. You have a Bandwidth account enabled for programmable messaging. If you are unsure, please reach out to your account manager or Bandwidth Support.
  2. You have created API credentials for use with the Bandwidth APIs. Please refer to the credentials documentation for more information.
  3. You have provisioned your account with a Sub-Account (Site), Location (Sip-Peer), and Messaging Application. If you are unfamiliar/unsure, please refer to the following documentation:
  4. You have purchased a phone number for use with Bandwidth Messaging. If you have not, please refer to the phone number purchasing documentation for more information.
  5. You have associated your number with a Campaign. For more information on Campaigns, please refer to the Campaigns documentation.
  6. You have defined a Credential Alias within your ServiceNow instance. This alias will be used to store your Bandwidth API credentials. For more information on creating a Credential Alias, please refer to the ServiceNow documentation.

Integration Steps

Create Action and Define Inputs

  1. From the Flow Designer page, click New and select Action from the drop-down menu.
  2. Now we want to add Inputs for our new action. In our case, we want to create an input for the Incident Number and to number. Click the + icon to add a new input.
    1. For the Incident Number, set the Type to String and the Name to incident_number.
    2. For the to number, set the Type to Phone Number and the Name to to_phone_number.
    3. Be sure to toggle both as Mandatory.

Configure a REST Step

Next we want to add and configure a new step. Click the plus to do so.

  1. Select REST from the list of options.
  2. The Connection field should be set to Define Connection Inline
  3. You will need a predefined Credentials Alias for authorizing request.
    1. This Credentials Alias must be Basic Auth with the Username and Password to authenticate to the Bandwidth API.
  4. Base URL should be https://messaging.bandwidth.com/api/v2
  5. Make sure Build Request is set to Manually
  6. Resource Path should be set to /users/<ACCOUNT_ID>/messages
    1. Be sure to replace <ACCOUNT_ID> with your Account ID
  7. Set the HTTP Method to POST
  8. We will need to add a Content-Type Header, and set the value to application/json

Now we need to build the REST body with the Inputs we defined earlier.

  1. Under Request Content, the type should be set to Text
  2. Your Request body should look like the following:
    {
    "applicationId": "<BW_APPLICATION_ID>",
    "to": "{{input.to_phone_number}}",
    "from": "<BW_PHONE_NUMBER>",
    "text": "An incident has been created. Please reference Incident # {{input.incident_number}}."
    }
    1. Be sure to replace <BW_APPLICATION_ID> with your Bandwidth Application ID.
    2. Be sure to replace <BW_PHONE_NUMBER> with your Bandwidth Phone Number. This is the number the SMS messages will be delivered from.
    3. You can configure the text field to your liking. This is the message that will be sent to the to number.
    4. You may need to use the magic wand to set the input values for to and text.
  3. If you have specific retry logic, under Retry Policy you can Enable Retry Policy. More information on Retry Policies can be found here.

Be sure to save your action.

Create a Trigger

With our Action created, we can set up a trigger to run the action when new incidents are created.

  1. Create a flow with a trigger. More details on creating a trigger can be found here.
  2. We want our trigger to run when an incident is created - so our trigger will be Incident Created in the search.
  1. Add an Action to the trigger - the Action we created earlier.
  2. Define the action inputs. You will need to map the Incident Number and to number to the inputs we defined earlier.
  1. Save and activate your flow.

With your flow activated, you should now be able to send SMS messages from your ServiceNow instance using Bandwidth's Messaging API.