Skip to main content
Version: 2024.4

Send Notification and/or Email

This automation action allows to send a notification or email to specified users. It can be configured to send the data from previous steps or step environment variables.

Available Context

For more information on context limitations refer to the Available Context section.

Multiselect: Yes Elements: Data Objects, Assets, Documents

Configuration Options

# (Required) Array of usernames or role names. 
recipients:
- 'recipientUser'

# Array of the channels to be used.
channel_type:
- 'notification'

# (Required) Twig template which will be used as a notification/email subject.
subject_template: |
New objects with type - {{ environmentData.ObjectType }} were generated.

# (Required) Twig template which will be used as a notification/email body.
content_template: |
Variants with this data <br> {{ context.variantData|raw }} <br> has been successfully generated.

Detailed Configuration Options

  • recipients: Required array of usernames or role names. When role name is provided, notification/email will be sent
    to all users with that role.
  • channel_type: Array of the channels to be used. Default: email. Supported values: notification, email
  • subject_template: Required twig template which will be used as a notification/email subject. It has access to the job run context passed as context and environment_variables passed as environmentData.
  • content_template: Required twig template which will be used as a notification/email body. It has access to the job run context passed as context and environment_variables passed as environmentData.

Examples

This example sends a Pimcore notification to a user with the username recipientUser, if the variants were successfully generated in the previous step (this of course depends on how the data is stored by the previous step into the job run context).

It will also incorporate the object type of new variants in the subject template and the variant data in the content template.

step_implementation: send_notification
configuration:
recipients:
- 'recipientUser'
channel_type:
- 'notification'
subject_template: "New objects with type - {{ environmentData.ObjectType }} were generated"
content_template: "Variants with this data <br> {{ context.variantData|raw }} <br> has been successfully generated."

This example sends a Pimcore notification and an email to a user with the username recipientUser and additionally to users with the role newUserRole.

It will also incorporate the object type of the new variants in the subject template and the variant data in the content template.

step_implementation: send_notification
configuration:
recipients:
- 'recipientUser'
- 'newUserRole'
channel_type:
- 'notification'
- 'email'
subject_template: "New objects with type - {{ environmentData.ObjectType }} were generated"
content_template: "Asset with ID {{ context.processed_assets[0] }} has been successfully assigned to the data objects."

This example shows how to use selected elements for the twig template.

step_implementation: send_notification
configuration:
recipients:
- 'recipientUser'
- 'newUserRole'
channel_type:
- 'notification'
- 'email'
subject_template: "New objects"
content_template: "Elements in context: {% for el in selectedElements %} {{ el.getId() }} {% endfor %}"
warning

If the user has no email address in his profile the email will not be sent.