Create a webhook to post messages to Slack

Who can use this feature?

  • Global admins, SuccessBLOC owners, and collaborators
  • Users have view access to SuccessBLOCs that are published to a team; additional access permissions to individual SuccessPlays, campaigns, canvas, and objective templates vary.
  • Available on all plans

Totango's webhook action in SuccessPlay allows you to call third-party APIs and push messages to Slack and other systems near real time.

Suggested uses

The example used in this article is for posting NPS survey responses. You may also have other scenarios, such as "Digital Hurrays" program to broadcast internally every major milestone your customers complete. Here are a few images for you to use with ❤️ from our designer:

Promoter mceclip0.png
Detractor mceclip1.png
Passive mceclip2.png
Celebration mceclip3.png
Warning mceclip4.png
User mceclip5.png

 

1. Create an incoming webhook app in Slack

The first step is to generate an incoming webhook URL in Slack that you can use later. If you already have an incoming webhook you may use that.

Expand steps

  1. Go to https://api.slack.com/apps and click Create a new Slack App.mceclip0.png
  2. Provide an App Name and choose the right workspace.mceclip2.png
  3. Once created, go to Incoming Webhooks.mceclip3.png
  4. Turn on Activate Incoming Webhooks and also click Add New Webhook to Workspace.mceclip4.png
  5. Choose a Slack channel to post the survey responses to.mceclip5.png
  6. Copy the Webhook URL.mceclip6.png

2. Set up the webhook in Totango

Create a new SuccessPlay in the SuccessBLOC that is running your NPS survey. Add a "call a webhook" action that uses the incoming webhook URL from your Slack workspace, and add the custom JSON code provided.

Expand steps

  1. Create a new SuccessPlay that uses a user segment: 
    mceclip0.png
  2. Add a Call a webhook action.

    Uncheck the "Trigger actions for users that currently meet the defined criteria" so your Slack channel is not flooded with survey responses.
    mceclip0.png

  3. Enter webhook details, including:
    • Request Url: Enter the Incoming webhook URL you copied above.
    • Content: Choose the Advanced option. Copy and paste the following JSON for the message to post in Slack.

      The message uses Slack's Block Kit format. Dynamic attributes are wrapped in the {{}} format. Account attributes are written in {{account.attribute api name}}, and user attributes are written in {{user. attribute api name}}. Use the "Add data" link at the bottom right of the text area to insert account or user attributes.

      {
      "type":"home",
      "blocks":[
      {
      "type":"header",
      "text":{
      "type":"plain_text",
      "text":"Account - {{account.account_name}}"
      }
      },
      {
      "type":"divider"
      },
      {
      "type":"context",
      "elements":[
      {
      "type":"image",
      "image_url":"https://uploads-ssl.webflow.com/5abc6c4b0a243a475139ee3b/604794d2481099ddcc3d362e_webhook-user.png",
      "alt_text":"{{user.First Name}}"
      },
      {
      "type":"mrkdwn",
      "text":"*<https:YOURURL/#/users/{{user.User Id}}|{{user.First Name}} {{user.Last Name}}>*"
      },
      {
      "type":"mrkdwn",
      "text":"responded to NPS Survey"
      }
      ]
      },
      {
      "type":"section",
      "text":{
      "type":"mrkdwn",
      "text":"NPS Score: *{{user.Relationship NPS}}*\nSurvey Response Date: *{{user.Relationship NPS_response_date}}*\nNPS Comment: *{{user.Relationship NPS_comment}}*"
      },
      "accessory":{
      "type":"image",
      "image_url":"https://uploads-ssl.webflow.com/5abc6c4b0a243a475139ee3b/604794d2596186bcd75ebd30_webhook-detractor.png",
      "alt_text":"Detractor"
      }
      }
      ]
      }

      Within the JSON, replace YOURURL with information form your Totango URL: everything after https: and before /#/. See the highlighted portion of the image below for an example:
      unnamed.png

      If you're leveraging Totango In-App, you may also reference the following user in-app filters to print the NPS score and comment from an NPS survey delivered in-app:
      {{user.lou_[experience_id]_nps_score_response}}
      {{user.lou_[experience_id]_nps_feedback_response}}


      Replace [experience_id] with the workflow ID of the experience (e.g., 312279425515)

    • Click Test Connection and choose a sample user. At this point, you should see a test post in the Slack channel. 
    • Activate the play. 

NPS responses should start getting posted to the designated channel once the play is active.

Was this article helpful?

1 out of 1 found this helpful

Have more questions? Submit a request