Skip to main content
Notifications are a way to communicate updates, alerts, or information to users or groups. Usually in email format, they are sent by Notification API.

Overview

Notifications in configuration serve multiple purposes, including:
  • Alerting users about changes in workflows.
  • Sending important updates or reminders via email.
  • Inviting a user to take a next action on a trace…

How it works in configuration

The notifications are not directly sent through configuration or the dsl package. They are stored under state.notifications an an array. When performing an action on a trace, Trace API is creating a link and checking state.notifications. If it founds one, it will call Notification API with the correct template. To send a notification, the data might contains variables derived from the state (such as lastActionName, status, etc.). Thus, notifications are usually built and sent inside the effects of an action. The action needs to provide the correct data to the state.notifications, typed as NotificationOptions inside the dsl package :

Notification Options

title
string
The title of the notification.
receiver?
NotificationReceiver
Identifies the user, account, or email to notify.
groupLabel?
string
If filled, it will notify a group. Corresponds to the trace group.label, which is a camelCase string (e.g., traceBot, agreTa).
channel?
NotificationChannel
The notification channel. Defaults to EMAIL.
template?
Template
The template used for the notification layout.
type Template = {
  type?: string; // default 'HTML'
  version?: string; //  default '1.0.0'
  name: TemplateName;
  config: TemplateConfigMap[TemplateName]; // based on TemplateName, can be SchemaFullConfig, SchemaLessConfig, NotifyForAction.
};
Possible values for TemplateName:
enum TemplateName = {
 SCHEMA_FULL: "schema-full";
 SCHEMA_MINIMAL: "schema-minimal";
 SIGNUP: "signup";
 MENTION: "mention";
 EMPTY: "empty";
 NOTIFY_FOR_ACTION: "notify-for-action";
 OFFLINE: "offline";
};
In configuration, usually 3 are being used: SCHEMA_FULL, SCHEMA_MINIMAL and NOTIFY_FOR_ACTION.Please see below to check all available templates.
sender?
NotificationSender
Information about the sender. Defaults to:
  • name: Stratumn
  • issuer: Name of the microservice (e.g., TRACE, OFFLINE).
  • traceId: ID of the current trace.
  • workflowId: ID of the current workflow.
resourceId?
string
Usually the trace ID. Defaults to -9999.
resourceType?
string
The resource type. Defaults to TRACE.
avatar?
string
Optional avatar URL for the notification.
icon?
string
Optional icon URL for the notification.
message?
string
The notification message. Can be empty if template is used.
data?
NotificationData
Custom data associated with the notification, related to attachments.
messageType?
string
The format of the message content. Defaults to MARKDOWN.
priority?
number
Priority flag for ordering notifications in batch emails.
sendEmailImmediately?
boolean
If false, no email will be sent alongside the notification.
templateConfig?
NotificationTemplateConfig
Configuration specific to the selected template.

Email Templates

Schema Full

The schema-full template has a rich HTML structure including metadata, workflow context, trace context, etc. It is the template used when a “Last Action” and “Next Actions” from the trace are mentioned, and if any additional information are provided.

Schema Minimal

The schema-minimal template is a more simple content html structure.

Notify For Action

The notify-for-action template is a notification prompting the user to take an action.