How can I dynamically call an image using a token? | Community
Skip to main content
New Participant
March 5, 2020
Question

How can I dynamically call an image using a token?

  • March 5, 2020
  • 1 reply
  • 5625 views

Hi,

 

I am currently working on an email where the smart campaign is based on source=web api and flow is = send email.

 

Now, In this email we need to pick different profile info( profile or avatar image, level and name )from a clan game.

 

However, I am struck because I do not understand how do we pick dynamic profile images with the help of my.tokens.

 

We want the email to capture the avatar image with name and level like you can see below but I am not sure how to do that.

I was thinking to use multiple tokens like {{my.Avatarpic}}{{my.level:default=X}}{{my.name:default=Ashlee}}but the backend team(api) i am working on is not sure if this will work.

 

The API team said: Please tell how to run this email; with value provided for tokenswhich VALUE should I provide for avatar so it will be dynamically render image of new member.I am very confused here as I have not come across this kind of scenario before.

 

 

 

 

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

1 reply

New Participant
March 5, 2020

Fun problem!

 

You don't want to use program-level {{my.tokens}} here since a person's clan is set at a person level. Unless you have one email per clan or something - but it doesn't sound like that's your scenario. 

 

So if I a person can only have one clan, level, and name at a time then you want this to be written into a person's lead profile. You can do this via API 200 at a time using syncLeads (https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Leads/syncLeadUsingPOST) or via a csv/tsv upload in the Bulk API (https://developers.marketo.com/rest-api/bulk-import/). Either way, you will end up with something like this on each applicable person in Marketo:

 

First Name: Phil

Last Name: Wild

Clan: Example Clan

Level: Level 10

Img: example.com/1.jpg

 

If image is different for each user, put it on the person's record as per above. But if the image is based on clan (and therefore you have, say, only 10 different images) then I would use an inherited email script token from a top level program instead. Something like this:

#if( $clan = "clan1")

#set($image = "imagelocation1.com")

#elseif($clan = "clan2")

#set($image = "imagelocation2.com")

....

and so on. Better ways to do this but you get the idea. 

 

If you then set images at an inherited program level you can use those tokens everywhere, in every email, and if the image location changes you change it in one place. Not in every lead profile. 

--------

 

So overall you can tell your API team that they can either:

 

1) Do a bulk update of all relevant profiles in Marketo before a send, so everyone has the right info; or, ideally,

2) When someone is created, or their clan / details change, then update them in Marketo via the API. That way whenever you send an email their information will always be correct.

 

This is the best solution I can thing of, assuming you don't have an existing Salesforce / MS Dynamics sync that would do all of this automatically. Hope this helps!

SanfordWhiteman
New Participant
March 6, 2020

Should be 

 

#if( $clan.equals("clan1") )

 

though.

 

= won't work, == is buggy, .equals is what you want.

Lopa1408Author
New Participant
March 6, 2020

Thanks for your reply but I am still not clear as to what needs to be done from my end(in marketo)

 

We have some fixed profiles/avatars (say 30-40) for the game so that whenever any new member joins he needs to pick one from them.

My question is how do I define the tokens for the same in the email? Shall I upload all profiles in design studio?

 

We need to populate the profile picture, country, level for each new user who joins which definitely should be dynamic and that's why I thought of using {{my.tokens}}. But how do we capture images through these tokens? Do I need to use multiple tokens for all the criteria that we need?

 

Also, what should be the data structure/format for these dynamic tokens? will it be json?