Once activated, a trigger initiates one or more Actions. Actions are the automated tasks that occur in response to a trigger.
Types of Actions
- Email Notification: Sends an automated email to specified recipients.
- Webhook: Sends data to an external system or endpoint, allowing integration with other applications.
Email Recipient Options
For flexibility, users can choose recipients based on different criteria or even use a combination of these options to cover all necessary contacts:
- User Type: Choose recipients based on their role or association with the triggered record. Example: "Sample Owner"
- User Name: Select specific individuals within your group or team by their usernames.
- Direct Email Address: Enter specific email addresses directly, like `user@example.com`, if the recipients are external stakeholders or not directly associated with the record.
Configuring a Webhook Action
A Webhook action allows users to send data to an external URL, enabling integration with other applications or platforms. Currently, the webhook action only supports POST requests, which means data will be sent as a payload to the specified endpoint.
Setting Up a Webhook
- In the Actions section, select Webhook.
- Enter the URL of the external endpoint where you want to send the data.
- Customize the Payload as needed, depending on the data structure required by the receiving system. Note: Since only POST requests are supported, ensure that the endpoint is configured to accept and process POST requests.
- Save the action.
Example how to set up a Slack Webhook:
Follow steps at https://api.slack.com/messaging/webhooks
A URL will be given similar to this: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Paste the URL into the Webhook URL field
Using Smart Values in Emails
To make email notifications more informative and tailored, users can use Smart Values to dynamically include specific details about the triggered item in their emails. Smart Values are placeholders that automatically populate relevant data, such as sample names, creation dates, expiration dates, etc.
Accessing Smart Values via the Command Palette and "See All Attributes" Link
- In the **Email or Webhook Action** configuration, navigate to the **Body** section where you write the email message.
- Start typing `{{` to open the **Command Palette**. This will display a list of available variables related to the item being triggered.
- Select a Smart Value from the list to insert it directly into your email content. Example: Typing `{{` and selecting `{{sample.expiresOn}}` will insert the expiration date of the sample into the email, making it specific to each sample that triggers the email.
- Alternatively, click the "See All Attributes" link to view the full list of available Smart Values in one place. This can be helpful for quickly finding the exact attribute you need without typing. Example: Clicking "See All Attributes" allows you to explore all possible variables like `{{sample.description}}`, `{{sample.createdBy}}`, and `{{sample.externalBarcode}}` and directly select the ones that fit the email content needs.
eLabNext Tip: Users can add multiple Smart Values within a single email. For instance, "Sample {{sample.name}} stored in compartment {{sample.compartment}} is set to expire on {{sample.expiresOn}}." This provides personalized details for each email, saving time and reducing errors.
Each Smart Value will be replaced with actual data at the time the email is sent, so each recipient receives a relevant, detailed notification.
Setting Up Scheduled Automations with Multiple Items in One Email
When setting up Scheduled Automations (such as daily notifications for items reaching expiration), the system groups multiple items into a single email. To handle this correctly, users must use a special syntax to define a loop that iterates over each item, ensuring that all relevant items appear in the email as individual entries.
Loop Syntax for Multiple Items
To create a loop, users must wrap the repeated content within `{{#items}}` and `{{/items}}`. Any variables inside this loop will be repeated for each item that matches the trigger criteria. This is useful for emails listing all samples that meet the scheduled condition (e.g., samples expiring soon).
Syntax for Repeating Content:
`{{#items}} Your repeating content here with variables. {{/items}}`
Example Email Template for Scheduled Triggers
Suppose you want to send a daily notification for all samples that will expire on the current day. Here’s how to set up the email body using the loop syntax:
`Action required within eLabNext. This email is to inform you that the following samples are going to expire soon: {{#items}} Sample {{sample.name}} (ID: {{sample.ID}}) will expire on {{sample.expiresOn}}. Owned by: {{sample.ownedBy}} {{/items}} Please review these samples and take the necessary actions.`
In this example:
- The section wrapped within `{{#items}}` and `{{/items}}` will be repeated for each sample meeting the expiration condition.
- Each instance of `{{sample.name}}`, `{{sample.ID}}`, `{{sample.expiresOn}}`, and `{{sample.ownedBy}}` will be populated with the actual data for each sample that is set to expire.
Sample Output
If three samples are expiring today, the email content might look like this:
`Action required within eLabNext. This email is to inform you that the following samples are going to expire soon: Sample Vaccine A (ID: 12345) will expire on 2024-11-01. Owned by: Dr. Smith Sample Protein B (ID: 67890) will expire on 2024-11-01. Owned by: Dr. Johnson Sample Antibody C (ID: 54321) will expire on 2024-11-01. Owned by: Dr. Lee. Please review these samples and take the necessary actions.`
Each sample entry appears as a new line, ensuring clarity for the reader.
Additional Tips for Customization
- Customizing Headers and Footers: Place any static text, such as the greeting or action instructions, outside the `{{#items}} ... {{/items}}` block. This text will only appear once in the email.
- Additional Variables: You can add more variables inside the loop, such as location or quantity, depending on the information you want included for each item.
- Important: Always use `{{#items}}` and `{{/items}}` to ensure each item’s details are displayed individually in the list. Without this wrapping, the email will not display variable values.