Formatting of teams web hook is broken
Bug summary
When configuring a teams web hook block using the new workflow based method from microsoft and creating an automation to notify on certain events, the notification does not get formatted properly. It looses all line breaks and contains no links.
Since the notification text is automatically wrapped in an "adaptive card" it appears no to be possible to create properly formatted notifications as has been the case previously using the (now outdated) web hooks from teams directly.
See also: https://github.com/PrefectHQ/prefect/issues/14575
Version info
prefect cloud
Additional context
No response
I found a workaround that is good enough for our use case. The text that the automation sends will be interpreted as markdown in teams. Therefore links and line breaks can be created according to markdown syntax. This solves the most essential problems. E.g.
subject {{ flow.name }} run notification
and body:
Flow run {{ flow.name }}/{{ flow_run.name }} observed in state `{{ flow_run.state.name }}` at {{ flow_run.state.timestamp }}.
[{{ deployment.name }}]({{ deployment|ui_url }}) / [{{ flow_run.name }}]({{ flow_run|ui_url }})
State message: {{ flow_run.state.message }}
result in an workable message in teams.
One more thing: there is no support for things like block quotes in the markdown block of adaptive cards: https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?tabs=adaptive-md%2Cdesktop%2Cdesktop1%2Cdesktop2%2Cconnector-html#format-cards-with-markdown
so the current default for wrapping the state of a flow in a markdown block does not work, at least in terms of formatting.
One problem with the missing ability to control the format of the adaptive card is also apparent when displaying the notifications on a mobile device with a small screen, where the default of teams is apparently to clip text instead of wrapping it.