Curl a message to Microsoft Teams
TL;DR
- create a connector of type: ‘incoming webhook’ to the teams channel you want to post to and copy the generated url
- create a curl command
- view your teams message
Create the connector (aka webhook)
-
select the channel you want to create a connector for:
-
add an ‘incoming webhook’:
-
click add:
-
name the connector (Note this name will appear in teams as the message sender)
-
click ‘create’:
-
copy the generated connector url:
Create the Curl command
set URL=https://outlook.office.com/webhook/1f53a159-15e1-4215-a345-31b004a1a5a9@d2449f56-cf6a-4196-87bc-aaaaaaaaaaaa/IncomingWebhook/a97a67eeac05428db5b9a4b5ba4cfa70/f58df943-e123-4a0d-b03b-bbbbbbbbbbbb
set DATA={""@context"": ""http://schema.org/extensions"",""@type"": ""MessageCard"",""text"": ""Hello from curl""}
curl.exe -XPOST -H "Content-type: application/json" -d "%DATA%" %URL%
Result
Thanks to my colleague Stu for the inspiration for this post
Read other posts