Referencing data in templates

A guide for working with data in your templates.
🚧
Referencing entity data via Liquid is currently in beta. If you'd like early access, or this is blocking your adoption of Knock, please get in touch.

In addition to the variables available as part of the workflow run scope, you can also reference data from the users, objects, and tenants 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.


Frequently asked questions