Pages Menu

Posted by on Nov 7, 2016 in Development, Everything Else, Skype for Business® (Lync®)

Posting messages to Microsoft Teams from IFTTT, PowerShell and beyond!

Posting messages to Microsoft Teams from IFTTT, PowerShell and beyond!

Edit: I found out after posting this that Michael Greene actually wrote a very similar post on this a few days ago, so you should definitely go and read his post too, especially as he has some additional information about posting cards as well as just IMs.

Microsoft Teams has been out for a little while now. I’ve already blogged about the developer opportunities that exist today, but it turns out that there’s a really cool, single integration method for posting messages into Teams.

Imagine if you could post to a team, just by calling a web URL?

That would mean that you can integrate it with IFTTT, or use it with anything that can post to a URL, like monitoring tools. Or build it into PowerShell scripts to notify a Team when something happens.

Why is this exciting? Wouldn’t it be handy if your website monitoring could post to your team when the CPU starts maxing out? Or, when the server-room door is opened, or the temperature there reaches a peak temperature.

Here’s how to do that. Read on for instructions on setup, then using in IFTTT and PowerShell.

Setup in Teams

From within a team, click the ellipsis next to the team name, and choose Connectors:



Find the Incoming Webhook connector in the list, and click Add:



Give your webhook a fancy name, and upload an image if you want to – this image will show up as the avatar when your message is posted:



Click the Create button. Once the webhook is created you’ll see a URL. This is an auto-generated, unique URL that posts to your team. This is a public URL – anyone who has it can post to your team. Bear that in mind before you share it around!



Setup complete. Now, we can have fun.

Usage 1 – IFTTT

Let’s create a new IFTTT recipe applet. For this example I’m going to post to my team when the forecast suggests that it’s going to rain tomorrow. I like to keep my team informed!

First, choose the service. I’m going to choose the Weather service:



Step through whatever configuration options you need to setup your service:



Once you get here, click “that” to add the action. Add the Maker channel:



The Maker channel lets you POST to URL endpoints, perfect for what we want to do.

Click on the “Make a web request” button:



Copy the secret URL you got from Teams and paste it into the URL field. Make sure that the Method is set to POST:


Make sure the Content-Type is “application/json”. The body is where you can put the message that will go to the Team. You have to use this format for the Body:

{“text” : “Head’s up – rain tomorrow! High of {{HighTempCelsius}} C”}

This is important, because if you get it wrong then the message won’t be posted. You need the curly braces, and the quotation marks, and the ‘ “text” : ‘ bit. You can add in Ingredients to personalise your message, such as in the example above where I’ve included the max temperature.

Once you’ve done that, click Finish and you’re done.


Usage 2 – PowerShell

You can do the same thing using PowerShell if you want to embed message sending into something you already have. Here’s how:

Cool, right?!

If all went well, you’ll see 1 returned from the call to Invoke-RestMethod. The messages show up immediately in Teams, there’s seemingly no delay when sending messages this way, which is good news.

Usage 3 – ???

There’s loads of different places you could put this. If you find that you can use it to integrate with something cool / interesting, let me know in the comments 🙂

Written by Tom Morgan

Tom is a Microsoft Teams Platform developer and Microsoft MVP who has been blogging for over a decade. Find out more.
Buy the book: Building and Developing Apps & Bots for Microsoft Teams. Now available to purchase online with free updates.

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.