Liquid templates

Liquid is an open-source template language, originally created by Shopify and now used by many other apps.

In Userflow, Liquid templates are used in a few places to allow for highly custom logic. Liquid templates can generate dynamic values, based on user attributes, the current page, and control flow statements such as if and case/when.

Example use cases:

  • An AI Assistant can be provided with instructions tailored to the user (e.g. a “company type” attribute).
  • A resource center’s knowledge block’s Default search query field can be used to perform a different search based e.g. on the current page, in order to make the right articles show up under Suggested articles.

See also official Liquid documentation

Userflow context variables

When Liquid templates are rendered, e.g. when the instructions for the AI Assistant is being used, they have access to a few built-in variables which provide information about the user.

You can add user/company attributes to your template by enclosing them in double curly braces.


Contains the URL of the page the user is currently on, if the template is used in the context of an actively visiting user.


Contains an object with all the user’s attributes. Access a user attribute as:

{{ user.example_attribute }}


Contains an object with all the user’s current company/group’s attributes. Access a company/group attribute as:

{{ group.example_attribute }}

The term “group” is used here because it is the technical term we use for companies, just as you call in Userflow.js to associate a user with a company/group.


Contains an object with all the attributes of the membership between the user and the current company/group. Access a membership attribute as:

{{ group_membership.example_attribute }}

Userflow custom filters


<url> | url_matches: <pattern>

Returns true if <url> matches the <pattern>.

We use the same rules as in our Current page conditions. See the URL pattern matching guide.


page_url | url_matches: '/projects/:id'

Will return true for and false for

If you want a template to return a single value based on multiple different URL patterns, you need to first assign the result of url_matches to a local variable, since Liquid does not support filters in if or case statements.

{% assign is_projects = page_url | url_matches: '/projects*' %}

{% assign is_themes = page_url | url_matches: '/themes*' %}

{% if is_flows %}
{% elsif is_themes %}
{% else %}
  fallback value
{% endif %}

Got questions? We're here for you!

The best way to get help is to
We usually reply within 5 minutes
You can also send an email to
We usually reply within a few hours