A package to send messages to a Microsoft Teams channel.
See our GitHub repo for the latest code, to file an issue or submit improvements for review and potential inclusion into the project.
The goteamsnotify
package (aka, go-teams-notify
) allows sending messages
to a Microsoft Teams channel. These messages can be composed of
π« deprecated legacy
MessageCard
or Adaptive Card
card
formats.
Simple messages can be created by specifying only a title and a text body.
More complex messages may be composed of multiple sections (π«
deprecated MessageCard
) or
containers (Adaptive Card
), key/value pairs (aka, Facts
) and externally
hosted images. See the Features list for more information.
NOTE: Adaptive Card
support is currently limited. The goal is to expand
this support in future releases to include additional features supported by
Microsoft Teams.
MessageCard
),
containers (Adaptive Card
) key/value pairs (aka, Facts
) and externally
hosted imagesAdaptive Card
format)MessageCard
type
Adaptive Card
type
In short:
For more details, see the Releases section or our Changelog.
Series | Example | Status |
---|---|---|
v1.x.x |
v1.3.1 |
Not Supported (EOL) |
v2.x.x |
v2.6.0 |
Supported (until approximately 2026-01) |
v3.x.x |
v3.0.0-alpha.1 |
Planning (target 2026-01) |
v4.x.x |
v4.0.0-alpha.1 |
TBD |
Task | Start Date / Version | Status |
---|---|---|
support the v2 branch with bugfixes and minor changes | 2020-03-29 (v2.0.0) | Ongoing |
add support & documentation for Power Automate workflow URLs | v2.11.0-alpha.1 | Complete |
Early January 2026:
MessageCard
) format[!NOTE]
While the plan for the upcoming v3 series includes dropping support for the π« deprecated
MessageCard
format and O365 connectors, the focus would not be on refactoring the overall code structure; many of the rough edges currently present in the API would remain in the v3 series and await a more focused cleanup effort made in preparation for a future v4 series.
See the CHANGELOG.md
file for the changes associated with
each release of this application. Changes that have been merged to master
,
but not yet an official release may also be noted in the file under the
Unreleased
section. A helpful link to the Git commit history since the last
official release is also provided for further review.
See the Examples section for more details.
[!WARNING]
Microsoft announced July 3rd, 2024 that Office 365 (O365) connectors within Microsoft Teams would be retired in 3 months and replaced by Power Automate workflows (or just "Workflows" for short).
Quoting from the microsoft365dev blog:
We will gradually roll out this change in waves:
- Wave 1 - effective August 15th, 2024: All new Connector creation will be blocked within all clouds
- Wave 2 - effective October 1st, 2024: All connectors within all clouds will stop working
Microsoft later changed some of the details regarding the retirement timeline of O365 connectors:
Update 07/23/2024: We understand and appreciate the feedback that customers have shared with us regarding the timeline provided for the migration from Office 365 connectors. We have extended the retirement timeline through December 2025 to provide ample time to migrate to another solution such as Power Automate, an app within Microsoft Teams, or Microsoft Graph. Please see below for more information about the extension:
- All existing connectors within all clouds will continue to work until December 2025, however using connectors beyond December 31, 2024 will require additional action.
- Connector owners will be required to update the respective URL to post by December 31st, 2024. At least 90 days prior to the December 31, 2024 deadline, we will send further guidance about making this URL update. If the URL is not updated by December 31, 2024 the connector will stop working. This is due to further service hardening updates being implemented for Office 365 connectors in alignment with Microsoftβs Secure Future Initiative
- Starting August 15th, 2024 all new creations should be created using the Workflows app in Microsoft Teams
Since O365 connectors will likely persist in many environments until the very end of the deprecation period this project will continue to support them until then alongside Power Automate workflows.
Valid Power Automate Workflow URLs used to submit messages to Microsoft Teams use this format:
https://*.logic.azure.com:443/workflows/GUID_HERE/triggers/manual/paths/invoke?api-version=YYYY-MM-DD&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=SIGNATURE_HERE
Example URL from the LinkedIn Bring Microsoft Teams incoming webhook security to the next level with Azure Logic App article:
https://webhook-jenkins.azure-api.net/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=f2QjZY50uoRnX6PIpyPT3xk
[!TIP]
Use a dedicated "service" account not tied to a specific team member to help ensure that the Workflow connector is long lived.
The initial O365 retirement blog post provides a list of templates which guide you through the process of creating a Power Automate Workflow webhook URL.
Workflows
when a webhook request
Post to a channel when a webhook request is received
Post to a chat when a webhook request is received
Microsoft Teams
is successfully enabledNext
Microsoft Teams Team
drop-down list.Microsoft Teams Channel
drop-down list.Create flow
Done
Workflows
application in teamsCreate
across the top of the UINotifications
at the leftPost to a channel when a webhook request is received
Microsoft Teams
is successfully enabledNext
Microsoft Teams Team
drop-down list.Microsoft Teams Channel
drop-down list.Create flow
Done
This template walks you through the steps of creating a new Workflow using the https://make.powerautomate.com/ web UI:
Create
Microsoft Teams Team
drop-down list.Microsoft Teams Channel
drop-down list.Create
Edit
from the menu across the top
My flows
from the side menu, then select Edit
from the "More commands" ellipsisWhen a Teams webhook request is received
(e.g., left click)HTTP POST URL
value
POST
a request to this Workflow connector URL
[!WARNING]
O365 connector webhook URLs are deprecated and scheduled to be retired on 2024-10-01.
Valid (deprecated) O365 webhook URLs for Microsoft Teams use one of several (confirmed) FQDNs patterns:
outlook.office.com
outlook.office365.com
*.webhook.office.com
example.webhook.office.com
Using an O365 webhook URL with any of these FQDN patterns appears to give identical results.
Here are complete, equivalent example webhook URLs from Microsoft's documentation using the FQDNs above:
webhookb2
sub-URI specific to this FQDN patternAll of these patterns when provided to this library should pass the default validation applied. See the example further down for the option of disabling webhook URL validation entirely.
[!WARNING]
O365 connector webhook URLs are deprecated and scheduled to be retired on 2024-10-01.
β―
next to the channel name and then choose Connectors.Credit: docs.microsoft.com, gist comment from shadabacc3934
This is an example of a simple client application which uses this library.
Adaptive Card
MessageCard
This is an example of a simple client application which uses this library to route a generated message through a specified proxy server.
Adaptive Card
MessageCard
These examples illustrates the use of one or more user mentions. This feature
is not available in the legacy π«
deprecated MessageCard
card format.
This example illustrates the use of a CodeBlock
.
This feature is not available in the legacy π«
deprecated MessageCard
card format.
These examples illustrates the use of a Table
. This
feature is not available in the legacy π«
deprecated MessageCard
card format.
This example illustrates setting a custom user agent.
Adaptive Card
MessageCard
This example illustrates adding an OpenUri
(π«
deprecated MessageCard
) or
OpenUrl
Action. When used, this action triggers
opening a URL in a separate browser or application.
Adaptive Card
MessageCard
These examples illustrates using
ToggleVisibility
Actions to control the
visibility of various Elements of an Adaptive Card
message.
This example disables the validation webhook URLs, including the validation of known prefixes so that custom/private webhook URL endpoints can be used (e.g., testing purposes).
Adaptive Card
MessageCard
This example demonstrates how to enable custom validation patterns for webhook URLs.
Adaptive Card
MessageCard
See the Known importers lists below for a dynamically updated list of projects using either this library or the original project.