Introduction

Slack integration permits users to receive ticket updates as Slack messages and to use Slack to acknowledge tickets and update ticket status and priority.

The following figure shows how to:

  • send alert notifications to Slack, which the user receives as a Slack message.
  • use Slack to create and update incidents for service desk processing. Updates are limited to Slack interactive components

The following table shows the inbound, Slack-to-OpsRamp, and outbound, OpsRamp-to-Slack, operations involved in the Slack integrations:

Slack Integration
NameScenario 1Scenario 2
DescriptionOpsRamp to Slack (Outbound)Slack to OpsRamp (Inbound)
ActionSend updates as alerts/notificationsCreate and update incidents
Workflow
OpsRamp to Slack

Update with alert or notification

Slack to OpsRamp

Create and update incident

Configure Slack

To configure Slack for integration with OpsRamp,

Using user interface of OpsRamp and Slack also you can complete Slack integration.

Create a channel

Slack channel creation is optional.

To receive event messages in a channel, create a channel and provide the channel name in the payload.

  1. Log into Slack.
  2. Hover over Channels, click the + icon, and select Create a channel to display the Create a channel dialog.
  3. Enter a channel Name, Description, and set the Make private toggle to public or private, as needed.
  4. Click Create.

Create a Slack app

Create a Slack app to receive incoming webhook and Slack interactive messages:

  1. Log into Slack, if not already logged in.
  2. Navigate to https://api.slack.com/.
  3. Click Start Building to start the Create a Slack App dialog.
  4. Enter an application name in App Name. Use the same name when you configure OpsRamp.
  5. Enter the OpsRamp workspace for Development Slack Workspace.
  6. Click Create App.

Configure the Slack app

On the Slack page, under Features, the list of features includes Incoming Webhooks and Interactive Components.

  1. Click Incoming Webhooks.
  2. Enable the Activate Incoming Webhooks option. This option must be enabled for messages from Opsramp to appear on Slack.
  3. Scroll down and click Add New Webhook to Workspace.
  4. In Where should your app post, enter your channel name, and click Allow.
  5. Copy and save the webhook URL to use as the base URL when configuring OpsRamp outbound.
  6. Click Interactive Components.
  7. Enable the Interactivity option.
  8. Click Save Changes.

Create an incoming webhook

  1. Log into Slack, if not already logged in.
  2. Hover over Apps and click the + icon to view the App directory.
  3. Scroll to the app you created.
  4. Click Incoming Webhooks to display the Incoming Webhooks dialog.
  5. Enable the Activate Incoming Webhooks option and wait until it indicates enabled.
  6. Scroll down and click Add New Webhook to Workspace.
  7. In Where should your App post, select your channel, and click Allow. This displays the webhook URL.

The following code snippet shows an example webhook payload:

{
	"channel": "demo_channel",
	"attachments": [{
		"fallback": "Incident create notification to slack",
		"color": "#3AA3E3",
		"callback_id": "$incident.id",
		"pretext": "New incident <$utils.ticketAccessURL($incident.id,$incident.client.id,$incident.msp.id,$incident.serviceProviderId)| # $incident.uniqueId> created ",
		"author_name": "By $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": true
		}, {
			"title": "Status",
			"value": "$incident.status.name",
			"short": true
		}],
		"mrkdwn_in": ["pretext"],
		"footer": "OpsRamp",
		"footer_icon": "https://www.opsramp.com/wp-content/uploads/2017/10/OpsRamp_Logo_Color200x.png"
	}, {
		"callback_id": "$incident.id",
		"fallback": "Please modify the priority using below selection",
		"title": "Please modify the priority using below selection",
		"color": "danger",
		"attachment_type": "default",
		"actions": [{
			"name": "priority_list",
			"text": "Change Priority...",
			"type": "select",
			"options": [{
					"text": "Very Low",
					"value": "Very Low"
				},
				{
					"text": "Low",
					"value": "Low"
				},
				{
					"text": "Normal",
					"value": "Normal"
				},
				{
					"text": "High",
					"value": "High"
				},
				{
					"text": "Urgent",
					"value": "Urgent"
				}
			]
		}]
	}]
}

Install and configure the Slack integration

Install the integration

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

Configure inbound operation

Select the Inbound (Slack to OpsRamp) tab.

  1. In the Authentication section, for Authentication Type, choose WEBHOOK and click Save.

    A token and Webhook URL are generated, which you can copy to use at Slack. For Webhooks, you must map Incident attributes for the properties of Status and Priority.

  2. Expand the Map Attributes section.

  3. For OpsRamp Entity, choose Incident.

  4. For OpsRamp Property, choose Assignee group name or Status.

  5. Click the + icon to add entity information in the Create Incident Mapping on … dialog.

  6. Enter the Third-Party Entity and Third-Party Property from the Slack payload.

  7. Choose the parsing condition and enter the Third-Party Property Value to map property value to the OpsRamp property Value.

  8. Expand the ITSM Properties section.

  9. Enter the OpsRamp Entity ID value found in the Slack payload and click Save. The ID is the OpsRamp Incident ID key.

  10. Click Save.

Configure outbound operation

Make sure Slack webhooks are configured before configuring outbound operation.

Event payloads

The following are the payloads to send the event message to the respective channel in Slack: Select the Outbound (OpsRamp to Slack) tab.

  1. Expand the Integration Basic Configuration section.
  2. For Notification Type, choose REST API.
  3. For Base URI, enter https://hooks.slack.com/services/T04UETBK6/B0PNKBWR1/GKQPbNkbWR1hgRulOAWYsYG
  4. For Authentication Type, choose NONE.
  5. Click Save.
  6. Expand the Integration Events section and click Add to display the Add Integration Event dialog.
  7. Enter an integration event Name.
  8. Choose the entity for which the event is triggered.
  9. Choose Parent Configuration to assign basic integration configuration information to the event.
  10. Choose the HTTP Web Method.
  11. Enter the applicable Headers property name and value. Click the + icon to add additional header properties.
  12. Enter the JSON Payload.
  13. Click Save.

To add more fields to the payload, click the field name in the Place Holders list.

Custom fields previously defined as a response payload attribute for an integration are not available for configuration in other integrations. To make a custom field available to map on the response payload of another integration, remove the existing mapping from the integration.

Verify integration

  1. Choose the event from the drop-down menu and then select the payload type.
  2. Enter the payload and click Verify. A 200- OK response is returned if integration succeeded.

To receive notifications on integration failures, do the following steps:

  1. Select the Email notification type.
  2. Enter an email address for receiving notifications.
  3. Click Save.

Event payload examples

The following example payloads show how to send an event message to the respective Slack channel.

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

Create an incident

{
	"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"
		}
	]
}

Update an incident

{
	"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"
		}
	]
}