Create a webhook to post to Microsoft Teams

Totango's webhook action in SuccessPlay allows you to call third-party APIs and push messages to 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. 

1. Create the MS Teams incoming webook

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

  1. In Microsoft Teams, go to the channel where you want messages to appear.
  2. Click ... (More options) > Connectors.
  3. Search for Incoming Webhook > Add.
  4. Give it a name like, "Totango NPS Alerts."
  5. Copy the Webhook URL. You’ll need this for Totango.

2. Set up the outbound 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, and add the custom JSON code provided.

  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 channel is not flooded with survey responses.
    mceclip0.png

  3. Enter webhook details, including:
    • Request Url: Enter the Incoming webhook URL you copied above.
    • Request type: Leave it set to POST.
    • Encoding: application/json
    • Content: Choose the Advanced option. Copy and paste the following JSON (MessageCard format):

      {
        "@type": "MessageCard",
        "@context": "https://schema.org/extensions",
        "summary": "NPS Survey Response",
        "themeColor": "0076D7",
        "title": "New NPS Response Received",
        "text": "Score: ${nps_score}\nComment: \"${nps_comment}\"\nCustomer: ${account_name}"
      }

      Where nps_score, nps_comment, and account_name are Totango tokens you insert based on the event data you want to push (i.e., user.Name of NPS survey, user.Name of NPS survey_comment, account.account_name).

      Teams is picky about JSON. If the payload isn’t exactly in MessageCard or Adaptive Card format, the post will fail silently. Totango's webhook editor supports plain JSON but doesn’t validate, so test with minimal fields first, then add more. If you want richer layouts (buttons, multiple sections, images), use Adaptive Cards and paste the JSON output into Totango's webhook body.

  4. Click Test Connection and choose a sample user. The Teams channel should show the formatted card within a few seconds.
  5. Activate the play. 

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

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request