Referencing data in templates
Documentation outlining how to work with data in your templates.
In addition to the variables available as part of the workflow run scope, you can also reference data from the users, objects, tenants, and subscriptions that exist within your Knock environment.
Referencing data is a powerful way to share context across entities in your templates without needing to manually pass the data in the data argument of your workflow trigger.
Referencing users via the user filter
#To reference a user, you can use the user filter. This will return a serialized User, which you can then use to output data in your template.
Users returned will have all custom properties available, as well as the id, name, email, phone_number, created_at, and updated_at properties.
Referencing objects via the object filter
#To reference an object, you can use the object filter. This will return a serialized Object, which you can then use to output data in your template. When referencing an object, you'll also need to specify the collection of the object you're loading.
Objects returned will have all custom properties available, as well as the id, collection, created_at, and updated_at properties. Read more about working with objects.
Referencing tenants via the tenant filter
#To reference a tenant, you can use the tenant filter. This will return a serialized Tenant, which you can then use to output data in your template.
Tenants returned will have all custom properties available, as well as the id, created_at, and updated_at properties. Read more about working with tenants.
Referencing subscriptions via the subscriptions filter
#To reference the subscriptions for a user, you can use the subscriptions filter. This filter loads up to 25 active subscriptions for the given user and returns a list of serialized subscription objects.
Each subscription returned includes the object the user is subscribed to, along with any custom properties set on the subscription. You can iterate over the results to render subscription-specific content in your templates.