Convert Slack integrations for Microsoft Teams
Slack is dead, long live Slack. With Microsoft swooping in with its Slack-clone, Teams, and making it included with Office 365 licenses, it seems that the writing is on the wall for the once-king of workplace messaging. Now the question is not will we, but how will we rebuild all our Slack integrations in Teams? (and, of lesser importance, what is the verb form of Teams? If I “Slack’d” you yesterday, do I “Teams” you tomorrow? That sounds weird. A topic for another article, maybe.)
Long Live the Incoming Webhook
Lots of our integrations into Slack are just publishing data to a channel when an event occurs, like an automated build completed or a PR opened. And lucky for us, Microsoft has included incoming webhooks as part of Teams already. We just need a few tweaks to make our old Slack webhooks work in Teams.
Microsoft has a handy document on the payload for the webhook which is plenty to get you started. But if, like us, you’re publishing build notes from a gradle build script, you’ll need a few simple tweaks to get it sorted out.
Starting with the payload and curl commands from that document, it’s a pretty short trip to composing a gradle task to do this for you as part of your build process:
So, first, this is a pretty brute force solution, hardcoding the payload as a string and then curl’ing it to Teams, but it also illustrates the structure of the payload. One other bonus I’ve thrown in is the OpenUri Action type, which they don’t really explain how to use. The OpenUri action is great for creating a card action that just opens a browser.
In the end, this is what you’re left with
And that’s really all there is to it.
Like it or not, Microsoft Teams is probably coming your way soon, so start thinking now about how to get the most out of it. Converting your incoming webhooks from Slack to Teams is an easy way to get started, and ensure your Team makes a smooth transition.