Okta Workflows How-To: Customize your MS Teams messages

By Bryan Barrows

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.

Text - Compose card with 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.

POST to your Teams endpoint

The payload should look something like:

  "body": {
    "contentType": "html",
    "content": "<h1 style=\"color:#FF0000;font-weight:bold\">Attention!</h1> <p>Thanks for reading! &#127867</p>"

Finally, we use the Custom API Action card to

POST /teams/{team-id}/channels/{channel-id}/messages

Teams message result

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 "download" link above
  • click "Save Link As"
  • be sure the filename ends in .flow!

And check out my other guides and Workflows content here: Workflows Guides & Resources

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.

Leave a Reply