How to configure the system process for sending event notification emails to users
  • 02 Dec 2022
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

How to configure the system process for sending event notification emails to users

  • Dark
    Light
  • PDF

List of Corezoid events for which notification emails are sent

There are seven types of system messages in Corezoid:

  • Password recovery;
  • Registration confirmation;
  • Invite a user to a company;
  • Object sharing;
  • Changing a user's password;
  • Object download;
  • Task download;
  • Task upload error.

After installing the system, you need to create and configure a process that sends these system messages. You can configure the process to send all types of messages or only some of them.

Depending on the action, an object with different parameters is sent to the process, among them there will always be two mandatory parameters:

  • type - email type;
  • recipients : [{email}] - users’ emails for mailing.

Optional parameter:

  • lang - user language - depending on it, you can prepare email templates in different languages. If a user has not selected a language, the default value will be lang = en:
Message Task parameters
Password recovery
  • type = password_recovery
  • recipients = [{email}]
  • url - link for a password recovery
Registration confirmation
  • type = confirm_registration
  • recipients = [{email}]
  • url - link for registration confirmation
  • nick - username
  • lang - user language
Invite a user to a company
  • type = invite
  • recipients = [{email}]
  • company_name - if a user was invited to a specific company (not to My Corezoid), then the name of this company will be among the parameters
  • url - link for confirming an invitation
  • lang - user language
  • login - inviter login
Object sharing
  • type = share
  • recipients = [{email}]
  • company_name - if a shared object was created in a specific company, then the name of this company will be among the parameters
  • url - link to a shared object
  • lang - user language
  • login - inviter login
  • obj_type - shared object type (possible values: conv, folder, dashboard, instance, config)
  • obj_name, object_name - shared object name
  • obj_id - shared object ID
Changing a user password
  • type = expire_password_notify
  • recipients = [{email}]
  • reset_password_url - link to password reset
  • secs_to_expire - seconds until a password expires
Object download
  • type = download_complete
  • recipients = [{email}]
  • action_type = download (default)
  • obj_type = downloaded object type (possible values: folder, conv, dashboard, instance, config, alias, project, stage, version, api_gateway)
  • subject - default email subject
  • body - default email text
  • obj_id - downloaded object identifier
  • title - downloaded object name
  • create_time - download link creation date
  • url - download link
Task download
  • type = download_complete
  • recipients = [{email}]
  • action_type = download (default)
  • obj_type = file_download (default)
  • subject - default email subject
  • body - default email text
  • obj_id - ID of a process from which the task was loaded
  • title - process name
  • create_time - download link creation date
  • url - download link
  • proc = ok - system parameter
Task upload error
  • type = upload_complete
  • recipients = [{email}]
  • action_type = upload (default)
  • obj_type = task (default)
  • subject - default email subject
  • body - default email text
  • conv_id - ID of a process to which the task failed to upload
  • name - process name
  • create_time - creation date of the link for downloading the error file
  • url - link for downloading the error file
  • proc = ok - system parameter

Process example

image.png

  1. Add a Condition node after a Start node (1). In the Condition node, configure branching conditions for sending two types of messages: Invite a user to a company (type = invite) and Object sharing (type = share);

  2. Add an API Call node (2.1, 2.2) for every message type.
    Example of API Call node configuration:

image.png

  1. You can add an array processing sequence if an email has to be sent to multiple users;
    3.1 After the Condition node (1), add a Code node that will process the array of emails and decrease it each time a task is passed through this node (3). Paste the following code into the code editor (language: JavaScript):
if (data.index == undefined) {
    data.index = 0;
} else {
    data.index = data.index + 1;
}
data.length_recipients = data.recipients.length - 1;
data.email = data.recipients[data.index].email;

3.2 Connect the Code node (3) to the API Call node (2.2);
3.3 After the API call node (2.2), add another Condition node (4) to check the length of the array:

image.png

3.4 Connect the API Call node (2.2) to the Condition node (4):

image.png

  1. Also, you can separate the sequence of sending emails that notify on downloading various objects and make object-specific texts for them.
    To do this, add additional constituent conditions to node 1, and add the following nodes to the process: 2.3, 1.4, 2.4:

image.png

You can supplement the process with individual sequence of nodes necessary for sending emails.

Adding a process ID to the settings

After completing the process configuration, add the process ID to the capi_user_notify_conv setting of the Superadministrator menu, Settings section. To do that, open the Superadministrator menu:

image.png

Open the Settings and scroll to the capi_user_notify_conv setting and enter the process ID in the setting field:

image.png