Send the metric results to a Slack channel

Published August 16, 2022
Modules
Difficulty

You can integrate Synerise with Slack using a dedicated node to build a variety of business scenarios. One of them is building a workflow that sends messages to a Slack channel based on metrics, expressions, reports or any other analyses created in Synerise.

This particular use case reuses a metric (which is a part of an analytical dashboard) that counts the number of customers who signed up for the video call the day before. The message to the channel contains information with the value of the metric.

Screenshot presenting personalized search on a website with no results
Slack integration

Prerequisites


Note: In this use case, we track data from the form that enables to sign up for the video call using SDK form tracking method. This method generates a form.submit event which we will later used in the metric. Learn more about other ways to implement events using web SDK, mobile SDK or API.

Process


  1. Create a metric in Synerise.
  2. Create a workflow in Synerise.

Create a metric in Synerise


In this step, we will create a metric whose result will be later sent in the Slack message. The configuration is exemplary, it may vary depending on your implementation of events.

  1. In Synerise, go to Analytics icon Analytics > Metrics > New metric.
  2. Leave the metric kind at default (Simple).
  3. Leave the metric type at default (Event)
  4. From the Choose event dropdown list, select the form.submit event.
  5. As the event parameter, select the formType.
  6. As a logical operator, select Equal (String).
  7. In the text field, enter videocall.
Configuration of the metric that calculates the number of sign-ups for a video call the day before
Configuration of the metric that calculates the number of sign-ups for a video call the day before
Note: In this use case, the metric is included in the analytical dashboard which is later linked in the alert message in Slack.

Create a workflow in Synerise


In this part of the process, you will create a workflow that sends a message to a Slack channel with the number of customers who signed up for a video call. The message will contain the metric result and the link to the analytical dashboard that contains the metric.

  1. In Synerise, go to Automation > Workflows > New workflow.
  2. Start with the Scheduled Run node. In the configuration of the node:
    1. Set the Run trigger option to all time.
    2. Select the Everyday tab.
    3. Select the time zone.
    4. Select the time when the workflow will be launched.
    5. Confirm by clicking Apply.
    Configuration of the workflow that sends alert messages with the metric results to the Slack channel
    Configuration of the workflow that sends alert messages with the metric results to the Slack channel

Configure Slack Integration node

In this step, you will configure the settings of the outgoing integration that sends the message to a Slack channel.

Create a connection

  1. On the Scheduled Run node, click THEN.
  2. From the dropdown list, select Slack > Send Channel Message.
  3. In the configuration of the node:
    • If you already create a connection, select the connection from the list.
    • If you haven’t created any connection yet:
      1. At the bottom of the dropdown list, click Add connection.
      2. In the Incoming Webhook URL field, enter the incoming webhook URL you created as a part of prerequisites.
      3. Click Next.
      4. In the Connection name field, enter the name for the connection you created.
      5. Click Apply.
        Result: A connection is created and selected.

Define the integration parameters

  1. In the Type of message field, choose interactive message (JSON).

  2. Below add JSON body of message which should be sent to Slack channel.

        {
    	"blocks": [
    		{
    			"type": "section",
    			"text": {
    				"type": "mrkdwn",
    				"text": "Number of people signed in for the videocall: `{% metricsvar metric_id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX %}{{ metric_result }}{% endmetricsvar %}`\nNumber of people having the videocall today: `{% metricsvar metric_id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX %}{{ metric_result }}{% endmetricsvar %}`"
    			},
    			"accessory": {
    				"type": "button",
    				"text": {
    					"type": "plain_text",
    					"text": "check dashboard",
    					"emoji": true
    				},
    				"url": "https://app.synerise.com/spa/modules/dashboards/analytics/dashboards/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    			}
    		}
    	]
        }
            

In the JSON body:

  • Insert the ID of the metric you created in the previous step.
  • Optionally, if you want to refer users to the analytical dashboard, for the url parameter, insert the link to the dashboard. If you choose not to, remove the accessory object from the JSON body.
  1. Confirm by clicking Apply.

  2. Add the End node.

  3. Launch the workflow by clicking Save&Run.

    Configuration of the workflow that sends alert messages based on the metric results to the Slack channel
    Configuration of the workflow that sends alert messages based on the metric results to the Slack channel

Result: The message is sent to the Slack channel.

Message on the Slack channel
Message on the Slack channel

Check the use case set up on the Synerise Demo workspace


You can check the configuration of use case in Synerise Demo workspace:

If you don’t have access to the Synerise Demo workspace, please leave your contact details in this form, and our representative will contact you shortly.

Read more


😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker