How to Notify a Microsoft Teams Channel From GitHub Actions
A Teams Workflows (Power Automate) incoming webhook accepts a JSON Adaptive Card you can POST with curl.
Create an incoming webhook on the Teams channel, store the URL as a secret, then POST an Adaptive Card payload with curl from a workflow step.
Steps
- Add an incoming webhook to the Teams channel and copy the URL.
- Store it as the
TEAMS_WEBHOOK_URLsecret. - POST an Adaptive Card JSON body with curl.
Workflow
.github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: npm ci && npm test
- name: Notify Teams
if: always()
run: |
curl -s -H "Content-Type: application/json" -d '{
"type": "message",
"attachments": [{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.4",
"body": [{ "type": "TextBlock", "text": "Build ${{ job.status }} on ${{ github.ref_name }}" }]
}
}]
}' "${{ secrets.TEAMS_WEBHOOK_URL }}"Gotchas
- The classic Office 365 connector webhooks are retired; use a Teams Workflows webhook URL.
- Adaptive Cards must be wrapped in the
attachmentsenvelope shown above, not sent raw.
Related guides
How to Send a Slack Message With Build Status in GitHub ActionsPost a Slack message that reports the overall build status from GitHub Actions using the official slackapi ac…
How to Send a Discord Webhook Notification From GitHub ActionsPost a build notification to a Discord channel from GitHub Actions by sending a JSON payload to a Discord cha…