Okta Workflows Tutorial: Send a Microsoft Teams Notification for a New Okta Event

This tutorial is part of Okta Workflows with Microsoft series:

  1. Send an Email Notification for a New Okta Event
  2. Send a Notification to Microsoft Teams for a New Okta Event
  3. Send a Rich Message to Microsoft Teams for a New Okta Event Using Microsoft API

This step-by-step tutorial will teach you how to send event notifications to a Microsoft Teams channel when a new user is activated in Okta.

Things you will learn:

  • Build a complete flow.
  • Trigger a flow on a user-activated event.
  • Read user information from Okta.
  • Create a message and send the message to Microsoft Teams.
  • Test individual steps and the flow.

You will build the following flow automation:

workflows_ms_teams_flow2.png (2678×1448)

A flow to send event notifications to Microsoft Teams.

Introduction to Okta Workflows

Okta Workflows is a no-code platform for building identity automation.

What is Okta Workflows?

Read the Introduction to Okta Workflows blog post.

Get access to Okta Workflows

If you don’t have access to Okta Workflows, learn how to get access to Okta Workflows.

Build the send notification flow

This section will teach you how to build the send notification to Microsoft Teams flow.

Create a new flow

To create a flow:

  1. In the Workflows console, click Flows.
  2. In the Default Folder, click + New Flow to create a new flow.
  3. Click Unnamed (upper left corner).
  4. For name, enter Send event notification to Microsoft Teams.
  5. For Description, enter This flow sends an event notification to Microsoft Teams.
  6. Also, check the Save all data that passes through the Flow? checkbox. You will be using this capability at the end of this tutorial.
  7. Click Save to save the flow name and description.

workflows_ms_teams_new_flow.png (2656×1096)

A new flow.

The following section will teach you how to trigger a flow and set up a connection to Okta.

Trigger a flow

You want to send a notification when a user is activated in Okta. You need to trigger the flow on the user-created event in Okta.

  1. Click Add event inside the When this happens step.
  2. Find and select the Okta connector from the connector list.

workflows_ms_teams_connector_list.png (1576×1356)

Okta built-in connectors to trigger a flow.

  1. Next, find and click on the User Activated event. You can search for the event at the top.

workflows_ms_teams_user_activated_event.png (1738×1274)

Trigger a flow when a user is activated.

If you have a connection to Okta, the flow looks like this:

workflows_ms_teams_user_activated_added.png (1506×1434)

Flow with the User Activated event.

If you don’t have a connection to Okta, go to the next section to create a connection to Okta.

Create a connection to Okta

If you don’t have a connection to Okta, you will see the + New Connection button inside the card.

workflows_ms_teams_no_connection.png (1126×762)

Creating a new connection to Okta.

  1. Click + Create Connection.
  2. Starting with step #4, follow the How to Authorize an Okta Connection in Okta Workflows KB to create a connection to Okta.

The flow after adding the Okta – User Activated card and setting the connection:

workflows_ms_teams_user_activated_added.png (1506×1434)

Flow with the User Activated event.

Test the User Activated event

The flow doesn’t do a lot yet, but you can test the flow that it runs when the user-activated event happens.

Turn the flow on

  1. Turn the flow on.

workflows_ms_teams_flow_on.png (1184×430)

Turning the flow on.

Activate a user

  1. Go to Okta admin console > Directory > People.
  2. Select a user to activate.
    • If you don’t have an active user, to deactivate a user first:
      • Click on a user to deactivate.
      • Click More Actions > Deactivate.
      • Click Deactivate to confirm.
  3. Click Activate, then click Activate to confirm.

Check flow history

  1. Return to Workflows and open the Execution History tab. You will see one flow execution.
    • If you don’t see the execution, go to the Flow tab and return to Execution History.

workflows_ms_teams_event_test1.png (2654×1374)

Flow execution history.

The card’s fields show various event information.

In the following section, you will compose a message to send to Microsoft Teams.

Compose a message

You will use the Text – Compose card to compose a message.

  1. Click the Add function to add the Text – Compose card.
  2. From the Most Popular category, click Compose.
    • The Compose card is also listed in the Text category.
  3. Enter User Activated: into the Compose card.

workflows_ms_teams_compose.png (2108×1232)

Adding the Compose card.

You would like to add the user’s login (email), name, and title to the message.

To check what fields the event makes available:

  1. Switch to the Execution History tab.
  2. Scroll until you see the Okta User field on the User Activated card.
  3. Click the arrows in the field’s upper-right corner to expand the JSON object.

workflows_ms_teams_json_object.png (2058×1262)

Event JSON information.

This is one JSON object the event makes available:

{
  "ID": "00ubdljb2k2CrZdn6697",
  "Alternate ID": "[email protected]",
  "Display Name": "Jessica Fox",
  "Type": "User"
}

However, there is no information about the user’s login and title.

You will add the Okta – Read User card to get additional information about the user.

Read user information with the Read User card

You will add the Read User card between the two existing cards.

Add the Read User card

workflows_ms_teams_add_menu.png (546×376)

  1. Hover over the + sign between the User Activated and Compose cards.
  2. Click on the ☁️ to add an app action.
  3. Select the Okta connector.
  4. Find and click on the Read User action.

The Okta connection you created earlier will be automatically selected.

workflows_ms_teams_readuser_card.png (2140×1224)

Adding the Read User card.

To configure the card:

  1. You don’t need the output fields selected. Uncheck them all.
  2. Check the fields you need:
    • Username
    • First name
    • Last name
    • Title
  3. Click Save to save the card’s settings.

