Body
This how-to article will help administrators to use a Workflow Web Service in TDAdmin to create a post to a StatusPage account. The user must have the Admin or App Admin permissions to create this.
Overview
This article serves as an example of adding a ticket workflow step that will post information to StatusPage. This could be used to do something like sending out details on a Problem or Major Incident that arises within an IT Department and wants to inform their audience of details pulled from the ticket.
Learn more about setting up and using web service steps.
Step 1: Get an API Key (Token) from Statuspage
- Log in to your account at https://manage.statuspage.io/login.
- In the top right, click your avatar to access the user menu.
- Click API Info.
- Click Create Key.
- Name the key and click to save it.
For more information go to the Statuspage Developer Portal.
Make sure you save your API key to a secure location.
Step 2: Get your StatusPage Page ID
- Log in to your account at https://manage.statuspage.io/login.
- In the top left corner, use the dropdown to select the page you want to post incidents to, then click Incidents on the left.
- Copy the Page ID from the URL bar. The Page ID is the alphanumeric string after /pages
- E.g., if the URL is https://manage.statuspage.io/pages/abcd1efghjk1/incidents, the Page ID is abcd1efghjk1
Step 3: Create a Web Services Provider
To create a Web Service Provider:
- Navigate to your Ticketing application in TDAdmin via Applications > [Ticketing App] > Workflow Web Services
- Select Web Service Providers
- Click +New
- Enter a Name
- For Base Web Services Provider URL, enter https://api.statuspage.io
- Check the Active box
- Click Save
Step 4: Construct the Payload
When creating or updating a StatusPage incident via web service steps, you will need to send a payload in JSON format. The format of the payload is very important. Every curly bracket, quote, and comma has to be correct or the payload won't be valid.
Here are a few example payloads:
{
"incident" : {
{
"name" : "Reports of issues with {{systemName}}",
"status" : "identified",
"body" : "We have heard multiple reports of customers having issues with {{systemName}}. Check this page for more information as we investigate."
}
}
}
{
"incident" : {
{
"status" : "investigating"
}
}
}
{
"incident" : {
{
"body" : "We have heard multiple reports of customers having issues with {{systemName}}. Check this page for more information as we investigate."
}
}
}
{
"incident" : {
{
"status" : "identified",
"body" : "We have heard multiple reports of customers having issues with {{systemName}}. Check this page for more information as we investigate."
}
}
}
{
"incident" : {
{
"status" : "resolved",
"body" : "We have completed work on the issue affecting {{systemName}} and it has been restored to its full functionality. Thank you for your patience as we resolved this matter."
}
}
}
Let's break down the payload examples:
- The name is whatever title you want this incident to have in StatusPage.
- The name is required when creating an incident, but you can omit it when updating
- The body is the longer text with full details about the incident.
- The status is the status of the incident in StatusPage.
Including Ticket Data in the Payload
You can insert information from the TeamDynamix ticket into the name or body of the incident using {{parameters}}. In our examples, we use a parameter called {{systemName}} to insert the name of the affected system into the both the name and body. Parameters can be named whatever you want and don't need to match ticket field names.
To create a parameter, wrap a parameter name (letters, numbers, and underscores only) within two sets of curly brackets. Two example parameters are {{this}} or {{this_2nd_example_parameter}}
Additional Supported Payload Fields
There are more fields other than the name, body, and status that you can add to the payload when creating or updating an incident in StatusPage. For a full list of other fields you can send, see StatusPage's API documentation:
Step 5: Create a Web Service Method
Once you have constructed the body, you can create a Web Service Method.
This guide covers two scenarios:
- Posting a new incident to StatusPage
- Updating an existing StatusPage incident
- Navigate to your Ticketing application in TDAdmin via Applications > [Ticketing App] > Workflow Web Services
- Select Web Service Methods
- Click +New
- Enter a Name, like "Create StatusPage Incident"
- For Web Service Provider, select the StatusPage Web Service Provider you created
- Change the GET dropdown to POST
- Update the URL so that it looks like https://api.statuspage.io/v1/pages/REPLACE_THIS_WITH_YOUR_PAGE_ID/incidents
Note: Make sure to replace REPLACE_THIS_WITH_YOUR_PAGE_ID with the Page ID you copied from StatusPage!
- Click on the Headers tab, then do the following:
- In the Key box, enter Authorization
- In the Value box, enter OAuth REPLACE_THIS_WITH_YOUR_API_KEY
Note: Make sure to replace REPLACE_THIS_WITH_YOUR_API_KEY with the API key you copied from StatusPage!
- Click Add
- Click on the Body tab, then paste the payload you constructed into the text area
- Click on the Parameters tab, then do the following:
- For every {{parameter}} included in your payload, you will need to repeat these steps.
- In the Name box, enter what's between the curly brackets for the parameter. E.g., if you are using the {{systemName}} parameter, enter systemName
- The text must match exactly what's in the curly brackets, case sensitive
- Leave the dropdown set to String
- Leave the dropdown set to From Ticket
- Use the last dropdown to select the ticket data you want to replace the parameter in the payload
- You can select any standard or custom attribute.
- E.g., if you are using the {{systemName}} parameter in the name or body, you may want to replace it with the Service on the ticket or the value of a specific custom attribute
- Click +Add
- Repeat these steps for every other {{parameter}} you have in the payload.
- You only need to do these steps once per parameter, even if the same parameter is used more than once.
- Click Save
Note: This guide assumes that you have a ticket attribute ID that is used to store the StatusPage incident ID, and that the StatusPage incident ID is stored on the ticket in this attribute. Make sure you create the ticket attribute before proceeding so you can select it on step 11.
- Navigate to your Ticketing application in TDAdmin via Applications > [Ticketing App] > Workflow Web Services
- Select Web Service Methods
- Click +New
- Enter a Name, like "Mark StatusPage Incident as Investigating" or "Close StatusPage Incident"
- For Web Service Provider, select the StatusPage Web Service Provider you created
- Check the Active box
- Change the GET dropdown to PATCH
- Update the URL so that it looks like https://api.statuspage.io/v1/pages/REPLACE_THIS_WITH_YOUR_PAGE_ID/incidents/{incidentID}
Note: Make sure to replace REPLACE_THIS_WITH_YOUR_PAGE_ID with the Page ID you copied from StatusPage!
- Click on the Headers tab, then do the following:
- In the Key box, enter Authorization
- In the Value box, enter OAuth REPLACE_THIS_WITH_YOUR_API_KEY
Note: Make sure to replace REPLACE_THIS_WITH_YOUR_API_KEY with the API key you copied from StatusPage!
- Click Add
- Click on the Body tab, then paste the payload you constructed into the text area
- Click on the Parameters tab, do the following:
- In the Name box, enter incidentID
- Leave the dropdown set to String
- Leave the dropdown set to From Ticket
- Use the last dropdown to select the custom attribute that stores the StatusPage incident ID
- Click +Add
- Still on the Parameters tab, now do the following:
- For every {{parameter}} included in your payload, you will need to repeat these steps.
- In the Name box, enter what's between the curly brackets for the parameter. E.g., if you are using the {{systemName}} parameter, enter systemName
- The text must match exactly what's in the curly brackets, case sensitive
- Leave the dropdown set to String
- Leave the dropdown set to From Ticket
- Use the last dropdown to select the ticket data you want to replace the parameter in the payload
- You can select any standard or custom attribute.
- E.g., if you are using the {{systemName}} parameter in the name or body, you may want to replace it with the Service on the ticket or the value of a specific custom attribute
- Click +Add
- Repeat these steps for every other {{parameter}} you have in the payload.
- You only need to do these steps once per parameter, even if the same parameter is used more than once.
- Click Save