SOLVED

How to set a token via the API

Go to solution
Anonymous
Not applicable

How to set a token via the API

My goal is to send out an email at least once a week that says:

"There have been X global security vulnerabilities recently discovered". 

Where X is a value generated externally (from our SaaS product) and is pushed to Marketo.

If we send out, say, 100 emails for the email blast, we'd want X to be the same value in all the emails (for that particular time frame).  (although it will be updated every time we send out an email blast)

I'm a bit of a noobie when it comes to Tokens, but it seems like I should use a Marketo API call to push the value X from the external source into a Token....and then reference the token in the email being sent to 100 people.

Is this possible, and is this the best method to push an external value into an email. (where the value is the same for all the emails in a email blast) ?

(I did a little digging into the velocity scripting language that Marketo now supports.   I saw that it can read data from external files... but I doubt that will work in conjunction with Marketo)

Thanks in advance for any input/suggestions.

Pat-




Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: How to set a token via the API

Hi Patrick - The code Raj has included is a sample Java code which is calling the Marketo scheduleCampaign SOAP API.  scheduleCampaign allows you to override tokens that are defined within the program.  Those program tokes can be referenced in the email template you have setup within Marketo.

In your case, you will have a program defined that has a token like "my.securityvulnerabilities".  Within your email campaign you reference the token in the email template.  Something like this:

"There have been {{my.securityvulnerabilities}} global security vulnerabilities recently discovered".

So when you call the SOAP API scheduleCampaign, you pass in whatever value you want for {{my.securityvulnerabilities}} and it will get displayed within the email.

Hope that helps.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Re: How to set a token via the API

Anonymous
Not applicable

Re: How to set a token via the API

Thanks for the reply Raj, I appreciate it.

I'm looking at the code below.   While I'm pretty technical, but I'm not an engineer at the company.

Can you give me some context what this is suppose to do.

I've copied the Java code below.  It looks like you are passing in four values:  User, BlogCampaign, Subject and Content).  You are setting tokens, which looks promising. 

At the end you are calling schedule campain which is also promising. 

(is this API code itself?  or sample code if we are running Java in our app, which we're not).

Thanks in advance.  I look forward to the additional info.

Pat-



privatebooleansendEmail(Useruser,BlogCampaignbc,Stringsubject,
Stringcontent){
booleanretVal=false;
MarketoUtilitymu=newMarketoUtility();
Datedt=newDate();
Logger.debug("About to schedule email");
 
List<Attrib>tokenList=newArrayList<Attrib>();
 
Attribtoken1=MktowsUtil.objectFactory.createAttrib();
token1.setName("my.subject");
token1.setValue(subject);
tokenList.add(token1);
 
Attribtoken2=MktowsUtil.objectFactory.createAttrib();
token2.setName("my.content");
token2.setValue(content);
tokenList.add(token2);
 
retVal=mu.scheduleCampaign(user,dt,bc,tokenList);
returnretVal;
}
 
Anonymous
Not applicable

Re: How to set a token via the API

Hi Patrick - The code Raj has included is a sample Java code which is calling the Marketo scheduleCampaign SOAP API.  scheduleCampaign allows you to override tokens that are defined within the program.  Those program tokes can be referenced in the email template you have setup within Marketo.

In your case, you will have a program defined that has a token like "my.securityvulnerabilities".  Within your email campaign you reference the token in the email template.  Something like this:

"There have been {{my.securityvulnerabilities}} global security vulnerabilities recently discovered".

So when you call the SOAP API scheduleCampaign, you pass in whatever value you want for {{my.securityvulnerabilities}} and it will get displayed within the email.

Hope that helps.
Anonymous
Not applicable

Re: How to set a token via the API

Hi Travis,

This is exactly the context I needed.

Thanks Raj and Travis for your help!  I appreciate it.

Pat-

Anonymous
Not applicable

Re: How to set a token via the API

Here is another article that shows how to use ScheduleCampaign and ImportToList tos end email via API and Marketo.
Anonymous
Not applicable

Re: How to set a token via the API

Great resource doc.  Thx Angelo!