BMC Helix RemedyForce (API)
  • 08 Jun 2023
  • 5 Minutes to read
  • Dark
    Light
  • PDF

BMC Helix RemedyForce (API)

  • Dark
    Light
  • PDF

Article Summary

AlertOps and RemedyForce

AlertOps’ alert management system can be integrated with RemedyForce Incidents to receive and respond to all (predefined status mappings) case alerts through email, SMS, push notification or phone alerts. AlertOps would ensure that the alert/case status would reach the appropriate team by using proper workflows, escalation policies and schedules. Based on your ruleset, incidents can be automatically opened and closed, depending on whether RemedyForce reports an opening, update or close of a case.

The above scenario and scope for integration is due to the fact that AlertOps has a very flexible and simple API/Webhook configuration feature that can be leveraged with RemedyForce 's remote trigger capabilities.


AlertOps - Inbound Integration

We can define some rulesets in AlertOps so that RemedyForce can send out case alerts to the AlertOps platform. AlertOps would ensure based on these notifications received, that it would always reach out and assign to the correct person/team by utilizing its escalation policies, schedules, and workflow features.

AlertOps provides Inbound Integrations to integrate with numerous monitoring, chat and ITSM tools. You can configure an inbound integration for RemedyForce Incidents.

At a high level this is how the flow looks like, you define an API integration in the AlertOps platform by defining settings like Integration Name, Escalation rules, recipient users/groups. Once an integration is defined, a unique API URL is generated. This acts as webhook or the gateway through which notifications from RemedyForce reach AlertOps and thus an incident/alert is created correspondingly. The API can be defined with various settings like URL mappings, filters, escalations etc. as required. RemedyForce has to be defined with an Apex Class and Apex Trigger to send out case alerts.

 


Configure Inbound Integration in AlertOps 

  1. Under 'Configuration' select 'Integrations'. From the Inbound Integration section, select 'API' from the dropdown and then click the 'Add API' button.
  2. Select BMC Helix RemedyForce from the list of available integration options.
  3. Once you select the integration, you can then specify basic settings like the integration name, escalation policy, names of the recipients/groups for which the alerts must be assigned to.
  4. Once you click save, the API Integration will be created, and you will be given a unique URL which acts as the access point and needs to be configured at the source (in this case RemedyForce), to send alerts. You can find the integration you just created, and you can give advanced settings and define various configurations for the alerts to be received and processed. For example, you can define when to open and close alerts based on the payload obtained from the API call, filters etc.
  5. Make a note of the API URL, which will be used in RemedyForce Apex Class/Trigger, so it calls a HTTP POST request to this URL with the body in JSON format containing the alert specific information. AlertOps automatically creates an alert when the status variable (statusid) contains 'OPENED'. The incident will also be closed automatically when the status 'RESOLVED/CLOSED/COMPLETED/COMPLETED/NO CONTACT' is received from RemedyForce. (and updated when 'PENDING/IN PROGRESS' is received)
  6. You can similarly define URL mappings as you want, owing to the flexibility provided by AlertOps’ OpenAPI/Plug-and-Play integrations. You can provide other filters and match with regex expressions as well. You can also test the generated URL with sample data.


Configure Integration in RemedyForce 

  1. In your RemedyForce Helix instance portal, select the settings icon in the top right corner and select 'Developer Console'.
  2. A new developer console window opens up. Go to 'File' -> 'New' -> select 'Apex Class'. Give the name 'alertopsIntegrationCall' and paste the following,
global class alertopsIntegrationCall {
  @future(callout=true)
    // OUTBOUND HTTP POST REQUEST METHOD
   webservice static void outboundCallToAO(String endpoint, String payload){
    HttpRequest req = new HttpRequest();
    req.setEndpoint(endpoint);
    req.setMethod('POST');
    req.setBody(payload);
    req.setHeader( 'Content-Type', 'application/json' );
    Http http = new Http();
    HTTPResponse res = http.send(req);
    System.debug(' Response: ' + res.getBody());
  }
  
  // GLOBAL METHODS TO HANDLE NULL VALUES FOR DIFFERENT TYPES - EMPTY VALUES IN ALERTOPS WILL BE INGESTED AS null
  global static string handleNull(String value){
  return value==null?null:'"'+value.replaceAll('[^a-zA-Z0-9\\s]', '').replaceAll('\\s+', ' ')+'"';
  }
  global static string handleNull(DateTime value){
  return value==null?null:'"'+value+'"';
  }
  global static string handleNull(Decimal value){
  return value==null?null:'"'+value+'"';
  }
  global static string handleNull(Boolean value){
  return value==null?null:'"'+value+'"';
  }
}

 3. Save it, again go to File -> "New" -> "Apex Trigger". Give the name "alertopsTriggerClass" and paste the following. In the 'endpoint' string replace it with your inbound integration API URL from AlertOps

