Re: Marketo tokens in API calls

Anonymous
Not applicable

Marketo tokens in API calls

Hi

I want to use Marketo lead tokens in the body part I'm sending with my token:

$tokens[] = new Attrib("{{my.Email Body}}","'this {{lead.First Name}} is {{lead.Last Name}} email body");

Is there a way I can use any of the Marketo tokens as placeholder in my message. This code will run in loop so don't want to use getMultipleLeads.

Thanks
Tags (1)
5 REPLIES 5
Anonymous
Not applicable

Re: Marketo tokens in API calls

Yes, you can change the tokens on a per-lead level using the importToList function.  Please review the info on page 13 of our SOAP API document - 

If there are multiple values for a My Token, here’s the priority of which value will be used in the email:
importToList value for My Token predominates.
scheduleCampaign value for My Token is used if there is no importToList value.
Program value for My Token is used if there is no importToList or scheduleCampaign value.
If a value is blank or is not specified in a higher priority function, we default to the next option. So, if importToList doesn’t specify a token value we use the value in scheduleCampaign if available. If not, we use the default value from the Marketo Program.
Anonymous
Not applicable

Re: Marketo tokens in API calls

Thanks Raj for your reply.

I understand what you are saying, but here I want to use Marketo tokens inside the value of my token, which I'm seding from the API.

Here is the scenerio:
I have created a token: {{my.Email Body}}
The value I want in this is "lead first name", "lead last name". For this I want to use Marketo tokens, which are

{{lead.First Name}} and {{lead.Last Name}}

For example my message is "Hello Raj Rajamani, welcome to marketo community!"

This message will be sent to 10000 users with their names. So the token will be something like this:

So the token value sould be written like this:
$tokens[] = new Attrib("{{my.Email Body}}","'Hello {{lead.First Name}} {{lead.Last Name}}, welcome to marketo community!");

The above will be passed to "
requestCampaign" call, which has 3 parameters: campaign name, leads and tokens.

I can do this by using getMultipleLeads, where I will get all the records from a static list, but that will require me to run the above in a loop, which may not be good for performance.

Please let me know if above is possible, or any other way so that I do not have to build token values in loop and I can use some placeholder for marketo tokens,

Thanks


Anonymous
Not applicable

Re: Marketo tokens in API calls

Sorry, You cannot have a token within a token.  You should consider using a snippet in the email instead.  The snippet can contain multiple tokens.  
Anonymous
Not applicable

Re: Marketo tokens in API calls

Thanks Raj, Can you please tell me more about how to use a snippet.

If you can please provide me the sample code for the above, it will be great.

Thanks
Anonymous
Not applicable

Re: Marketo tokens in API calls

You can learn more about Snippets at https://community.marketo.com/MarketoTutorial?id=kA250000000Kz11CAC.  These are not available through the API, so here's the rough workflow you'd have to follow -

1. Create snippet with the message Hello {{lead.First Name}} {{lead.Last Name}}, welcome to marketo community!");
2. Use the snippet in an email
3. run the campaign using APIs or from the UI

If the content in step #1 uses my tokens, you will be able to override its values using importToList or scheduleCampaign as perviously articulated in this thread.