Okta Workflows Tutorial: Send an Email Notification for a New Okta Event
This tutorial is part of Okta Workflows with Microsoft series:
- Send an Email Notification for a New Okta Event
- Send a Notification to Microsoft Teams for a New Okta Event
- 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:
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 create 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:
- You might be entitled to Workflows if you already use some Okta products.
- 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:
- Go to the Okta Workforce trial page.
- Register for the WIC trial to access Workflows.
Opening the Okta Workflows console
To access Workflows:
- 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
.
- For example,
- Click Admin (upper right) to access the Admin console.
- Click Workflows > Workflows console to open Workflows on the right-hand side menu.
You will see the Workflows home page:
Workflows home page
Okta Workflows fundamentals
This section will teach you about Workflows fundamentals.
Each card represents one step in a flow.
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
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:
- In the Workflows console, click Flows.
- In the Default Folder, click + New Flow to create a new flow.
- Click Unnamed (upper left corner).
- For name, enter Send email notification.
- For Description, enter This flow sends a notification when a user is suspended.
- Also, check the Save all data that passes through the Flow? checkbox. You will be using this capability at the end of this tutorial.
- Click Save to save the flow name and description.
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.
- Click Add event inside the When this happens step.
- Find and select the Okta connector from the connector list.
Okta built-in connectors to trigger a flow.
- Next, find and click on the User Created event. You can search for the event at the top.
User Created event.
After adding the event, the flow looks like this:
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.
- From Workflows, click the four squares (upper right corner) and select Okta Dashboard.
- Open the Admin console.
- 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.
- Click + New Connection to start creating a new connection.
- For Connection Nickname, keep Okta.
- For Description, enter Workflows connection to Okta.
- Copy and paste the Client ID from the page you opened in the last section for Client ID.
- Repeat the same steps for Client Secret.
- For Domain, enter trial-<ID>.okta.com (without the http://). For example, trial-6093533.okta.com.
- Click Create to create a connection to Okta.
You created a connection to Okta.
The flow will run when a user is created.
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:
- Click Save to save changes.
- Open the Flow is OFF button and toggle it to turn it on.
Turning the flow on.
Test the flow
To test the flow, create a user in Okta.
Create a user
- In the Admin console, go to Directory > People.
- Click Add person to create a new user.
- Enter data for the First name, Last name, and Username.
- Click Save to create a new user.
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:
Flow execution.
The new user data is a JSON object. To view the user details, click the arrows to expand the JSON data:
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
- Switch back to the Flow page in Workflows.
- In the Then do this step, click Add function.
- Select the Text category and then the Compose function.
The flow looks like this:
Flow with the Compose card.
- Inside the Compose card, enter New user created:.
Compose card.
Pass data to the Compose card
You need to add the person’s name and email to the message.
- In the User Created card, find the Okta User object field.
- Take the Display Name field and connect it to the Compose card (after the created:)
- Enter a comma (,).
- 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.
Passing data to the Compose card.
The flow with the Compose card:
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.
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
- Click Add app action to select a connector.
- Find and select the Office 365 Mail connector. You can search for the connector.
- Select the Send Email action from the action list.
Set up a connection to Office 365 Mail
- Click + New Connection to start setting up a connection.
- Keep the Office 365 Mail for the Name field.
- For Description, enter Workflows connection to Office 365 Mail.
- Click Create.
- Follow the steps to sign into your Office 365 account.
The flow with the Office 365 Mail – Send Email card:
Flow with the Send Email card.
Pass data to the Send Email card
- Enter an email you can check in the To field.
- Enter New Okta User for the Subject field.
- Connect the output field from the Compose card to the Body field in the Send Email card.
Flow with the Send Email card.
The Send Email card doesn’t use the CC, BCC, Message Type, and Attachments fields. To hide these fields:
- Click the ⚙️ > Choose fields in the lower right corner.
- Uncheck the fields you don’t need to show on the card.
- Click Save.
The flow with only the To and Body fields on the Send Email card:
Flow with the Send Email card.
Test the Send Email card
To test the Send Email card:
- Click the ▶️ in the lower left corner on the Send Email card.
- The To and Subject fields are pre-filled. Enter a sample message for the Body field.
- Press Test to test the card.
- 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
- Go to Directory > People in the Admin console.
- Click on a user you want to delete.
- Click on More Actions > Deactivate, then confirm by clicking Deactivate.
- 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:
Send email notification on new event.
- In the Admin console, go to Directory > People.
- Click Add person to create a new user.
- Enter data for the First name, Last name, and Username.
- 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.
Flow execution.
The email message the flow sends:
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.
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:
Send email notification flow.
This tutorial is part of Okta Workflows with Microsoft series:
- Send an Email Notification for a New Okta Event
- Send a Notification to Microsoft Teams for a New Okta Event
- 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 channel on MacAdmins Slack.