Okta Workflows Tutorial: Send an Email 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

In this step-by-step tutorial, you will build a flow to send an email notification using the Microsoft Office 365 Mail connector when a user is created in Okta.

Things you will learn:

  • How to run a flow on an Okta event.
  • How to send email with the Office 365 Mail connector.
  • How to test individual cards and the flow.

The flow you will build looks like this:

workflows ms notify email

Send email notification flow.

What is Okta Workflows?

Okta Workflows is a no-code platform that allows you to build automation to help with identity processes. For example, you can creatw the following workflows without asking IT or developers for help:

  • Reset password end user sessions when suspicious activity is detected.
  • Give or remove user access to applications.
  • Send notifications (Teams, Slack, email) when events occur in your Okta organisation.
  • Create basic reports.

It’s a short list of what is possible.

Getting access to Okta Workflows

To complete this tutorial, you need to have access to Workflows.

There are two ways to access Workflows:

  1. You might be entitled to Workflows if you already use some Okta products.
  2. Access to Workflows as part of the WIC (Workforce Identity Cloud) trial.

Workflows when using other Okta products

If you have Okta SSO (Sign Sign-On) or Okta UD (Universal Directory), you might be entitled to Workflows. Check if you can access Workflows by going to Okta organisation > Admin > Workflows > Workflows console.

If you use these products but don’t have access to Workflows, please contact your account manager. Or, contact me, and I will try to help you 🙌.

Okta Workflows as part of the WIC (Workforce Identity Cloud) trial

To sign up for a WIC trial:

  1. Go to the Okta Workforce trial page.
  2. Register for the WIC trial to access Workflows.

Opening the Okta Workflows console

To access Workflows:

  1. Sign in to your Okta org
    • If you are using a trial, your org URL is in an email with the Activate your Okta account subject.
    • It has the following format: https://trial-<ID>.okta.com.
      • For example, https://trial-6093533.okta.com.
  2. Click Admin (upper right) to access the Admin console.
  3. Click Workflows > Workflows console to open Workflows on the right-hand side menu.

You will see the Workflows home page:

Workflows home page image.

Workflows home page

Okta Workflows fundamentals

This section will teach you about Workflows fundamentals.

Each card represents one step in a flow.

tutorial importusers basic steps

A flow with two steps.

A card has two types of fields: input and output. Input fields accept values. Output fields are values a card produces. A card can pass output fields to subsequent cards.

An example of the Text – Length card:

Text - Length card imag

Text – Length card

This card calculates and returns the number of characters in a text string.

  • The text field is the card’s input
  • The length field is the card’s output (the lower grey area)

There are two types of cards:

  • App action cards are steps that control other applications or web services – for example, Gmail, Office 365, Slack, and Jira.
  • Function cards are steps to interact with, change, or control the data in a flow. Some examples of function cards:
    • True/False: Evaluate values based on true or false conditions.
    • Flow Control: Manage and manipulate the structure of your flow.
    • Date & Time: Parse and manipulate times and dates.
    • List: Create and iterate over lists of items.
    • Number: Perform mathematical operations.
    • Text: Build, modify, and parse text.

Send email notification flow

The first step is to create a new 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 email notification.
  5. For Description, enter This flow sends a notification when a user is suspended.
  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_notify_email_new_flow.png (2656×992)

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 trigger this flow when a new user is created 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_notify_email_connector_list.png (1758×1348)

Okta built-in connectors to trigger a flow.

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

workflows_ms_notify_email_new_user_event.png (1738×1176)

User Created event.

After adding the event, the flow looks like this:

workflows_ms_notify_email_new_user_event_set_connection.png (1118×752)

A flow with User Created event.

The following section will teach you how to create a connection.

Create a connection to Okta

Before creating a connection to Okta, open a page with the Okta sign-on information.

  1. From Workflows, click the four squares (upper right corner) and select Okta Dashboard.
  2. Open the Admin console.
  3. Navigate to Applications > Applications, select the Okta Workflows OAuth application, and open the Sign On tab. You will need the information from this page in the next step.

