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

bryanbarrows

Bryan Barrows

Posted on October 14, 2022

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

Okta Workflows Guides and Resources

Okta Workflows Logo

Free Training - 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

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

Contact Bryan





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.

💖 💪 🙅 🚩
bryanbarrows
Bryan Barrows

Posted on October 14, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related