Introduction

Slack is a workplace communication tool (a single place for messaging, tools and files)
Slack supports Webhooks to receive events from the third party.

OpsRamp configuration

Configuration involves:

  1. Installing the integration.
  2. Configuring the integration.

Step 1: Install the integration

To install:

  1. From All Clients, select a client.
  2. Go to Setup > Integrations > Integrations.
  3. From Available Integrations, select Collaboration > Slack.
  4. Click Install.

Step 2: Configure the integration

Configure the following: - Inbound - As this is a one-way integration, only outbound is required. - Outbound - Monitoring of Integration - Audit Logs

Outbound

Outbound configuration sends ticket updates as messages from OpsRamp to Slack.

Prerequisite: Prior to configuring outbound integration, configure Webhooks in Slack.

To send entities from OpsRamp to Slack:

  1. In Integration Basic Configuration, configure basic notification details to trigger integration events.
    1. Notification type: REST API
    2. Base URI: https://hooks.slack.com/services/T04UETBK6/B0PNKBWR1/GKQPbNkbWR1hgRulOAWYsYG
    3. Authentication type: NONE
    4. Click Save.
  2. In Map Attributes, mapping of attributes is not required since the integration is a one-way integration and the messages are only ticket updates from OpsRamp .
  3. In Integration Events, add an integration event. 
    An action performed on OpsRamp entity is defined as an event. When an event is triggered, notifications are sent to the respective user.
    • Click AddAdd Integration Event page appears.
    • Provide a name for integration event.
    • Select the entity for which the event is triggered.
    • Select Parent Configuration to assign basic integration configuration details to the event.
    • Select the web method and provide the headers name and value.
    • Provide the payload for the respective action and then click Save.
      • To add additional fields to the payload, click on the field in the Place Holders list.
      • A custom field that is already configured as response payload attribute for a given integration is not available for configuration in any other integrations. You need to remove the existing mapping from the integration to make the custom field available to map on response payload of any other integration.
        Add Integration Event

        Add Integration Event

  4. Verify Integration: Validate if the integration is successful.
    1. Select the event from the drop-down and then select the payload type.
    2. Provide the payload and then click Verify. A 200- OK success response is generated if the integration is successful.
  5. Integration Failures: In the case of failure in integration, a message is sent to the user about the failure in integration.
    1. Select notification type Email.
    2. Provide the email address.
    3. Click Save.

Slack configuration

Configuring involves posting OpsRamp event messages to a Slack channel by:

  1. Creating a channel.
  2. Creating incoming Webhooks.

Step 1: Create a channel (optional)

To receive event messages in a channel, create a channel and provide the channel name in the payload. This is an optional step.

  1. Log into Slack.
  2. Click the + expand button. Create a Channel page appears.
  3. Provide Name for the channel, Purpose for the creation of a channel and Invites for the channel group and then click Create New Channel.

Step 2: Create incoming Webhooks

  1. Log into Slack.
  2. On the left-hand side panel, click the username drop-down and then go to Apps > Integrations.
  3. On the App Directory page, select Build > Make a Custom integration.
  4. On the Build a Custom Integration page, click Incoming Webhooks to send OpsRamp events to Slack.
  5. Select the channel from the drop-down and click Add Incoming webhooks Integration.
  6. Copy the Webhook URL and configure the URL in OpsRamp.
  7. Provide the Description for the Webhook and provide the Name and Logo for the integration.
  8. Click Save Settings to save the configured values.

Event payloads

The following are the payloads to send the event message to the respective channel in Slack.

Field Values
FieldsValues
Endpoint URLhttps://hooks.slack.com/services/T04UETBK6/B0PNKBWR1/GKQPbNkbWR1hgRulOAWYsYG
HeadersContent-Type: application/json

Incident created

