Edit

Share via


Create Incoming Webhooks

Important

Microsoft 365 Connectors (previously called Office 365 Connectors) are nearing deprecation, and the creation of new Microsoft 365 Connectors will soon be blocked. For more information on the schedule and how the Workflows app provides a more flexible and secure experience, see retirement of Microsoft 365 connectors within Microsoft Teams.

How can you create a webhook in Teams?

If you've already built Office 365 Connectors:

  • Create a Power Automate connector: Power Automate enhances the widely used Workflows apps in Teams. It's the scalable and secure approach to transmit data programmatically into and out of Teams. If you adopt this method, you can create workflow templates for posting alerts from your product to Teams channels. This approach simplifies user adoption of the new method. For more information, see Power Automate for enterprise developers, ISVs, and partners.

  • Update your Teams app: You can enhance your current Teams app. For example, you can enable users to set up proactive messages based on trigger events within your system. For more information, see how bots can post to channels through proactive messages.

Known issues

  • Workflows app can post as a flow bot in shared channels. Support for posting as a flow bot in private channels is under development. Workflows can currently post messages on behalf of a user.
  • Workflows support both Adaptive Cards and Message Card format (button rendering won't be supported). You can choose to convert Message Cards to Adaptive Card, see how to convert connector message card format to Adaptive Card.

Limitations

Workflows are linked only to specific users (referred to as owners of the workflow) and not to a Teams team or channel. Workflows can become orphan flows in the absence of an owner if no co-owners assigned. To maintain continuity in the business process automated by the flow, admins can add one or more co-owners and grant them full control over the workflow. They can also add authentication for connections, if any, and enable the flow if it has been disabled. For more information, see manage orphan flows.

An Incoming Webhook lets external applications share content in Microsoft Teams channels. The webhooks are used as tools to track and notify. The webhooks provide a unique URL to send a JSON payload with a message in card format. Cards are user interface containers that include content and actions related to a single article. You can use cards in the following capabilities:

  • Bots
  • Message extensions
  • Connectors

Note

Key features of Incoming Webhooks

The following table provides the features and description of an Incoming Webhook:

Features Description
Adaptive Cards using an Incoming Webhook Adaptive Cards can be sent through Incoming Webhooks. For more information, see Send Adaptive Cards using Incoming Webhooks.
Actionable messaging support Actionable message cards are supported in all Microsoft 365 groups including Teams. If you send messages through cards, you must use the actionable message card format. For more information, see Legacy actionable message card reference and message card playground.
Independent HTTPS messaging support Cards provide information clearly and consistently. Any tool or framework that can send HTTPS POST requests can send messages to Teams through an Incoming Webhook.
Markdown support All text fields in actionable messaging cards support basic Markdown. Don't use HTML markup in your cards. HTML is ignored and treated as plain text.
Scoped configuration An Incoming Webhook is scoped and configured at the channel level.
Secure resource definitions Messages are formatted as JSON payloads. This declarative messaging structure prevents the insertion of malicious code.

Note

  • Teams bots, message extensions, Incoming Webhook, and the Bot Framework support Adaptive Cards. Adaptive Card is an open cross-card platform framework that is used in all platforms such as Windows, Android, and iOS. Teams connectors don't support Adaptive Cards. However, it is possible to create a flow that posts Adaptive Cards to a Teams channel.
  • For more information on cards and webhooks, see Adaptive Cards and Incoming Webhooks.

Create Webhooks using Workflows

The Workflows app in Microsoft Teams enables you to create automated workflows that can receive HTTP requests through a webhook URL. When the webhook triggers, the workflow can post a message or an Adaptive Card to a Teams channel or chat.

Workflows are powered by Microsoft Power Automate and provide a flexible way to process webhook payloads before posting them to Teams.

Create an incoming webhook from a template

You can create a webhook workflow directly from a channel using a template.

  1. In Microsoft Teams, go to the team and channel where you want to receive webhook messages.
  2. Select More options (...) next to the channel.
  3. Select Workflows. Workflows option selected in the channel menu.
  4. Search for and select a template such as Send webhook alerts to a channel. Select the Send webhook alerts to a channel template.
  5. Configure the workflow parameters. Add the parameters.
  6. Select Save.
  7. After the workflow is created, copy the webhook link. Copy the webhook URL generated by the workflow. Use the webhook URL in your external application or service to send HTTP POST requests.

When a request is received, the workflow posts the configured message to the selected channel.

Create a webhook workflow from scratch

You can also create a webhook workflow manually using the Workflows app.

  1. In Microsoft Teams, select Apps. The app gallery appears.

  2. Search for and open the Workflows app. Search for workflows.

  3. Select Build from scratch. Build from scratch.

  4. Select the trigger When a Teams webhook request is received. Select the trigger.

  5. Configure the trigger settings.

  6. Save the workflow.

Send a request to the webhook

After creating the workflow, send an HTTP POST request to the generated webhook URL.

POST <WEBHOOK_URL>
Content-Type: application/json

{
    "text": "Hello from a webhook workflow!"
}

When the request is received, the workflow processes the payload and posts the message to the configured Teams channel or chat.

When to use Workflows for webhooks

Use Workflows when you need to:

  • Receive webhook requests from external services.
  • Post messages or Adaptive Cards to Teams channels or chats.
  • Transform or process webhook payloads before posting them to Teams.
  • Integrate webhook events with other services supported by Power Automate.

Important

You can build a notification bot Teams app using Microsoft 365 Agents Toolkit (previously known as Teams Toolkit) other than an Incoming Webhook. They perform similarly but notification bot has more functionalities. For more information, see Build notification bot with JavaScript or Incoming Webhook notification sample.

You can create and send actionable messages through an Incoming Webhook or connector for Microsoft 365 Groups. For more information, see create and send messages.

Note

In Teams, select Settings > Member permissions > Allow members to create, update, and remove connectors, so that any team member can add, modify, or delete a connector.

Example

Sample code reference

var adaptiveCardJson = @"{
  ""type"": ""message"",
  ""attachments"": [
    {
      ""contentType"": ""application/vnd.microsoft.card.adaptive"",
      ""content"": {
        ""type"": ""AdaptiveCard"",
        ""body"": [
          {
            ""type"": ""TextBlock"",
            ""text"": ""Message Text""
          }
        ],
        ""$schema"": ""http://adaptivecards.io/schemas/adaptive-card.json"",
        ""version"": ""1.0""
      }
    }
  ]
}";

var webhookUrl = "https://xxxxx.webhook.office.com/xxxxxxxxx";

var client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

var content = new StringContent(adaptiveCardJson, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync(webhookUrl, content);

Manage your workflows

You can manage your workflows by turning them on or off, or by deleting them when no longer needed.

Turn on or turn off your workflow

Turn on or turn off a workflow at any time from the Workflows app.

  1. Open the Workflows app.

  2. Scroll down the Home page to find the Your workflows section.

  3. Next to the workflow you want to turn on or turn off, select More actions (…).

  4. From the menu, select Turn on or Turn off.

    Workflows-turnon-off.

Delete your workflow

Remove a workflow from your list at any time.

  1. Open the Workflows app.

  2. Scroll down the Home page to find the Your workflows section.

  3. Next to the workflow you want to delete, select More actions (…).

  4. Select Delete. Workflow-delete.

  5. In the confirmation window, select Delete to permanently remove the workflow.

    Workflow-delete-popup.


Code sample

Sample name Description .NET Node.js
Incoming Webhook This sample demonstrates a Teams tab to send message cards using Incoming Webhook, showcasing the HttpPOST action for interactive cards. View View

See also