Office 365: Using Incoming Webhooks in Microsoft Teams

Incoming webhooks are a great way to get nicely presented information to your teams. While software and service providers have the ability to create connectors for teams, the current list of connectors not huge, though it does contain most of the big services such as Twitter, GitHub, JIRA, Trello etc. I have no doubt that the list will grow over time, but for now, the ability to integrate other sources of data via webhooks makes it relatively easy to bring timely information into your messaging environment.

Creating a new webhook

First, we need to create a new webhook endpoint. In the Teams app:

  1. Click on the on the team you want to add the webhook to
  2. Choose Connectors
  3. Search for Webhook and click Configure next to Incoming Webhook
  4. Give the webhook a name and, optionally, a custom image and click Create
  5. On the next page you are given a URL. You need to copy this or you won’t be able to send requests to your new webhook.

Using the webhook

Now that we have the endpoint, we can start to utilise it by sending POST requests. To do this, I will be using PowerShell, but you should be able to use any language you like as long as you can create a JSON string.

$uri = 'Your webhook URL here'
$body = @"
    "@type": "MessageCard",
    "@context": "",
    "themeColor": "ff0000",
    "title": "My First Webhook",
    "text":"That wasn't so hard!",
    "sections": [{
        "activityTitle": "Something happened!",
        "activitySubtitle": "Here are the details",
        "facts": [{
            "name": "Fact 1",
            "value": "Details"
        }, {
            "name": "Fact 2",
            "value": "Details"
        }, {
            "name": "Fact 3",
            "value": "Details"
        "markdown": true

invoke-webrequest -method Post -uri $uri -contenttype 'application/json' -body $body

This script will send a card that looks like this.

That is all you need to do to send a message card to your team. You can add many more features to your card, including comments, avatars and images, action buttons. I will cover these when I have had more time to experiment with them. In my next post, I’ll show you how to use this in conjunction with the Windows Event log and Task Scheduler to provide almost instant notifications when a particular event occurs.

4 thoughts on “Office 365: Using Incoming Webhooks in Microsoft Teams

  1. Hello webmaster, i’ve been reading your site for some time and I really like coming
    back here. I can see that you probably don’t make money on your site.
    I know one simple method of earning money, I think you will like it.

    Search google for: dracko’s tricks


  2. Hi. I see that you don’t update your page too often. I know that
    writing posts is boring and time consuming. But did you know that
    there is a tool that allows you to create new articles using existing content (from article directories or
    other blogs from your niche)? And it does it very well. The new posts are unique and
    pass the copyscape test. You should try miftolo’s tools


Leave a Reply to Joe Black Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s