Re: Can you update email script tokens via API?

Travis_Wittenbu
Level 2

Can you update email script tokens via API?

We have email script tokens that contain a value that needs to be updated on a daily basis, and we want to move the process to the  API instead of manually doing it every day.

 

According to the Marketo documentation (https://developers.marketo.com/rest-api/assets/tokens/) you can't work with this 'type' of token through the API. Is this actually true?

 

Can we get around this by embedding a token you can modify through the API (like a text string) inside our email script tokens?

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Can you update email script tokens via API?

If you're merely #set()-ing  a value you can put that code in a Text {{my.token}}.

 

There's no supported way to update Velocity {{my.tokens}} anymore. I've fiddled with it and still gotten the endpoint to work, but the format of the stored value has changed arbitrarily over time — not worth it.

Travis_Wittenbu
Level 2

Re: Can you update email script tokens via API?

Just to make sure I understand - 

 

Let's say for example my current velocity script that I can't update through the API is something like the below. The "$link" variable is what I want to be able to change via the API, but can't since it is an email script.

 

#set ($ticker = "Lorem Ipsum")
#set ($link = "https://example.com")
#if( $lead.Subscribed_Products_From_Account__c.matches(".*($ticker|cat|dog).*") )
<b><a href="$link">ABC</a></b>*
#else
<b><a href="https://example.net">XYZ</a></b>*
#end

 

Instead, I can create a 'Dynamic URL' text token to reference within my velocity script, and update that text token through the API?

#set ($ticker = "Lorem Ipsum")
#set ($link = {{my.Dynamic URL}})
#if( $lead.Subscribed_Products_From_Account__c.matches(".*($ticker|cat|dog).*") )
<b><a href="$link">ABC</a></b>*
#else
<b><a href="https://example.net">XYZ</a></b>*
#end

Thanks Sanford!

SanfordWhiteman
Level 10 - Community Moderator

Re: Can you update email script tokens via API?

I mean you put 

#set ($link = "https://example.com")

in a Text token via API. Then include that token before your formal Email Script token.