DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Okta Workflows How-To: Send stylized messages with MS Teams
Bryan Barrows for Okta Workflows

Posted on

Okta Workflows How-To: Send stylized messages with MS Teams

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>"
  }
}
Enter fullscreen mode Exit fullscreen mode

Finally, we use the Custom API Action card to

POST /teams/{team-id}/channels/{channel-id}/messages
Enter fullscreen mode Exit fullscreen mode

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 "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:

GitHub logo bbarrows89 / oktaworkflows

tips, flows, and more related to Okta Workflows


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)

An Animated Guide to Node.js Event Lop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.