How to Post Messages to Microsoft Teams From Alteryx

Table of contents
Partner with
Aimpoint Digital
Meet an Expert

This blog post highlights how you can post content from Alteryx into a Microsoft Teams channel.

Before we dive into the technical detail, let’s start by highlighting some use cases for this feature in an analytics data team:

  • Letting users know when an automated process, such as an Alteryx workflow, hasn’t run successfully.
  • Informing the business when a key report has been refreshed with the latest data.
  • Introducing new team members to the wider company.
  • Reminding the team that expense and time reports are due.

In this post, we will highlight an example of how we used Alteryx and Microsoft Teams to create a process to acknowledge the birthdays of employees within our organization.

Creating an Incoming Webhook in Microsoft Teams

Incoming webhooks provide us with a mechanism to allow external applications to share content into Microsoft Teams channels. What’s best about incoming webhooks is that they are extremely easy to work with; all you need is the URL of your incoming webhook and a JSON payload containing the message you wish to share. Your message is then shared via a simple POST API request from your application of choice.

Incoming webhooks are linked to specific Microsoft Teams channels, so the first thing you need to do is identify the channel to which you want your incoming webhook to share content to. Once you’ve done this, you can right-click on your channel name and select ‘Connectors.’

A configuration window will appear, allowing you to add connectors to this channel. We want to find the ‘Incoming Webhook’ connector and select ‘Add’ in this window.

Once you hit ‘Add,’ the window will close. However, we still need to configure our webhook, so we need to reopen our ‘Connectors’ for the channel to which we added the ‘Incoming Webhook’ connector to.

The ‘Incoming Webhook’ will now sit under the ‘Connectors for your team’ menu. From here, we can select the ‘Configure’ option.

In this next window, we can enter the name for our incoming webhook and select the icon that we wish to display when content is shared from this ‘user.’

When you click ‘Create,’ you will be presented with your ‘Incoming Webhook URL.’ This is the URL against which you need to make your POST request against to share your message into the Teams channel. Take note of this, but you can come back to this later if you don’t!

Creating Your JSON Message

This is where things can get more complex, but that entirely depends on what you want to include in your message. The example shown below is about as simple as it gets.

{

    “type”: “message”,

    “text”: “It’s someone’s birthday!”

}

 

//Text only

Things get more complex if you want to add media like images or if you want to @mention specific people. In such cases, we found that it’s best to use what is known as ‘adaptive cards.’ Some examples of which are shown below. Code snippets for these can be found in the downloads accompanying this blog post. 

//text with mention

//text with image/gif

//text with mention and image/gif

Posting Your Message to Teams From Alteryx

Sharing your message to Teams from an Alteryx workflow is simple. We can store our incoming webhook URL in a text input. We can then use a Formula tool to compose the JSON body of our request. Lastly, we can use the download tool to post the message. The workflow used in this example can be found in the downloads accompanying this blog post.

It’s important to note that we are making a POST request, and in our Download tool, we should therefore choose the ‘POST’ method at the top of the ‘Payload’ tab. We can also specify that our payload is stored in the ‘Body’ field we created in the formula step on this same tab.

In our sample solution, we’ve also included a Message tool to trigger an error in cases where the message was not shared with teams successfully. And there we have it; we have successfully shared a message to a Microsoft Teams channel from the Alteryx platform. Of course, the final part, where we post the message to Teams, can be done with a wide array of tools that allow communication with web servers, such as Python, Matillion, or Dataiku.

Author
Ben Gardner-Moss
Ben Gardner-Moss
Principal Analytics Consultant
Read Bio

Let’s talk data.
We’ll bring the solutions.

Whether you need advanced AI solutions, strategic data expertise, or tailored insights, our team is here to help.

Meet an Expert