Hey @mhautala and @abhilash.gupta.
Thanks for your contribution to our Community. I believe your questions have not been answered in detail so I have come to elaborate with an example.
I can see my colleague Dan has detailed how to do this with YAML here but there were no direct examples for JSON. Please see below for a JSON/directory example.
Using @mhautala 's example above let’s assume we have the following config file in the directory auth0-config/actions/post-login-action.json:
{
"name": "post-login-action",
"code": "post-login-action.js",
"runtime": "node16",
"status": "built",
"dependencies": [
{
"name": "node-fetch",
"version": "2.6.1"
}
],
"secrets": [
],
"supported_triggers": [
{
"id": "post-login",
"version": "v2"
}
],
"deployed": true
}
The corresponding code file is in the same directory as above with filename post-login-action.js
exports.onExecutePostLogin = async (event, api) => {
};
Finally the actual binding to flow is called a ‘trigger’. This file is located in the directory: /auth0-config/triggers/triggers.json (please note that the ‘action_name’ needs to match the ‘name’ of the action as defined above, the ‘display_name’ can be set to change the name on the actual flow)
{
"post-login": [
{
"action_name": "post-login-action",
"display_name": "post-login-action"
}
]
}