To send alert notifications to a REST API such as ServiceNow, create an alert group using a custom script.
There are several custom scripts available for interacting with a REST API. To use a custom script, in the Address Type dropdown, select Script, and in the Custom Script file field, enter the script followed by the required variables.
- (HTTP GET) url_executor.cs “http://www.example.com/url_to_call”
- (HTTP GET with basic authentication) url_executor_pwd.cs “http://www.example.com_url_to_call” “Username” “Password”
- (HTTP POST with the contents of custom 123456_Template_ID) Url_PostExecutor.cs “http://www.example.com_url_to_call” “123456_Template_ID” “Username” “Password” “Additional_Headers_Such_As\nAccept:application/json\nContent-Type:application/json”
(The Url_PostExecutor.cs script accepts a maximum number of 5 variables, so if you require multiple headers, you should include them in a list seperated by \n as shown above)
When using the Url_PostExecutor.cs script to post specific variables to a site you will also need to create a custom template to include the necessary variables. Navigate to Configure, Alerts, Templates and select the option to create a new template.
You will select the Device type on the right to display a list of available variables.
Then in the Error Source field, you will place the variables by clicking in the source window where you want the variable and then clicking the plus sign next to the variable name.
To create a properly formatted REST API call to your ServiceNow Account, check out the ServiceNow Documentation at https://express.servicenow.com/support/documentation/c_restapiexplorer/ to find out the proper url and format required to send the data.