Text templating node


I’m creating Slack messages based on a different data inputs, so the expression used becomes kinda hard to read/write. There are times where I want to have if/else blocks depending on the incoming data etc. I imagine could be useful when composing emails and such too.

Is there a better way of doing this now other than just using the build-in expressions?

Would it be useful to have a node for explicitly generating the text, then the Slack node would just do the slack stuff and testing becomes easier too (then I don’t have to spam the Slack channel to test everything).

If n8n had been a Python project I would have suggested to use Jinja2.

It would also be awesome if the node would allow me to test the template with different input objects too.

That should be possible with for example the Set-Node unless I understand you wrong.

It looks like Nunjucks is a viable alternative to Jinja2. I wonder if there is an enterprising community member that would be interested in taking up the challenge of creating a Numjucks node?

Nunjucks looks very interesting! But am not sure if a specific node would be the best here as I can see that it can be helpful on very many different nodes. Meaning making something like it available generally in expressions could be easier and would avoid making workflows unnecessarily more complicated by having to add additional nodes to use it.


@jan, I never even thought about using templating as a base structure within n8n. Makes a lot of sense.

I know I have used other tools in the past that used mustache for a templating engine and it was very easy and intuitive to use. If n8n were to go beyond the scope of a simple node, then I would suggest taking a look at a few different templating systems before moving forward (like you didn’t have enought to do, @jan) .

Here is a list of a few common ones:


Thanks a lot @Tephlon for that great list. Will make researching options much easier and faster.

1 Like

I think having a special node would be a good thing, but it doesn’t have to be either or.

  1. It would only be used when a more power-full templating system than the build-in n8n expressions can give and and 2) the other nodes can be simpler as they don’t have to think/know about the more advanced templating features.


I just created a PR with a Text Template Node. For now, it implements mustache and handlebar, but could be extended with another engine very quickly.

Hope it is what you were thinking of.


Sounds like it, I’m hoping that it will get merged!

1 Like

I added a comment to the PR.

@erbg Perhaps you can take a look into it.

Btw. posted here a temporary work-around with handlebars: