Using Filters in Templates

Fomo templates contain sentence structures and merge tags.

They also support something we call filters. This lets you adjust the look and feel of specific notification variables (first_name, city, etc) with a little bit of "syntactical sugar."

Filters are included in your templates by simply adding a "|" (pipe), then a space, then the filter name. Note: you must use a single space between the elements (variable, filter, pipe) for this to work.

Here are a few of our currently supported filters...


{{ variable | number }}

This formats numbers as comma-separated, if more than 3 digits long.


1,234 visitors are looking at this right now


{{ variable | truncate }}

This reduces the variable's length to 30 characters.

However, you may want to specify the exact character length. Example:

Hello, World. My name is Berna...

{{ variable | truncate 15 }}

The '15' parameter represents a custom character length of 15 characters. 


Hello, World. My name is...


Sometimes integrations send data like "XX Pro Plan (Midnight Special)" and all you want to show off is "Pro Plan."

{{ variable | replace [XX Pro Plan (Midnight Special)Pro Plan] }}

Just add the "replace" filter, followed by two "arguments" inside [ ] brackets.

The first argument should be the value you want to replace, then a comma, and the second argument (after the comma) should be the new value to replace it with.


If your variable lengths are unpredictable, you may be unable to use Truncate.

For that reason, we created "trim_before" and "trim_after" filters.


{{ title_with_link | trim_after [ - ] }}

Would convert this product title:

"AX100 Hoverboard - Free Shipping 24x7"

Into this:

"AX100 Hoverboard"

Similarly, trim_before would turn this:

"MIDNIGHT SALE | Gaming Chairs"

{{ title_with_link | trim_before [ | ] }}

Into this:

"Gaming Chairs"

To use the trim_before and trim_after filters, just place your unwanted character "delimiter" inside  [ ] brackets, following the filter name and a space.


{{ variable | color #00f }}
{{ variable | color #0000ff }}

Color codes support 3 or 6 digit hexcodes, and will modify that variable's value only.

Default Fallbacks

{{ variable | fallback [some word] }}

After a variable, space, pipe, and another space, input "fallback" and then your fallback word(s) inside square brackets.


{{ first_name | default [Someone] }} --> "Someone" (if first_name is blank)


{{ variable | bold }} --> Hello, world

Self explanatory. This will bold the variable's value in your notification message.


Suppose your merge variable 'first_name' is "chRis."

{{ variable | propercase }} --> Chris

{{ variable | upcase }} --> CHRIS

{{ variable | downcase }} --> chris


  • {{ time_ago }} does not support filters (yet)

If you have any questions abouut using filters in your notifications, let us know.