At the moment, when using the API to create a new email (/emails/new) you only have the option to send “customHtml” and “plainText” and there is no option to send the email content as MJML. As we changed our base template from HTML to MJML for the new editor, we now have to go back to the old HTML version for an email we want to send via the API.
Therefore, either allow MJML to be sent in the “customHtml” field and interpreted or add a new field for “customMJML” to the create email API endpoint.
I think these groups of people would benefit from this idea:
Anyone with MJML template(s).
Why I think they would benefit from this idea:
They could use the same template code for both templates and emails created via the API.
That isn’t what I mean, I meant sending an email to Mautic as “custom” MJML, like you can do with the customHtml field. I’ve tested this, but sending MJML in the customHtml field and that doesn’t work.
I’ve just looked at the docs again and maybe you are thinking about the /emails/ID/contact/CONTACT_ID/send endpoint, to send template emails to users and not emails/new to create a new email.
Hi,
No, I was thinking about /api/emails/new, which is a way to create a new email via API.
It does work perfectly with html, and I had the impression, I can do the same with MJML. I only have to use an mjml compatible base template in 'template' value I’m posting with the api call.
Man, I was wrong.
I also realized the lack of understanding I have for MJML templates. Only the “translated” html is stored in the emails.custom_html, the actual mjml code is in bundle_grapesjs.custom_mjml.
In order to make this happen, we would need to ‘inject’ the code right here via API and run the translator to create a html version of that mjml on the fly.
If I’m understanding you correctly, the Mautic API receives the MJML code but is not able to transport it correctly into the MJML template. Is that correct?
I can easily “translate” MJML to HTML, even GPT can do this quite easily in-line in automation workflow, and send to API. But then the limitations of HTML come to life, and defeats the purpose of MJML altogether.
How did Chimpino make this app? This actually works as we’re discussing here, although it erases any existing content and rebuilds from empty template, injecting the generated copy into the template. It does however work with MJML.
Might be a starting point? Maybe @escopecz has thoughts…
I’ll help anyway I can, just let me know. I’m “all hands and no thumbs” with a lot of this dev stuff, but if you need a solution that’s more like the proverbial slap and less like surgery, you know where to ask.