To edit a card’s fields, click the ⚙️ > Choose fields.

The Read User card:

workflows_ms_teams_readuser_card2.png (512×898)

The Read User card.

Pass data to the Read User card

The Read User card requires an ID or Login. The User Activated event has the ID available under the Okta User field.

  1. Connect the Okta User > ID field to the ID or Login field.

workflows_ms_teams_connect_id_readuser.gif (576×506)

Passing data to the Read User card.

Test the Read User card

It’s a good practice to test individual cards.

To test the card:

  1. Click ▶️ on the Read User card.
  2. Use the user ID or Login to test the card.
    • To test with the user ID, copy it from the Execution History page. Copy the ID from the Okta User field in the User Activated card.
    • To test with Login, enter the user’s email address.
  3. Click Test to test the card.

workflows_ms_teams_test_readuser.png (1454×1250)

Testing the Read User card.

To set a user’s title, go to Okta Admin console > Directory > People. Select the user. Open the Profile tab and click Edit. Set the title and save.

Finish composing the message

Now you have the information you need to finish the message. Use the fields from the Read User card to create the following message:

workflows_ms_teams_compose2.png (1494×900)

The Compose card with message.

Test the Compose card

If you want, you can test the Compose card. Click ▶️ on the Compose card to test it. Enter the data for the four fields and click Test.

Send a message to Microsoft Teams

To send a message to Microsoft Teams, you will use the Microsoft Teams connector.

  1. After the Compose card, click Add app action.
  2. Find and click on the Microsoft Teams connector. You can search for it.
  3. Select the Send Message to Channel action.

workflows_ms_teams_send_msg_channel_action.png (1282×1090)

Microsoft Teams – Send Message to Channel action.

Set up the Microsoft Teams connection

workflows_ms_teams_end_msg_channel_new_connection.png (516×604)

Setting up a new connection.

To set a connection:

  1. Click on + New Connection to start setting up a connection.
  2. Keep the default connection name.
  3. Enter Microsoft Teams connection for the Description field.
  4. Click Create and follow the steps to create and authorize the connection.

The Send Message to Channel card after creating the connection:

workflows_ms_teams_send_msg_channel_card.png (522×1228)

The Microsoft Teams – Send Message to Channel card.

Set inputs for the Send to Message Channel card

You need a channel in Microsoft Teams to use for this automation. The channel has the Team Id and Channel Id information the Send Message to Channel card requires.

  1. In Microsoft Teams, create a channel you will use for testing (in the Teams tab).
  2. Place the mouse over the channel name and click on the three dots to access the More options menu.
  3. Select Get link to channel.

workflows_ms_teams_link_to_channel.png (586×892)

Microsoft Teams channel information.

  1. Copy the link value.

The link looks like this

https://teams.microsoft.com/l/channel/19%3A5431db0d2cb3436c902a20fd805eb7ee%40thread.tacv2/Okta%20Workflows?groupId=44e28d56-4b86-4cf0-82f6-ac1909cfc9ef&tenantId=d19b035f-2acb-474f-aa3a-661aa181756a

Using the link above:

  1. Copy the groupId value and paste it into the Team Id field on the Send Message to Channel card.
  2. Copy and paste the channel ID into the Channel Id filed on the Send Message to Channel card.

For the Content field:

  1. Connect the output field from the Compose card to the Message Content field on the Send Message to Channel card.

workflows_ms_teams_send_msg_channel_card2.png (1500×1228)

Setting inputs for the Send Message to Channel card.

Test the Send Message to Channel card

To test the card:

  1. Click ▶️ on the card.
  2. Enter sample message for Content and click Test.
  3. Check the message in Microsoft Teams.

In the following section, you will test the flow.

Test the flow

You are ready to test the flow.

  1. Save the flow.
  2. Check the flow is on.
  3. Go to Okta Admin console > Directory and select a user to activate.
    • To deactivate a user first:
      • Click on a user to deactivate.
      • Click More Actions > Deactivate.
      • Click Deactivate to confirm.
  4. Click the Activate and Activate again to confirm.

workflows_ms_teams_activate_user.png (1354×906)

Activating a user.

Check in the Execution History tab to see this flow run when you activated the user (if you don’t see the execution, open the Flow tab and return to the Execution History tab):

workflows_ms_teams_flow_test2.png (2654×1202)

Flow execution history.

Activation message in Microsoft Teams:

workflows_ms_teams_channel_message2.png (2112×834)

Message in Microsoft Teams channel.

Things you learned

In this tutorial, you created a flow to send event notifications to Microsoft Teams. Things you learned:

  • Build a complete flow.
  • Trigger a flow on a user-activated event.
  • Read user information from Okta.
  • Create a message and send the message to Microsoft Teams.
  • Test individual steps and the flow.

The flow you built:

workflows_ms_teams_flow.png (2688×1234)

A flow to send event notifications to Microsoft Teams.

 

This tutorial is part of Okta Workflows with Microsoft series:

  1. Send an Email Notification for a New Okta Event
  2. Send a Notification to Microsoft Teams for a New Okta Event
  3. Send a Rich Message to Microsoft Teams for a New Okta Event Using Microsoft API

Okta Workflows resources

🍫 Get help from Workflows specialists during weekly community office hours.

📺 Learn from Workflows videos.

🛟 Get help from support: discuss a Workflows topic or ask a question.

🙋🏻‍♀️ Get help from the community: join the #okta-workflows channelon MacAdmins Slack.

Tags

Workflows