Get Started
Use the quickstart to write an Action Module and use it from an Action to send logs to an external service.Create an Action Module
To use an Action Module from a specific Action, you first need to create the Action Module and then add/use it in an Action.
- Dashboard
- Navigate to Auth0 Dashboard > Actions > Library then select Modules.
- Select Create Module.
- Enter a Name.
- Select Create.

Add a Secret
Each Action Module can contain secret key/values pairs. Use these to hold sensitive information, such as API Keys, certificates, and values that may change across environments.Extra Step: Repeat the steps to store an
- Dashboard
Let’s store the external service URL as a Secret.
Auth0 adds the Secret to the Action Module Secret list.
- Select the icon from the code editor’s left sidebar.
- Select Add Secret.
- Enter the Name as
SERVICE_URL. - Enter the external service URL at the Value field.
- Select Create.

API_KEY as a Secret that you will send in the headers to the external service in each request.Once you create a Secret, Auth0 never reveals its value. Auth0 encrypts all Secrets and stores them securely.
Use Secrets at the Action Module by typing
actions.secrets.[secret_key].Add Custom Logic
Now, add the following code to your Action Module.
- Dashboard
Add the following code to your Action Module:
Be aware of:
Save the Draft
You can save a draft of your Action Module.
This saves your Action Module without publishing a new version, so it does not affect Actions using it.
- Dashboard
- Select Save Draft.

Publish the Action Module
Once you are satisfied with the Action Module code, it’s time to Publish it.
Auth0 displays the list of Action Module Versions including the draft.You are now able to start using the Action Module in an Action.
- Dashboard
- Select Publish.
Publishing an Action Module takes a snapshot of it at that time and records it as an Action Module Version.
- Select View Version History.

Add the Action Module in an Action
Let’s add the Action Module in an Action.
- Dashboard
- Navigate to Auth0 Dashboard > Actions > Library then select a specific Action.
- Once at the Action Editor, select the icon from the left sidebar.
- Select Add Module.
- Select a Module Name and Version.
- Select Add.

Use the Action Module in the Action
Now, let’s use the Action Module in the Action.
- Dashboard
- Add the require statement.
The require statement references the Action Module with the format actions:[module-name].
- Add the call to
logger.sendLogin the Action function, where you want to send logs.
- Select Deploy the Action.

CheckpointYou should now have a fully functional Action Module being used by an Action.
Advanced Usage
NPM Dependencies
NPM Dependencies
Each Action Module can add/use NPM Dependencies.
Auth0 adds the Dependency to the Action Module Dependency list.
- Dashboard
- Select the icon from the code editor’s left sidebar.
- Select Add Dependency.
- Enter the Name of the NPM package.
- Enter the Version of the NPM package.
- Select Create.

Use the listed Dependencies at the Action Module by requiring them through
require('[package-name]').