Okta Workflows makes it easy to build automations that notify or alert your teams with connectors to services like Slack and MS Teams.
Someone recently asked, "Why can't I add line-breaks to my MS Teams messages?"
As it turns out, we need to leverage the Custom API Action card so that we can specify that our content is HTML, rather than text.
With the default Send Message to Channel
card, our content is sent as text and line-breaks are ignored. Writing our message in HTML allows us to include line-breaks, lists, headers, style our text with fonts & colors, and more.
We can use the Text - Compose
card to write our HTML message.
We can use a pair of Object - Construct
cards to construct our request payload. We create a message object that contains our message content
and specifies our contentType
as html
. We then nest the message object in an object called body
.
The payload should look something like:
{
"body": {
"contentType": "html",
"content": "<h1 style=\"color:#FF0000;font-weight:bold\">Attention!</h1> <p>Thanks for reading! 🍻</p>"
}
}
Finally, we use the Custom API Action
card to
POST /teams/{team-id}/channels/{channel-id}/messages
Additional Resources:
Feel free to download my example, import it and try it out - just update the Relative URL in the Custom API Action to point at your own Team and Channel:
Download steps:
- right click "view raw" in the panel above on the right
- click "Save Link As"
- be sure the filename ends in
.flow
or check out my other guides and Workflows content (more coming soon!) here:
bbarrows89 / oktaworkflows
tips, flows, and more related to Okta Workflows
Okta Workflows Guides and Resources
Free Training - Foundations for Flowgrammers
- Self-paced training to get started with Workflows
- Foundations for Flowgrammers
Guides
Office Hours
- Come join us in Community Office Hours!
- We meet 3x a week and are here to help answer questions and get you unblocked while you're building.
- Come with questions or just listen in to what other folks are building and working on.
- Book a session
Dev.to
- Posts by Workflows staff and community builders
- https://dev.to/oktaworkflows
Max Katz
- Max Katz blog
- Max Katz is in charge of Community for Okta Workflows and has an excellent collection of tips and guides.
IAMSE.blog
- IAMSE.blog/workflows
- A blog run by Okta Sales Engineers that covers various Okta topics.
Contact Bryan
- Feel free to contact me via LinkedIn
Hope this helps! Find me on LinkedIn or shoot me an email if you have any questions.
You can also join us at a Community Office Hours session to work through problems and ask questions - I'd love to see you there.
Top comments (0)