Dynamic image in API triggered email campaign | Community
Skip to main content
October 22, 2024
Question

Dynamic image in API triggered email campaign

  • October 22, 2024
  • 1 reply
  • 836 views

Dear,

We are creating an API triggered campaign email, where the trigger includes a series of context attributes to make the content of the email dynamic and personalized.


There is one content block with an image that would need to be dynamic, based on a given context attribute from the trigger's payload (e.g. show an image of a dog if the context attribute value is "dog", or a cat if the value is "cat".

However, each image is stored on a location and has a random URL, so we cannot make that URL dynamic based on the attribute received in the trigger's payload (i.e. www.example.com/animal/{{animal_name}} would not work).

Given we have 90 different images with a random URL that can potentially be displayed based on that attribute, we can not map each image url to each context attribute value within the HTML, as that would make the content way too heavy.

How would you make that work?

 

Kind regards,

Stephan

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

DavidKangni
Community Advisor
Community Advisor
October 22, 2024

Hi @stephandi1 

 

For the images, you can add their URLs in the html as following

 

 

<td align="left" valign="middle" style="padding:10px;color:#222222;font-family:Arial, Helvetica, 'sans-serif';font-weight:bold;font-size:12px;width:15%;"> <a href="{{prod.productUrl}}" class> <img src="{{prod.productImgUrl}}" width="80" border="0"> </a> </td>

 

If not working, then you have to use replace in helper functions

{%= replace(prod.productUrl,/^https?:\/\//,'') %}

 

FYI the first one directly is working for me 

Thanks,

David

 

 

David Kangni
October 23, 2024

Hi David,

 

Thanks for trying to help. 

However this is far from the response I was expecting, as this only explains how to add an image and completely omits the issue at hand.

I won't reexplain the context, as I feel my original post is already detailed enough. Could you or a colleague read through it again and provide an appropriate response?

Kind regards,
Stephan

DavidKangni
Community Advisor
Community Advisor
October 23, 2024

Just FYI, this is just a community. We are not Adobe employee nor paid to help and we're helping other community members the best we can on our personal time.

 

If you have an issue and not find answers on the community convenient, reach out to Adobe Consulting Service or any Adobe partner.

 

Thanks,

David

David Kangni