Allow email created via API to be MJML

My idea is:

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.

1 Like

Hello!
Have you tested this feature with an MJML template as base template for the API call?
I think this is already working.
Joey

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.

Joey

2 Likes

Hi there, is there any progress on this?

Nope, still only HTML.

Still confirmed not working with mjml :-(.

This is bumming me out that this hasn’t been implemented.

It’s like Mautic grew two extra arms but they forgot to give them thumbs.

We’re 90% of the way there, let’s go the extra 10% or?

How can we make this happen?

@joeyk @mikew @jonnitto @da644
Might as well ping @mzagmajster as well :sunglasses:

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… :thinking:

Watch this space… coming soon

1 Like

Really? Meaning yo are developing it?

1 Like

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.

The suspense is killing me. :thinking: :sweat_smile: @mikew