Triggers

You can configure triggers in config.json file. Here is an example of a trigger, which registers a script to run when a new user completes registration. You can also specify modules for your script:

config.json
{
  "triggers": [
    {
      "on": "user-registered",
      "action": "initUserInMessembed",
      "modules": {
        "messembed-sdk": "^0.4.2",
        "axios": "latest"
      }
    }
  ]
}

Here triggers is an array of triggers:

Trigger configuration

Description

on

The event on which trigger should run. At the moment only user-registered event is supported.

action

The name of the script to run. File with the script should be stored in the actions folder in the root directory. Only JavaScript files can be used as actions, e.g initUserInMessembed.js

modules

NPM modules that your script requires. Authembed will manage to provide your script with all required modules.

Last updated

Was this helpful?