編輯

共用方式為


Build webhooks and connectors

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't post in private channels as a flow bot. However, it can post on behalf of a user.
  • Workflows support Adaptive Cards only. It doesn't support the older message card format that Office 365 Connectors use. The support for the use of message card format within Workflows becomes available from mid-October. For more information, see how to convert connector message card format to Adaptive Card.
  • Workflows don't offer third-party connectors such as DataDog and Jenkins.
  • Workflows can only be created in your default environment.

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.

Webhooks and connectors help to connect the web services to channels and teams in Microsoft Teams. Webhooks are user-defined HTTP callback that notifies users about any action that has taken place in the Teams channel. It's a way for an app to get real-time data. Connectors allow users to subscribe to receive notifications and messages from your web services. They expose an HTTPS endpoint for your service to post messages in the form of cards.

Important

  • Webhooks and connectors are available only in Government Community Cloud (GCC) environment but aren't available in GCC-High and Department of Defense (DOD) environments.

  • Only Incoming Webhook connector type are available in GCC-High environment and the tenant admins need to manually upload to display the app in the connectors page.

  • You can choose to build notification bot Teams app other than Incoming Webhooks. They perform similarly but notification bot has more functionalities. For more information, see build notification bot with JavaScript or Incoming Webhook notification sample. To get started, download and explore Teams Toolkit. For more information, see Teams Toolkit documents.

Outgoing Webhooks

Webhooks help Teams to integrate with external apps. With Outgoing Webhooks, you can send text messages from a channel to a web service. After configuring the Outgoing Webhooks, users can @mention Outgoing Webhook and send a message to a web service. The service responds within 10 seconds to the message with a text or a card. For more information, see create Outgoing Webhooks.

Note

Outgoing Webhooks are configured on a per team basis and cannot be included as part of a normal Teams app.

Connectors

Connectors allow users to subscribe to receive notifications and messages from the web services. They expose the HTTPS endpoint for the service to post messages to Teams channels, typically in the form of cards.

Note

Connectors can't update messages or send messages as responses to existing messages.

Incoming Webhooks

Incoming Webhooks help in posting messages from apps to Teams. If Incoming Webhooks are enabled for a team in any channel, it exposes the HTTPS endpoint, that accepts correctly formatted JSON and inserts the messages to that channel. For example, you can create an Incoming Webhook in your DevOps channel, configure your build, and simultaneously deploy and monitor services to send alerts. For more information, see create Incoming Webhooks.

Notification bot or Incoming Webhook

Before you start to learn how to build Incoming Webhooks, you may also want to know that you can build a notification bot using Teams Toolkit or send activity feed notifications using Microsoft Graph API. Notification bots and activity feed notifications can enable more customizable experience to meet different business scenarios. For more information, see plan to send app notifications.

  Notification API Notification bot Incoming Webhook
What is it? A RESTful web API A Teams app A Teams feature
Installation required Yes Yes No
Suitable scenarios • Notify users about urgent or critical information.
• Display rich content that requires user action in the main pane of Teams.
• Receive operating system notification with sound.
• Localized preview text in Activity.
• Receive regular notifications and messages periodically, for example, receive daily notification of team tasks.
• Receive notifications and messages based on real events. For example, once teammates upload files, you receive notifications.
Communicate with external apps and receive notifications and messages from other apps.
Scope configuration • A single user
• A list of users
• Users in a chat
• Users in a team
• Teams channel
• Group chat
• Personal chat
Teams channel
Message process A Teams app makes a REST API call to trigger a notification in Activity in Teams. The API call passes the deep link to load content in the main pane. A notification bot works as a Teams application. You can define your business logic to process data and show data in a customized format. Webhook is a Teams feature rather than a Teams application, so it only receives and shows data without processing.
Retrieve Teams context App can use Graph APIs to work with Microsoft 365 data. Notification bot can retrieve Teams context such as channel or user information and messages. No
Send Adaptive Card No Yes Yes
Send a welcome message Yes Yes No
Trigger supported All triggers are supported. All triggers are supported.
If you use Teams Toolkit, you can quickly get a template project with the following triggers:
• Time trigger hosted on Azure functions.
• Express HTTP trigger hosted on Azure app service.
• HTTP trigger hosted on Azure Functions.
All triggers are supported.
Building Tools Quick start - Microsoft Graph Teams Toolkit Overview for Visual Studio Code
Teams Toolkit Overview for Visual Studio
Teams Toolkit CLI
TeamsFx SDK
No tools are required.
Cloud resource required Microsoft Entra app Azure Bot Framework No resources are required.
Tutorial Send activity feed notifications to users in Microsoft Teams
Send activity feed notification
Build notification bot with JavaScript Incoming Webhook notification sample

Connectors for Microsoft 365 Groups

Connectors for Microsoft 365 Groups allow you to create a custom configuration page for your Incoming Webhook and package them as part of a Teams app. You send messages primarily using connector cards for Microsoft 365 Groups and can add a limited set of card actions to them. For example, a weather connector that allows users to select a location and any time of the day, to receive updates about tomorrow's weather. They're configured at channel level but are installed at team level. For more information, see create connectors for Microsoft 365 Groups.

Note

You can distribute the connector for Microsoft 365 Groups Teams app to our AppStore.

Create and send messages

Actionable messages allow users to take action without leaving their email client, increasing user engagement. With Microsoft 365 and Incoming Webhooks, you can send messages by posting a JSON payload to the webhook URL. For more information, see create and send messages.

See also

App capabilities mapped to features