Send messages and Adaptive Cards to Microsoft Teams channels via Incoming Webhook.
- π¨ Simple text messages - Quick notifications and alerts
- π΄ Adaptive Cards - Rich formatted cards with facts, images, and buttons
- π§ Raw payloads - Full control over custom message structures
β οΈ Helpful error handling - Clear guidance for setup issues
You need a Webhook URL from Teams. To create one:
- In Teams, go to the target channel
- Open Workflows app (search from Apps or click three dots below input)
- Find template: "Post to a channel when a webhook request is received"
- Name the workflow (e.g., "CLI Notification Bot")
- Select target Team and Channel
- Copy the generated HTTP POST URL
python3 scripts/send_teams.py <WEBHOOK_URL> --text "Hello Teams!"python3 scripts/send_teams.py <WEBHOOK_URL> -t "π Deployment completed successfully"Inline JSON:
python3 scripts/send_teams.py <WEBHOOK_URL> -c '{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"text": "Build Report",
"weight": "Bolder",
"size": "Medium"
}
]
}'From JSON file:
python3 scripts/send_teams.py <WEBHOOK_URL> -c card.jsonpython3 scripts/send_teams.py <WEBHOOK_URL> -r '{"type": "message", "text": "Custom"}'scripts/send_teams.py
| Argument | Description |
|---|---|
webhook_url |
Teams Incoming Webhook URL (required positional) |
-t, --text TEXT |
Send simple text message |
-c, --card CARD |
Send Adaptive Card (JSON string or .json file) |
-r, --raw RAW |
Send raw custom payload (JSON string or .json file) |
-v, --verbose |
Enable verbose output |
If you receive errors about a "suspended" workflow:
- Open Power Automate (or your org's URL)
- Go to My flows / Workflows
- Find your workflow β Resume / Activate / Turn on
- Retry sending your message
MIT License - see LICENSE for details.