Skip to content

Latest commit

 

History

History
206 lines (186 loc) · 5.14 KB

action_triggers.md

File metadata and controls

206 lines (186 loc) · 5.14 KB
page_title description
Retrieve triggers available within actions
Retrieve the set of triggers currently available within actions.

Retrieving the set of triggers available within actions

In this guide we'll show how to retrieve the set of triggers currently available within actions. A trigger is an extensibility point to which actions can be bound.

Get an API Explorer Token

Head to the APIs section of your Auth0 Dashboard and select Auth0 Management API.

get_api_explorer_token_1

Select Create & Authorize Test Application within the API Explorer tab.

get_api_explorer_token_2

Copy the Token contents and go to the Management API Explorer.

get_api_explorer_token_3

Select Set API Token button at the top left.

Set the API Token by pasting the Token that you copied above.

Select Set Token button.

get_api_explorer_token_4

Retrieve the set of triggers available within actions by selecting the Try button at https://auth0.com/docs/api/management/v2#!/Actions/get_triggers.

get_api_explorer_token_5

At the time of writing (2022-10-17) the available triggers are the following:

{
  "triggers": [
    {
      "id": "post-login",
      "version": "v2",
      "status": "DEPRECATED",
      "runtimes": [
        "node12",
        "node16"
      ],
      "default_runtime": "node16",
      "compatible_triggers": []
    },
    {
      "id": "post-login",
      "version": "v3",
      "status": "CURRENT",
      "runtimes": [
        "node12",
        "node16"
      ],
      "default_runtime": "node16",
      "compatible_triggers": [
        {
          "id": "post-login",
          "version": "v2"
        }
      ]
    },
    {
      "id": "post-login",
      "version": "v1",
      "status": "DEPRECATED",
      "runtimes": [
        "node12"
      ],
      "default_runtime": "node12",
      "compatible_triggers": []
    },
    {
      "id": "credentials-exchange",
      "version": "v1",
      "status": "DEPRECATED",
      "runtimes": [
        "node12"
      ],
      "default_runtime": "node12",
      "compatible_triggers": []
    },
    {
      "id": "credentials-exchange",
      "version": "v2",
      "status": "CURRENT",
      "runtimes": [
        "node12",
        "node16"
      ],
      "default_runtime": "node16",
      "compatible_triggers": []
    },
    {
      "id": "pre-user-registration",
      "version": "v2",
      "status": "CURRENT",
      "runtimes": [
        "node12",
        "node16"
      ],
      "default_runtime": "node16",
      "compatible_triggers": []
    },
    {
      "id": "pre-user-registration",
      "version": "v1",
      "status": "DEPRECATED",
      "runtimes": [
        "node12"
      ],
      "default_runtime": "node12",
      "compatible_triggers": []
    },
    {
      "id": "post-user-registration",
      "version": "v2",
      "status": "CURRENT",
      "runtimes": [
        "node12",
        "node16"
      ],
      "default_runtime": "node16",
      "compatible_triggers": []
    },
    {
      "id": "post-user-registration",
      "version": "v1",
      "status": "DEPRECATED",
      "runtimes": [
        "node12"
      ],
      "default_runtime": "node12",
      "compatible_triggers": []
    },
    {
      "id": "post-change-password",
      "version": "v2",
      "status": "CURRENT",
      "runtimes": [
        "node12",
        "node16"
      ],
      "default_runtime": "node16",
      "compatible_triggers": []
    },
    {
      "id": "post-change-password",
      "version": "v1",
      "status": "DEPRECATED",
      "runtimes": [
        "node12"
      ],
      "default_runtime": "node12",
      "compatible_triggers": []
    },
    {
      "id": "send-phone-message",
      "version": "v2",
      "status": "CURRENT",
      "runtimes": [
        "node12",
        "node16"
      ],
      "default_runtime": "node16",
      "compatible_triggers": []
    },
    {
      "id": "send-phone-message",
      "version": "v1",
      "status": "DEPRECATED",
      "runtimes": [
        "node12"
      ],
      "compatible_triggers": []
    }
  ]
}

Use these to set up your supported_triggers block within the auth0_action resource:

resource "auth0_action" "my_action" {
  name    = format("Test Action %s", timestamp())
  runtime = "node16"
  code    = <<-EOT
   exports.onExecutePostLogin = async (event, api) => {
     console.log(event);
   };
  EOT

  supported_triggers {
    id      = "post-login"
    version = "v3"
  }
}