Variables
A reference guide for the variables available in the template editor.
When you build workflows in Knock, we auto-generate certain pieces of state (as a result of batch functions and other workflow steps) that you can use to control the copy you display to your end users in your notification templates.
Variable | Description |
---|---|
activities | A list of the activity objects included within the batch, where each activity equals the state sent across in your trigger call, and also includes the actor who performed the message and a timestamp of when the activity occurred. |
actor | A serialized Recipient of the actor that triggered the workflow (may be null ). Will include any custom properties set. |
actors | A list of up to 10 of the unique actors included within the batch. |
current_message | A serialized CurrentMessage (see below). |
data | The complete data passed to the workflow trigger. |
recipient | A serialized Recipient of the recipient of the workflow. Will include any custom properties set. |
tenant | A serialized Tenant (see below) which is set when a tenant is passed to the workflow trigger. |
timestamp | The time in which the activity occurred, as an ISO-8601 datetime string. |
total_activities | The count of activities associated with a workflow run. |
total_actors | The count of unique actors associated with a workflow run. |
vars | Account and environment-specific variables. |
workflow | A serialized Workflow (see below). |
🌠
Note: all of the
data
supplied to your workflow trigger is always available for use in your template under the data
key.Recipient (User or Object)
A serialized User
or Object
. The properties available are:
Variable | Description |
---|---|
__typename | Either User or Object |
id | The id of the recipient |
collection | The collection of the object (only set for Object recipients) |
* | Any custom properties set |
created_at | A datetime field for when the recipient was created (if set) |
updated_at | A datetime field for when the recipient was last updated |
subscription | An optional set of properties set on a subscription . Only available when a workflow is triggered via a Subscription. |
schedule | A serialized Schedule including the id , last_occurrence_at , and next_occurrence_at of the schedule. Only available when a workflow is triggered via a Schedule. |
preferences | The preference set for the recipient. Will contain a completely resolved PreferenceSet object, including tenant and environment defaults. |
Activity
A serialized Activity
, which represents a workflow trigger for the recipient. Activities may be accumulated during a batch operation. The properties available are:
Variable | Description |
---|---|
id | The unique id of the activity |
* | Trigger data sent that generated the activity |
inserted_at | The datetime of when the activity was generated |
updated_at | The datetime of when the activity was last updated |
CurrentMessage
Provides access to the currently generated Message
that the template is rendered against. The properties available are:
Variable | Description |
---|---|
id | The id of the message |
inserted_at | The datetime of when the message was created |
updated_at | The datetime of when the message was last updated |
Workflow
Provides access to serialized properties about the currently executing workflow. The properties available are:
Variable | Description |
---|---|
id | The id of the version of the current workflow |
key | The unique key of the workflow |
categories | A list of categories set for the workflow |
Tenant
A serialized Tenant
. The properties available are:
Variable | Description |
---|---|
id | The id of the tenant |
* | Any custom properties set on the tenant |
created_at | A datetime field for when the tenant was created (if set) |
updated_at | A datetime field for when the tenant was last updated |