Mautic Community Forums

Can Email Content (text, thumbnails, links) be swapped using PHP / API before sending the campaign?

Good day, Everyone.

We have a video entertainment website with a new video coming out every other day, and we would like to automate the notifications about the new content becoming published.

The process is seemingly simple, create an email template, swap out the image, title, description and watch button url and send off the email to all the contacts in a segment. I am currently doing so via my own script but I want to graduate to a proper tool.

Mautic has some API functions to create campaigns. I’m wondering of it’s possible to use API to swap out / insert the content into the email template like the image thumbnail, video title and description, URL to the video prior to sending out the notifications?

We’re looking to automate this process. Currently I do it with my own php + python script and it is running on my own home based server. I am looking to graduate to an existing solution. Mautic’s marketing tools will come in handy later on as well but for now I’d like to automate the email notifications for new videos.

Bump?

There is something called Dynamic Content but from what I see, it looks like it’s just for names, addresses, location data pulled from signup and research data.

Hi @MilesThatch, welcome.

You have full CRUD capabilities on emails via the REST API: https://developer.mautic.org/#edit-email

If you’re looking for something more granular, you might look into using one of the Twig template extension plugins (via RSS potentially?):


Do either of these options work?

This puts me quite a bit closer to setting it up. I’m wondering. I see that there is an option to create a file, like an image. Can that image then be inserted / swapped out in an email I’m creating from a template?

Do I need that TWIG extension to be able to do that?

1 Like

Sorry it took a while to get back to this issue. I don’t suppose you might have any more insight on image swapping?