Working with another backend?

I am evaluating a dynamic email system that can render email html based on some templateId + data from another backend. While playing around with Foundations for Email, so far the only way I have seen this work in the wild is by creating a .json file under src/data folder using the data from the backend request, and then generating the html output. Is this the only way to generate dynamic emails?

See: https://github.com/kairos666/inky-email-render-to-string/blob/973cced881abeb133b25de86a2a2ffc379dbec46/index.js.

This is what I envision the workflow to be:

  1. A backend sends templateId + data as request
  2. The email microservice picks the correct template based on the template Id.
  3. Passes on the data to this template
  4. Render the html output at runtime and return a response.

Do you guys have any examples of making this work using Foundation for Emails?

Thanks,
Sumit Singh

Hi, so far Foundation Emails was not meant to be so dynamic or process data by users of an application. Because this also means that there is user controlled data which can create vulnerabilities and cause other security related issues.

I would not recommend this because this means users can run commands in Node and there are often vulnerabilities for example in handlebars and other devDependencies.

If you want to do it like this, the solution that you describe is a valid way to solve it but I would not recommend it.