Transactional Email with dynamic Interest List | Community
Skip to main content
November 5, 2017
Solved

Transactional Email with dynamic Interest List

  • November 5, 2017
  • 1 reply
  • 3527 views

I am in the process of setting up a transactional email that will be triggered off an API call, I have everything working except for how to pass in values through the REST api and use that in my velocity foreach script.

For testing purposes, I have this:

#set( $myList = [ "Item 1", "Item 2", "Item 3" ] )

<ul>

#foreach ($cat in $myList)

     <li>$cat</li>

#end

</ul>

I'm looking to replace $myList with the values I pass in through my api call, for reference i'm using the /rest/v1/campaigns/{ID}/trigger.json endpoint to add the lead to my smart campaigns.

Any help would be great!

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

We need this email to be sent within 1 minute, my understanding is the sync between marketo and salesforce is 5+ minutes. I'm newer to Marketo so please let me know if i'm mistaken!


If you can't wait for the sync, you can either

(a) Pass a dynamic {{my.token}} that holds an already-formatted HTML block based on the CO data.

(b) Copy the raw CO data into a temporary lead field (like Last CO Mirror or suchlike) as JSON or XML, and then call the trigger. A Velocity token can then take care of formatting, making this more manageable than (a) once built.

1 reply

SanfordWhiteman
New Participant
November 5, 2017

You can't pass dynamic Velocity tokens with an API call. While you can pass non-Velocity tokens (text or rich text) with the Request Campaign endpoint, you can't access those tokens from static Velocity tokens.

You will have to make a separate API call to update Velocity token(s). Of course this can lead to race conditions of you're triggering a campaign for multiple leads in parallel.

November 5, 2017

Thanks Stanford.

What would be the recommendation on how to accomplish what i'm after? We need the email to go out as quick as possible. For more context, we have Salesforce as our CRM and this 'interest' information about a lead will be in a custom object.

SanfordWhiteman
New Participant
November 5, 2017

If the info is in already-synced COs, why do you need to pass any new token values at trigger time? What is it that wouldn't be accessible in existing data?