top of page

Post Message to Microsoft Teams using Incoming Webhook

In this blog, we will see how to post the message to Microsoft Teams using Incoming Webhook.

What is the Incoming Webhook?

Basically, it is a URL provided by Teams for any service to use to post content with the goal of sharing that content in your team’s channel.

When you configure it, you get a URL which you can then post a JSON request to. (JSON is a long-formatted string that helps standardize data.)

The final output, or the post in Teams, is a pretty card, like below:

How to configure Incoming Webhook in Microsoft Teams:

  1. Navigate to the channel where you want to add the webhook and select (•••) More Options from the top navigation bar.

  1. Choose Connectors from the drop-down menu and search for Incoming Webhook.

  1. Select the Configure button, provide a name, and, optionally, upload an image avatar for your webhook.

  1. The dialog window will present a unique URL that will map to the channel. Make sure that you copy and save the URL—you will need to provide it to the outside service.

  1. Select the Done button. The webhook will be available in the team channel.

Flow action looks like this:

JSON(Message Card):

{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "0076D7",
    "summary": "Dharanidharan Balasubramaniam created a new task",
    "sections": [{
        "activityTitle": "Dharanidharan Balasubramaniam created a new task",
        "activitySubtitle": "On Malaysia BizApps & Power Platform User Group",
        "activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
        "facts": [{
            "name": "Assigned to",
            "value": "Unassigned"
        }, {
            "name": "Due date",
            "value": "Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)"
        }, {
            "name": "Status",
            "value": "Not started"
        }],
        "markdown": true
    }],
    "potentialAction": [{
        "@type": "ActionCard",
        "name": "Add a comment",
        "inputs": [{
            "@type": "TextInput",
            "id": "comment",
            "isMultiline": false,
            "title": "Add a comment here for this task"
        }],
        "actions": [{
            "@type": "HttpPOST",
            "name": "Add comment",
            "target": "https://docs.microsoft.com/outlook/actionable-messages"
        }]
    }, {
        "@type": "ActionCard",
        "name": "Set due date",
        "inputs": [{
            "@type": "DateInput",
            "id": "dueDate",
            "title": "Enter a due date for this task"
        }],
        "actions": [{
            "@type": "HttpPOST",
            "name": "Save",
            "target": "https://docs.microsoft.com/outlook/actionable-messages"
        }]
    }, {
        "@type": "OpenUri",
        "name": "Learn More",
        "targets": [{
            "os": "default",
            "uri": "https://docs.microsoft.com/outlook/actionable-messages"
        }]
    }, {
        "@type": "ActionCard",
        "name": "Change status",
        "inputs": [{
            "@type": "MultichoiceInput",
            "id": "list",
            "title": "Select a status",
            "isMultiSelect": "false",
            "choices": [{
                "display": "In Progress",
                "value": "1"
            }, {
                "display": "Active",
                "value": "2"
            }, {
                "display": "Closed",
                "value": "3"
            }]
        }],
        "actions": [{
            "@type": "HttpPOST",
            "name": "Save",
            "target": "https://docs.microsoft.com/outlook/actionable-messages"
        }]
    }]
} 

After running the Power Automate, it will post the message in Microsoft Teams like below:

If you are interested in this topic and would like to do some further self-study, I encourage you to check out my blog on this.

Kommentarer


1688905823827.jpg

Hi, I'm Dharani

I am a Principal Consultant at Capgemini Australia, specializing in Microsoft Business Applications. With a passion for knowledge sharing and community engagement, I hold the esteemed title of MVP in Business Applications and am a Microsoft Learn Expert.

  • Facebook
  • Twitter
  • LinkedIn
  • Instagram

Subscribe

Thanks for submitting!

bottom of page