Harnessing the power of real-time communication between Microsoft Teams and Slack

Written by Michael TolanSecurity Researcher

Published on July 24, 2023

In today’s digital landscape, the need for real-time communication has never been greater. For engineers in IT teams and service desk analysts, the ability to exchange information swiftly and effortlessly can make all the difference in resolving critical issues, brainstorming solutions, and fostering a productive work environment. 

However, there may be times when teams and stakeholders (potentially even those in the same company!) use different platforms or programs for correspondence, such as Slack and Microsoft Teams. Thankfully, you can use Tines to allow team members using different messaging platforms to still communicate in real-time. 

Read on for my solution and step-by-step guide to setting it up.

The problem with using multiple platforms 

One of the challenges of using multiple collaboration platforms is the sheer volume of notifications coming in from numerous places, which can distract and overwhelm teams. Depending on your work environment, it may be standard to use multiple services each day, which can be a drain on mental energy and potentially result in important notifications being missed. If you are a support team member, you may need to work with clients who are using a different platform than the one you use internally. If you need to constantly swap between different applications, this can cause slower response times and negatively impact your customers’ experience.

Real-time communication as a solution 

In this blog, I’ll walk us through a recently published story from our library that allows for real-time communication between channels in Microsoft Teams and Slack, two of the most popular collaboration platforms in use by IT professionals worldwide. Through the power of Tines and the ability to leverage both Microsoft Teams and Slack, teams can instantly unlock a new level of collaboration and productivity.

Chat instantly between Slack and Microsoft Teams channels using Tines

Import the following story to your tenant to use the Microsoft Graph and Slack APIs to send messages in real time across Slack and Microsoft Teams:

Loading story...

Getting the story to work 

Microsoft Teams set-up

After importing the story to your tenant, the main focus will be on creating a mapping table between the desired Microsoft Teams and Slack channels. This will be stored as a Tines resource, which we will create as part of the story. There are multiple ways to do this:

  • If you wish to only map a single Slack/Teams channel pair, you do not need to generate a Microsoft Graph credential. The ‘Get Microsoft Teams channel details’ page on the storyboard can take in a single Microsoft Teams channel link, and it will output the mapping schema for you with the Microsoft Teams channel URL already supplied. 

  • If you wish to generate the schema for multiple Microsoft Teams channels at the same time, you will need to create a Microsoft Graph OAuth credential. For more information, you can refer to this Tines blog for a full step-by-step guide. This credential can then be used in the ‘Get MS Teams Channels’ action in your story, which will create a mapping schema for all of your Microsoft Teams channels.

Once you have the schema template, you can then fill out the remaining fields in the following way:

Follow the steps in this document or our blog to create an incoming Microsoft Teams webhook. This will be defined at the Team level. This means that if you wish to set up multiple Slack/Teams channel mappings within the one Team, you only need to make a single incoming webhook. Take note of the URL that is generated, as this will go into the ‘teams_webhook_url’ part of your schema resource.

Once this is done, you can follow this document to create your outgoing webhook for your Teams channel. Take note of what you name the webhook – this will be what you use to invoke the webhook from within the Team’s channel. In the screenshot below, I’m calling it “SendToSlack” so it’s easy to remember. The ‘Callback URL’ will be the webhook URL for your ‘Receive Microsoft Teams Event’ webhook action in the Tines story.

Example configuration for your outgoing Team’s webhook

Slack set-up

We now have everything set up on the Microsoft Teams side. For Slack, things are even simpler.

We will first need to create a Slackbot to take in and emit messages for Slack. Here’s a sample Slackbot manifest that you can import directly into Slack. Note: You will need to enter the webhook URL that’s in the ‘Receive Slack Event’ action in the Tines story into the manifest before it is imported into Slack. This will be where Slack messages are taken in and forwarded to Microsoft Teams if a valid mapping is found.

Take a look at our blog, which gives more information about setting up chatbots in Slack.

We almost have our full channel mapping complete; we now just need to add the Slack channel ID to our mapping from earlier. This can be found by right-clicking on the Slack channel in the sidebar and clicking ‘View channel details’. The channel ID will be at the bottom of the pop-up window. This will go into your ‘slack_id’ part of the schema resource.

Once the bot is set up and added to your Slack workspace, you simply need to add it to the channel that you want to send messages from.

We can now put our full mapping together, which may look something like this:

{
  "mapping": [
    {
      "teams_channel_name": "Devops Github Project",
      "teams_channel_id": "19:68c25a1027d3a48e7b38b42642e197d06@thread.tacv2",
      "teams_webhook_url": 
"https://2pyzr8.webhook.office.com/webhookb2/08ba8d54--d4f6-463c-b1a6-c6407058ce60@ef29337d-42d6-42a4-843c-
aefd77d7ac01/IncomingWebhook/e692df82bd784ce5bd16c930d2828c80/823c8eec-346c-48b2-bf6c-be593167be71",
      "slack_channel_name": "ms-teams-github-project",
      "slack_id": "C05HDE9ADEC"
    }
  ]
}

We will also need to create a credential so that Tines can message back into Slack and look up user information. This can be done simply by creating a Slack credential within Tines.

We can now message between Slack and Microsoft Teams! Simply message in the Slack or Microsoft Teams channel and watch the Tines magic happen.