Flip back to the Workflows tab.

  1. Click + New Connection to start creating a new connection.
  2. For Connection Nickname, keep Okta.
  3. For Description, enter Workflows connection to Okta.
  4. Copy and paste the Client ID from the page you opened in the last section for Client ID.
  5. Repeat the same steps for Client Secret.
  6. For Domain, enter trial-<ID>.okta.com (without the http://). For example, trial-6093533.okta.com.
  7. Click Create to create a connection to Okta.

You created a connection to Okta.

The flow will run when a user is created.

workflows_ms_notify_email_usercreated_event.png (1122×1218)

Flow with User Created event.

The fields inside the Okta – User Created card are event information.

Let’s test the flow to check if it runs when a new user is created.

Turn the flow on

To turn the flow on:

  1. Click Save to save changes.
  2. Open the Flow is OFF button and toggle it to turn it on.

workflows_ms_notify_email_flow_on.png (2610×476)

Turning the flow on.

Test the flow

To test the flow, create a user in Okta.

Create a user

  1. In the Admin console, go to Directory > People.
  2. Click Add person to create a new user.
  3. Enter data for the First nameLast name, and Username.
  4. Click Save to create a new user.

workflows_ms_notify_email_create_user.png (1434×1472)

Create a new user.

Check the Execution History page

In Workflows, open the Execution History page. You will see one flow execution, the event data, and the new user data:

workflows_ms_notify_email_run1a.png (2680×1234)

Flow execution.

The new user data is a JSON object. To view the user details, click the arrows to expand the JSON data:

workflows_ms_motify_email_run1_details.png (2072×1256)

User details.

In the next step, you will create a text message.

Create a message

The first step is to add the Compose card.

Add the Compose card

  1. Switch back to the Flow page in Workflows.
  2. In the Then do this step, click Add function.
  3. Select the Text category and then the Compose function.

The flow looks like this:

workflows_ms_notify_email_compose.png (2100×1214)

Flow with the Compose card.

  1. Inside the Compose card, enter New user created:.

workflows_ms_notify_email_compose1.png (938×600)

Compose card.

Pass data to the Compose card

You need to add the person’s name and email to the message.

  1. In the User Created card, find the Okta User object field.
  2. Take the Display Name field and connect it to the Compose card (after the created:)
  3. Enter a comma (,).
  4. Take the Alternate ID field and connect it to the Compose card (after the ,).

Note: The Alternate ID is the email address of the Okta user. 

workflows_ms_notify_email_connect.gif (796×412)

Passing data to the Compose card.

The flow with the Compose card:

workflows_ms_notify_email_flow_compose.png (2094×1210)

Flow with the Compose card.

Test the Compose card

To test the Compose card, click the ▶️ in the lower left corner on the Compose card. Enter sample data and click Test to test the card.

workflows_ms_notify_email_test_compose.png (1456×1236)

Testing the Compose card.

In the next step, you will add the Office 365 Mail action to email the message.

Email message with Office 365 Mail

The first step is to add the Office 365 Mail – Send Email action card.

Add the Send Mail action card

  1. Click Add app action to select a connector.
  2. Find and select the Office 365 Mail connector. You can search for the connector.
  3. Select the Send Email action from the action list.

Set up a connection to Office 365 Mail

  1. Click + New Connection to start setting up a connection.
  2. Keep the Office 365 Mail for the Name field.
  3. For Description, enter Workflows connection to Office 365 Mail.
  4. Click Create.
  5. Follow the steps to sign into your Office 365 account.

The flow with the Office 365 Mail – Send Email card:

workflows_ms_notify_email_test_office365mail.png (2656×1218)

Flow with the Send Email card.

Pass data to the Send Email card

  1. Enter an email you can check in the To field.
  2. Enter New Okta User for the Subject field.
  3. Connect the output field from the Compose card to the Body field in the Send Email card.

workflows_ms_notify_email_office365mail_connect.png (2142×1222)

Flow with the Send Email card.

The Send Email card doesn’t use the CCBCCMessage Type, and Attachments fields. To hide these fields:

  1. Click the ⚙️ > Choose fields in the lower right corner.
  2. Uncheck the fields you don’t need to show on the card.
  3. Click Save.

The flow with only the To and Body fields on the Send Email card:

workflows_ms_notify_email_office365mail_connect2.png (2124×1216)

Flow with the Send Email card.

Test the Send Email card

To test the Send Email card:

  1. Click the ▶️ in the lower left corner on the Send Email card.
  2. The To and Subject fields are pre-filled. Enter a sample message for the Body field.
  3. Press Test to test the card.
  4. Check the email for the message.

The next step is to test the flow.

Test the flow

To test the flow, you will create a new user in Okta. You need to delete the user if you want to use the same user information used earlier. If you will create a different user, you can skip the next section.

Delete a user

  1. Go to Directory > People in the Admin console.
  2. Click on a user you want to delete.
  3. Click on More Actions > Deactivate, then confirm by clicking Deactivate.
  4. Click on Delete, then confirm by clicking Delete to delete this user.

Create a user to test the flow

Before creating a user and testing, save the flow and check the flow is on.

The final flow:

workflows_ms_notify_email_final_flow.png (2166×1430)

Send email notification on new event.

  1. In the Admin console, go to Directory > People.
  2. Click Add person to create a new user.
  3. Enter data for the First nameLast name, and Username.
  4. Click Save to create a user.

Check the Execution History page

In Workflows, open the Execution History page. You will see a flow execution for the user created event.

Note: if you don’t see the execution, open the Flow page and return to the Execution History page.

The execution shows the Compose and the Send Email cards and how data is passed from card to card.

workflows_ms_notify_email_run2.png (2692×1248)

Flow execution.

The email message the flow sends:

workflows_ms_notify_email_email.png (1804×644)

Email message the flow sends.

Create another user to see another flow execution.

Okta Workflows tip

Click card’s﹖to learn about the card, how it works, and its inputs/outputs.

workflows_ms_notify_email_tip-1.png (2300×1130)

Card help.

Things you learned

In this tutorial, you built a flow to send an email notification on an Okta event. You learned:

  • How to run a flow on an Okta event.
  • How to send email with the Office 365 Mail connector.
  • How to test individual cards and the flow.

The flow you built:

workflows_ms_notify_email_final_flow.png (2166×1430)

Send email notification flow.

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