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

**URL:** <https://forum.mautic.org/t/can-email-content-text-thumbnails-links-be-swapped-using-php-api-before-sending-the-campaign/16011>\
**Category:** General Discussion\
**Created:** [September 9, 2020, 6:40pm UTC](https://forum.mautic.org/t/can-email-content-text-thumbnails-links-be-swapped-using-php-api-before-sending-the-campaign/16011 "2020-09-09T18:40:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MilesThatch](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/milesthatch/32/422_2.png) [@MilesThatch](https://forum.mautic.org/u/MilesThatch)\
**Post date:** [September 9, 2020, 6:40pm UTC](https://forum.mautic.org/t/can-email-content-text-thumbnails-links-be-swapped-using-php-api-before-sending-the-campaign/16011/1 "2020-09-09T18:40:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MilesThatch](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/milesthatch/32/422_2.png) [@MilesThatch](https://forum.mautic.org/u/MilesThatch)\
**Post date:** [September 23, 2020, 5:35pm UTC](https://forum.mautic.org/t/can-email-content-text-thumbnails-links-be-swapped-using-php-api-before-sending-the-campaign/16011/2 "2020-09-23T17:35:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![peterg](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/peterg/32/1447_2.png) [@peterg](https://forum.mautic.org/u/peterg)\
**Post date:** [September 25, 2020, 11:15am UTC](https://forum.mautic.org/t/can-email-content-text-thumbnails-links-be-swapped-using-php-api-before-sending-the-campaign/16011/3 "2020-09-25T11:15:30Z")

</div>

Hi @MilesThatch, welcome.

You have full CRUD capabilities on emails via the REST API: [https://developer.mautic.org/#edit-email](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?):

> **[Logicify/mautic-advanced-templates-bundle](https://github.com/Logicify/mautic-advanced-templates-bundle/issues)**
>
> Plugin extends default email template capabilities with TWIG block so you can use advanced scripting techniques like conditions, loops etc - Logicify/mautic-advanced-templates-bundle

  

> **[Twig Templates for Mautic](https://mtcextendee.com/marketplace/twig-templates-for-mautic/)**
>
> Buy now one domain license / 39€ – buy nowunlimited license / 169€ – buy now Buy now one domain license / 39€ – buy nowunlimited license / 169€ – buy now

Do either of these options work?

---

<div class="post-metadata">

**Author:** ![MilesThatch](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/milesthatch/32/422_2.png) [@MilesThatch](https://forum.mautic.org/u/MilesThatch)\
**Post date:** [December 5, 2020, 7:49am UTC](https://forum.mautic.org/t/can-email-content-text-thumbnails-links-be-swapped-using-php-api-before-sending-the-campaign/16011/4 "2020-12-05T07:49:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MilesThatch](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/milesthatch/32/422_2.png) [@MilesThatch](https://forum.mautic.org/u/MilesThatch)\
**Post date:** [December 9, 2020, 6:42pm UTC](https://forum.mautic.org/t/can-email-content-text-thumbnails-links-be-swapped-using-php-api-before-sending-the-campaign/16011/5 "2020-12-09T18:42:28Z")

</div>

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