{
	"channel" : "#OpsRamp_incidents",
	"attachments" : [
		{
			"fallback" : "Required plain-text summary of the attachment.",
			"color" : "danger",
			"pretext" : "*New* incident <$esc.java($utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId))| # $esc.java($incident.uniqueId)> created ",
			"author_name" : "By $esc.java($incident.createdBy.getFullName())",
			"title" : "$incident.subject",
			"title_link" : "$utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId)",
			"text" : "$incident.impact",
			"fields" : [
				{
					"title" : "Priority",
					"value" : "$incident.priority.name",
					"short" : false
				}
			],
			"mrkdwn_in" : [
				"pretext"
			],
			"footer" : "OpsRamp",
			"footer_icon" : "https://www.opsramp.com/wp-content/themes/twentythirteen/images/OpsRamp-Logo-300x300.png"
		}
	]
}

Incident updated

{
	"channel" : "#OpsRamp_incidents",
	"attachments" : [
		{
			"fallback" : "Required plain-text summary of the attachment.",
			"color" : "danger",
			"pretext" : "*New* incident <$esc.java($utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId))| # $esc.java($incident.uniqueId)> created ",
			"author_name" : "By $esc.java($incident.createdBy.getFullName())",
			"title" : "$incident.subject",
			"title_link" : "$utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId)",
			"text" : "$incident.impact",
			"fields" : [
				{
					"title" : "Priority",
					"value" : "$incident.priority.name",
					"short" : false
				}
			],
			"mrkdwn_in" : [
				"pretext"
			],
			"footer" : "OpsRamp",
			"footer_icon" : "https://www.opsramp.com/wp-content/themes/twentythirteen/images/OpsRamp-Logo-300x300.png"
		}
	]
}

Response added

{
	"channel" : "#OpsRamp_incidents",
	"attachments" : [
		{
			"fallback" : "Required plain-text summary of the attachment.",
			"color" : "warning",
			"pretext" : "New response added to incident <$esc.java($utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId))| # $esc.java($incident.uniqueId)>",
			"author_name" : "By $esc.java($incident.latestResponse.creator.getFullName())",
			"title" : "$incident.subject",
			"title_link" : "$utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId)",
			"text" : "$incident.latestResponse.description",
			"fields" : [
				{
					"title" : "Priority",
					"value" : "$incident.priority.name",
					"short" : false
				}
			],
			"footer" : "OpsRamp",
			"footer_icon" : "https://www.opsramp.com/wp-content/themes/twentythirteen/images/OpsRamp-Logo-300x300.png"
		}
	]
}

Incident resolved

{
	"channel" : "#OpsRamp_incidents",
	"attachments" : [
		{
			"fallback" : "Required plain-text summary of the attachment.",
			"color" : "#7CD197",
			"pretext" : "Incident <$esc.java($utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId))| # $esc.java($incident.uniqueId)> marked asResolved",
			"author_name" : "By $esc.java($incident.statusUpdatedBy.getFullName())",
			"title" : "$incident.subject",
			"title_link" : "$utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId)",
			"mrkdwn_in" : [
				"pretext"
			],
			"footer" : "OpsRamp",
			"footer_icon" : "https://www.opsramp.com/wp-content/themes/twentythirteen/images/OpsRamp-Logo-300x300.png"
		}
	]
}

Incident closed

{
	"channel" : "#OpsRamp_incidents",
	"attachments" : [
		{
			"fallback" : "Required plain-text summary of the attachment.",
			"color" : "good",
			"pretext" : "Incident <$esc.java($utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId))| # $esc.java($incident.uniqueId)> marked asClosed",
			"author_name" : "By $esc.java($incident.statusUpdatedBy.getFullName())",
			"title" : "$incident.subject",
			"title_link" : "$utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId)",
			"mrkdwn_in" : [
				"pretext"
			],
			"footer" : "OpsRamp",
			"footer_icon" : "https://www.opsramp.com/wp-content/themes/twentythirteen/images/OpsRamp-Logo-300x300.png"
		}
	]
}