Is it possible to format numbers in HTML email templates? | Community
Skip to main content
Answered

Is it possible to format numbers in HTML email templates?


I am building an HTML email template to display a variety of statistics. The statistics are in different formats such as percents and currency values. Is it possible to format a decimal as a percent in an HTML Template? 

Decimal Example:

Value: .9856

Display Value (in template): 98.56%

 

Currency Example: 

Value: 4578.19

Display Value (in template): $4,578.19

 

Based on your provided documentation, the only way to format numbers appears to be as a decimal or integer. Are there other formats that are acceptable? 

Best answer by Jacques Reynolds

Hey ​@Antonia Villa ðŸ‘‹ Jacques here from Intercom Support. I hope all is well today!

You're correct that the templating engine currently supports |integer and |decimal filters for number formatting, as documented.

Unfortunately, there isn’t built-in support for percentage or currency formatting directly within Intercom’s templating syntax (e.g. there's no |percent or |currency filter at this time).

Here’s what you can do as a workaround:

  1. Pre-process the number before passing it into the template (e.g. multiply .9856 by 100 and format to two decimal places: 98.56)
  2. Then, append the % symbol manually in your template:

For currencies like $4,578.19, you’ll need to format the number (with commas and decimals) before passing it to the template and include the currency symbol in the value itself.

Hope this helps!

View original
Did this topic help you find an answer to your question?

2 replies

Diana Tripac
Intercom Team
Forum|alt.badge.img+3
  • Senior Community Program Manager @Intercom
  • 163 replies
  • January 9, 2025

👀 Adding ​@Milan â€‹@Nathan Sudds  in case they have any ideas on that 💪


Jacques Reynolds
Intercom Team
Forum|alt.badge.img+7

Hey ​@Antonia Villa ðŸ‘‹ Jacques here from Intercom Support. I hope all is well today!

You're correct that the templating engine currently supports |integer and |decimal filters for number formatting, as documented.

Unfortunately, there isn’t built-in support for percentage or currency formatting directly within Intercom’s templating syntax (e.g. there's no |percent or |currency filter at this time).

Here’s what you can do as a workaround:

  1. Pre-process the number before passing it into the template (e.g. multiply .9856 by 100 and format to two decimal places: 98.56)
  2. Then, append the % symbol manually in your template:

For currencies like $4,578.19, you’ll need to format the number (with commas and decimals) before passing it to the template and include the currency symbol in the value itself.

Hope this helps!