trigger alertopsTriggerClass on BMCServiceDesk__Incident__c (after insert, after update) {
  // ENDPOINT - MAKE SURE YOU USE THE INBOUND INTEGRATION URL FROM ALERTOPS HERE   
  string endpoint = '<Inbound integration API URL from AlertOps>';
  BMCServiceDesk__Incident__c  obj = Trigger.new[0];
    
    //PAYLOAD FORMATTED, YOU CAN ADD/REMOVE/EDIT HOWEVER NEEDED, SPECIFICALLY HAS ALL VARIABLES, DO NOT REMOVE REQUIRED FIELDS
      string id=obj.Id;
    string ownerid=obj.OwnerId;
    string name=obj.Name;
    Datetime createddate=obj.CreatedDate;
    string categoryid=obj.BMCServiceDesk__Category_ID__c;
    string clientname=obj.BMCServiceDesk__Client_Name__c;
    string impactid=obj.BMCServiceDesk__Impact_Id__c;
    string priorityid=obj.BMCServiceDesk__Priority_ID__c;
    Datetime statuschangeDate=obj.BMCServiceDesk__StatusChangeDate__c;
    string statusid=obj.BMCServiceDesk__Status_ID__c;
    string urgencyid=obj.BMCServiceDesk__Urgency_ID__c;
    string incidentdescription=obj.BMCServiceDesk__incidentDescription__c;
    string incidentresolution=obj.BMCServiceDesk__incidentResolution__c;
    string severity=obj.BMCServiceDesk__ACSeverity__c;
    string incidenttype=obj.BMCServiceDesk__IncidentType__c;
    string shortdescription=obj.BMCServiceDesk__shortDescription__c;
    

    //FORMATING PAYLOAD TO A JSON FORMAT
   string payload= '{'+
'\"id\" :' + alertopsIntegrationCall.handleNull(id)+ ',' +
'\"ownerId\" :' + alertopsIntegrationCall.handleNull(ownerId )+ ',' +
'\"name\" :' + alertopsIntegrationCall.handleNull(name)+ ',' +
'\"createddate\" :' + alertopsIntegrationCall.handleNull(createddate)+ ',' +
'\"categoryid\" :' + alertopsIntegrationCall.handleNull(categoryid)+ ',' +
'\"clientname\" :' + alertopsIntegrationCall.handleNull(clientname)+ ',' +
'\"priorityid\" :' + alertopsIntegrationCall.handleNull(priorityid)+ ',' +
'\"impactid\" :' + alertopsIntegrationCall.handleNull(impactid)+ ',' +
'\"urgencyid\" :' + alertopsIntegrationCall.handleNull(urgencyid)+ ',' +
'\"statusid\" :' + alertopsIntegrationCall.handleNull(statusid)+ ',' +
'\"statuschangeDate\" :' + alertopsIntegrationCall.handleNull(statuschangeDate)+ ',' +
'\"incidentdescription\" :' + alertopsIntegrationCall.handleNull(incidentdescription)+ ',' +
'\"incidentresolution\" :' + alertopsIntegrationCall.handleNull(incidentresolution)+ ',' +
'\"severity\" :' + alertopsIntegrationCall.handleNull(severity)+ ',' +
'\"incidenttype\" :' + alertopsIntegrationCall.handleNull(incidenttype)+ ',' +
'\"shortdescription\" :' + alertopsIntegrationCall.handleNull(shortdescription)+
'}';

  // CALL THE ALERTOPS INTEGRATION APEX CLASS FILE
  alertopsIntegrationCall.outboundCallToAO(endpoint ,payload);


}

6. Save !

Go to Setup -> Security -> Remote Site Settings. Make sure you add the AlertOps API endpoint URL (https://notify.alertops.com/) as a remote site.


Thats it! You have configured an integration, Apex Class, Apex Trigger. Any trigger event/status change event would now send an alert to AlertOps for incident management. 

Message logs, alert specific information can be viewed in the “Inbound Log” section in AlertOps Dashboard. Alerts can be viewed in the ‘Alerts’ tab as well.


Alert Triggering Information:

AlertOps will automatically create an incident when a new alert is received from RemedyForce when the statusid field contains "OPENED".

If an alert with status "OPENED" matches an existing Open Alert, AlertOps will recognize the new alert as a duplicate and ignore the alert.

The alert will be recorded in the Inbound Messages table as “Mapped Appended.”

AlertOps will automatically close the same incident when an alert with statusid contains "RESOLVED/CLOSED/COMPLETED/RESOLVED/NO CONTACT"

 

References

AlertOps Integration Guides

General Restful API Guide

RemedyForce Helix Docs


Was this article helpful?

What's Next
ESC

Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses