I am posting a list of Azure resource groups to a channel in teams using incoming webhook.
Some Azure resource groups have underscores in them, these are getting parsed and the text between two underscores is italicized. From the docs I could gather that it's Markdown behavior but I am unable to escape underscores using a \
(backslash) similar to how you would do in Markdown.
What is the right way to post text with underscores such that its rendered correctly?
(Would be nice to know what variant of Markdown is being used.)
Sample payload:
{
"text": "<br/><h1>Some text (some azure subscription id)</h1><br/>some text (more text): <br/>['resource_group_name_1', 'resource_group_name_2', 'resourcegroup-rg-foo-bar']<br/><br/>some text (more text): <br/>['resourcegroupname']<br/><br/>See <a href="https://someaccount.visualstudio.com/_git/reponame?path=%2FREADME.md">documentation</a> and <a href="https://someaccount.visualstudio.com/someproject/_build?definitionId=1234&_a=summary">sometext</a>."
}
resourcegroup-rg-foo-bar
appears as is, but resource_group_name_1
appears like resourcegroupname1.
The webhook is available in the Teams channel. You can create and send actionable messages through Incoming Webhook or Office 365 Connector.
To send a message through your Incoming Webhook or Office 365 Connector, post a JSON payload to the webhook URL. This payload must be in the form of an Office 365 connector card. You can also use this JSON to create cards containing rich inputs, such as text entry, multiselect, or selecting date and time.
There are several formatting options for messages. beneath the compose box. In this expanded view, select the text you want to format, then choose an option such as B, I, or U to bold, italicize, or underline the text.
Disabling markdown at a section level is now supported in Cards. You can set markdown
to false.
Details here
Example
{
"@type": "MessageCard",
"@context": "https://schema.org/extensions",
"summary": "Office 365 Notification",
"title": "Office 365 Service Degradations",
"sections": [
{
"markdown": false,
"facts": [
{
"name": "Service Incident:",
"value": "ID"
},
{
"name": "Start time:",
"value": "check_disk_critical"
},
{
"name": "Service:",
"value": "SERVICENAME"
},
{
"name": "Description:",
"value": "MESSAGE"
}
],
"title": "Office 365 Service Problem"
}
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With