Skip to main content
Gainsight Inc.

Tutorial: Post Message to Slack when External Event Occurs using Real-Time Rules

Gainsight NXT

This article supports Gainsight NXT, the next evolution of the Customer Success platform. If you are using Gainsight CS Salesforce Edition, you can find supporting documentation by visiting the home page, and selecting CS > Salesforce Edition.

Not sure what your team is using? Click here.

 

This article explains how to post in Slack when an external event occurs using Gainsight data.

Introduction

Using the Call External API action type in Real-Time Rules, configure a rule to post a message in the Slack channel immediately when an urgent ticket is created in FreshdeskTM (which is an external system) for high revenue customers. For more information on the Real-Time Rules feature, refer to the Real-Time Rules article.

This tutorial has four sections:

Configure External Events

From FreshdeskTM, configure a rule using Webhook such that when a ticket status is updated to Urgent call Gainsight. For more information on how to configure external events, refer to the Events Framework article. 

To capture the ticket status update to Urgent in Events Framework:

  1. Navigate to the Administration > Events page.
  2. In the TOPICS tab, click +Create New Topic.
  3. Create a topic with the name FreshDeskTM Demo (sample). For more information, refer to the Create a Topic section in the Events Framework article.
  4. In the EVENTS tab, create an event with the name Urgent Priority under the FreshdeskTM demo topic.
  5. In the Structure section, click + Add New and add the same fields used in creating a webhook in FreshdeskTM. Refer to the video below:
  1. Select the Resolve event fields checkbox to view all the Company fields in Real-Time Rules.
  2. From the Resolve to drop-down, select Company and map the Company Name event field to the Name object field.
  3. Click Save.

EF1.png

Configure Custom Connector

You must first configure a connection with Slack. For more information on how to configure a custom connector in Gainsight, refer to the Configure Custom Connectors article.

Setup External Action

This section explains how to create an action for the external connection created in the previous section. 

To access the External Actions page:

  1. Navigate to Administration > External Actions
  2. Click Create Action. The Create Action page appears.
  3. In the Basic Information section:
    1. From the Select a Connector drop-down, select the Slack Connection created in the previous section 
    2. In the Action Name field, enter a name (Post to Slack Tutorial) for the action
    3. Enter the POST URL of the Slack Channel to which you wish to post a message. The URL shown below is for a test FreshdeskTM account and this would vary for your instance. For more about creating POST URLs in Slack refer to the Sending Messages and Sending Messages using Incoming Webhooks articles in Slack.

EA1-Tut3.png

  1. In the Payload section, enter the following API code:

{"text": "*An urgent ticket has been created for the Company:{{Company}}* \n _Subject:_ {{subject}}\n _Agent Name:_ {{Agent}}\n _Priority:_ {{priority}}\n _CSM:_ {{CSM}}, *Status:* {{Status}}"  }

The above example API code posts messages in Slack with Company Name, Subject, Agent, Priority, CSM, and Status fields.

IMPORTANT: Ensure that the fields provided in the above API are the same as in the Events Framework configuration.

  1. In the Headers Information section, by default, the Content-Type: application/JSON value is auto-populated. 
  2. In the Fields section, configure the data type for the fields created in the payload section.
  3. In the Advanced Configuration Information section, set the value to 3.
  4. Click Create.

Configure Call External API Action

This section explains how to configure a Real-Time rule to sync post a slack message when an external event occurs.

To configure the Real-Time rule:

  1. Navigate to Administration > Rules Engine > Real-Time Rules tab.
  2. Click New Rule. A new page appears, where you can view the following three tabs:
  • Details
  • Configure 
  • Actions

RTR-CreateRule.png

Details Tab

Enter the following information in the Details tab. 

  1. Rule Name: Post to Slack when External Event Occur.
  2. Select Folder: Select the folder in which you want to add this rule (or) by default, the rule is saved to the Uncategorized folder. 
  3. (Optional) Description: Provide a brief description of the rule.
  4. Click Configure to update the rule details, and navigate to the Configure tab.

Details Tab-Tut3.png

Configure Tab

To configure a Rule for high revenue customers:

  1. In the Select an Event section:

    1. From the Event Topic drop-down, select the FreshdeskTM Demo event configured in the Configure External Events section.
    2. From the Event drop-down, select Urgent Priority(1).
      Note: All the Company lookup fields are displayed since the company is resolved in Events Framework.
  2. In the Apply Filters section, drag and drop the ARR field and set the value greater than 100000.
  3. Click Actions to update the rule details, and navigate to the Actions tab.

Configure Tab-Tut3.png

Actions Tab

To create an Action:

  1. Click Create Action.
  2. Select Call External API action type. 
  3. From the Connector drop-down, select Slack.
  4. From the External API drop-down, select Post to Slack - Tutorial.
  5. In the Field Mappings section, map the following External Action Fields to Event Fields:
  • Company - Company Name
  • Subject - Subject
  • Agent - Agent Name
  • Priority - Priority
  • CSM Name - Custom Field
  • Status - Status
  1. Click Save Rule.
  2. Click Close.
  3. Turn on the Status toggle switch to execute the rule.

Actions Tab-Tut3-1.png

When an urgent ticket is created in the external system, External Framework receives an event that triggers the rule. If the rule is successful, a message is posted in the selected Slack channel.

Actions Tab-Tut3.png

  • Was this article helpful?