On this page
Event hook filtering
This guide provides a functional example of an Okta event hook filter. It's based on the Event hook implementation project, which uses the website Glitch.com (opens new window) to act as an external service. This service receives and responds to Okta event hook calls.
Note: Event hook filters is a self-service Early Access (EA) feature. See Manage Early Access and Beta features to enable. If you want to disable this feature, it’s recommended to first remove all event filters.
- Understand the Okta event hook calls and responses with a filter implementation.
- Implement a functional example of an Okta event hook filter with a Glitch.com project.
- Test the Okta event hook filter.
What you need
Event hook filters reduce the amount of event hook calls to your external service endpoint. The filter triggers hooks only for events based on the logic that you define. You can implement one or more filters for your event hook and apply them when creating a hook or apply them later. See Event hooks.
This guide uses the website Glitch.com (opens new window) to act as an external service and to implement the event hook with an Okta org. See the following Glitch project to remix (copy) a functional code example that implements an event hook when a user is added to a group: Okta Event Hook with Filtering (opens new window).
Review Event hook implementation to understand how to receive and parse the event hook call in your code. After copying the project, go to the following section to create an event hook with a filter.
The Glitch event hook example uses the Okta event triggered when a user is added to a group. This event hook triggers for every instance of a group addition. With event hook filters, you can create business logic, using the Okta Expression Language, to isolate only certain group additions that trigger the event hook. In this example, only users added to the Sales group trigger the event hook.
Sign in to your Okta org (opens new window).
From the Admin Console, go to Workflow > Event Hooks.
Click Create Event Hook.
In the Endpoint URL field, add your external service URL, including endpoint. For example, use your Glitch project name with the endpoint:
In the Event Hook Name, add a unique name for the hook (in this example, "User added to Sales group event hook").
In the Customize request section, include authentication field and secret. In this example, use Basic Authentication:
Authentication field =
Authentication secret =
In the Select Events section, subscribe to the event type you want to monitor. In this example, a user added to a group. Click in the field to search for
User added to group.
Click Create hook & Continue.
In the Apply filters section, select the Apply filter checkbox.
Create the example filter by selecting the following values in the Simple UI:
Click Add Another:
Click the User Okta Expression Language (advanced) link to review the Okta Expression Language statement:
event.target.?[type eq 'UserGroup'].size()>0 && event.target.?[displayName eq 'Sales'].size()>0.
This statement triggers an event hook request to your external service when a user is added to the Sales group (the statement is TRUE). Other additions to different groups don’t trigger an event hook.
Note: Review the Okta System Log (from the Admin Console, Reports > System Log) to create expressions that target your real-world event data.
Click Save & Continue.
In the Preview section, click Skip this step.
Note: The event hook preview bypasses the event hook filter. Don’t test your filter with the Preview feature.
Ensure that your Glitch application is listening for your requests, and then click Verify to complete the one-time verification step. See One-time verification request.
Note: It may take a few minutes before events are sent to the event hook after it’s created or updated.
In your Okta org, sign in as an administrator and create two groups in the Admin Console.
Go to Directory > Groups, and click Add Group.
Fill in the Name field in the Add Group dialog. In this example, use Sales.
Repeat the process to add a group named Support.
If necessary, create a test user:
Go to Directory > People, and click Add Person.
Fill in the following fields in the Add Person dialog:
Go to your Glitch application and open the log console (Tools > Logs). Ensure that your application is listening for requests.
Return to your Okta org, and search for your test user.
Click the name of the test user's profile.
Click the Groups tab, and click in the search field. Search for the Support group, and click to add.
Search for Sales group, and click to add.
Go to your Glitch application's log console. There should only be the following output in the console:
The user Test User has been added to the Sales group!
The event hook filter only triggers requests for the addition of a user to the Sales group. All other group additions are ignored.
Review the following guides to implement other inline hook examples:
- Password import inline hook
- Registration inline hook
- Token inline hook
- SAML assertion inline hook
- Telephony inline hook
For background conceptual information on event hooks, see Event hooks.