Can you update email script tokens via API? | Community
Skip to main content
Travis_Wittenbu
New Participant
June 11, 2021
Question

Can you update email script tokens via API?

  • June 11, 2021
  • 1 reply
  • 1860 views

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?

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

1 reply

SanfordWhiteman
New Participant
June 11, 2021

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
New Participant
June 16, 2021

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
New Participant
June 16, 2021

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.