Controls are defined using JSON Schema or Zod, providing a strong run-time validation system for your workflows.
This ensures that you as the developer and your non-technical peers are speaking the same language. Those responsible for styling and copy can edit with confidence, knowing their changes are tested in code.
Control Schema - For Non-Technical Peers and Developers. Managed in the Novu Dashboard UI, defined by developers and used by non-technical peers.
Payload Schema - For Developers. Passed during the novu.trigger
method, and controlled by the developer.
Step Control schema defines the control passed during the step
method. These controls can be modified and persisted in the Novu Dashboard UI.
The snippet below shows a configuration for the Step Control schema. If you don’t provide a schema, Typescript will infer the data type to unknown
, reminding you of the best practice to specify your schema.
For the full list of parameters, check out the full SDK reference.
To facilitate the use of variables in the control schema, enclose the variable name in double curly braces using the {{variableName}}
syntax. For example, {{subscriber.firstName | capitalize}}
will be dynamically replaced with the actual value of the subscriber’s first name at runtime.
You can use variables in any step control value, whether set by the developer or within the Novu Dashboard UI. To facilitate this, the Novu Dashboard UI offers auto-completion for variables. Simply start typing {{
to view a list of all available variables.
Example for variables autocomplete in dashboard
{{subscriber.firstName}}
payloadSchema
. Example: {{payload.userId}}
{{subscriber.firstName | append: ': ' | append: payload.status | capitalize}}
or
{{payload.invoiceDate | date: '%a, %b %d, %y'}}
will format the date as Thu, Jan 01, 24