Note: this is beta functionality and may still need refinement. Any and all feedback welcome!

Using the "REST Messages" functionality in ServiceNow, you can automate the creation of ServiceNow activity records in Status Hero.

Activities in Status Hero will appear alongside check-ins and in your team's activity stream.

The first step in ServiceNow is to set up a REST Message:

  1. Navigate to System Web Services › Outbound › REST Messages in your ServiceNow instance.
  2. Click “New” to create a new REST Message. Type Status Hero  for the "Name". Use the ${endpoint}  for the "Endpoint" value. The "Authentication type" should be "No Authentication".  
  3. Click "Submit", then select "Status Hero" from the resulting list. 
  4. Under "HTTP Methods", you'll see a "Default GET" method. Click to edit. 
  5. Change the "Name" from "Default GET" to Activity POST , and change the "HTTP method" to POST 
  6. Create three HTTP Headers for the REST message under the "HTTP Request" tab. The first is X-TEAM-ID, and the second is X-API-KEY. Use the values from your team API settings and save them. For the third, set Content-Type  to application/json
  7. Under "HTTP Query Parameters", change the "Content" field to ${payload} 
  8. Click "Submit" or "Update" 
  9. To test the endpoint, substitute https://service.statushero.com/api/v1/status_activities  for the endpoint  value, and {"email": "<your email in Status Hero>", "source": "ServiceNow", "description": "Test update from Service Now"}  for the payload  value. Use "Escape XML" for the Escape type for both. Click the "Test" link under "Related Links" 


The REST Message is now ready to go. Let's get it send the right information to Status Hero:

  1. Navigate to System Definition › Script Includes in your ServiceNow instance.
  2. Click “New”. Name the Script Include “StatusHeroMessage”. Give it a description if you want. Copy and paste the script below.
  3. Click “Submit”.

Script:

var StatusHeroMessage = Class.create();
 
StatusHeroMessage.prototype = {
    'initialize': function() {
    },
     
    'send': function () {
        // Encode the payload as JSON
        var SNJSON = JSON;
        var myjson = new SNJSON();
        var encoded_payload = myjson.encode(this.payload);
         
        // Create and send the REST Message
        var msg = new RESTMessage('StatusHero', this.method);
        msg.setStringParameter('endpoint', this.endpoint);
        msg.setXMLParameter('payload', encoded_payload);
        var res = msg.execute();
        return res;
    },
     
    'endpoint': 'https://service.statushero.com/api/v1/status_activities',
    'method': 'post',
    'payload': {
        'email': 'Email address or full name', // Replace with the email or full name of person performing the activity. Must match what's in Status Hero.
        'source': 'ServiceNow',
        'description': 'Activity update' // Replace with the activity performed, e.g. Updated ticket 1727
    },
     
    'type': 'StatusHeroMessage'
};

Now you can send a message to Status Hero using this Script Include. In an advanced Business Rule (with conditions specified however you like), call the send()  method on a new StatusHeroMessage  object:

// Initialize a new StatusHeroMessage
var status_hero_msg = new StatusHeroMessage();
 
// Setup the payload
status_hero_msg.payload.description = 'Updated an incident to ' + current.assignment_group.name;
status_hero_msg.payload.email = current.assigned_to.email;
 
// Send the message
status_hero_msg.send()

Troubleshooting

  • Look for updates in the activity stream first. The dashboard will sum up updates from the previous period. (The check-ins essentially say "here's what I did yesterday, and here is all of the ServiceNow activity to go along with that.)
  • Check to make sure the email address that is being used in ServiceNow matches the email address that is being used in Status Hero. If you or a team member is using a different email address in ServiceNow, set the secondary email address in Status Hero to match the one used in ServiceNow.
  • Status Hero won't be able to record data retroactively. Make sure you generate some activity in ServiceNow in order to test things out after you've set up the connection.

Did this answer your question?