If you’re a Marketo user, you’ll know that it’s great at scaling.
It offers robust templates and tokens to streamline marketing operations.
But with that said, there can still be plenty of manual work involved in the form of cloning programs, updating tokens, and activating smart campaigns.
If you’re running an instance with 10 campaigns per day, for example, that’s going to be a real challenge. And if it has 1000 campaigns per day, it’s pretty much impossible to maintain accuracy and consistency — even if you have an amazing team.
The solution: leverage the Marketo API to automate these repetitive processes.
In this guide, we’ll show you how to harness the Marketo API to save time, ensure consistency, and enable greater scalability across your marketing initiatives.
Let’s get into it!
(This guide is for Marketo users and assumes a basic understanding of the Marketo API. If you want to learn more about the API, check out our webinar as well as an extensive course by Tyron Pretorius.)
Note: It’s important to remember that we must always start by obtaining a Marketo API access token.
1. Cloning Programs
Imagine you need to create 25 webinar programs that each require unique details. This would be pretty time-consuming to manually complete, so we’re going to use the API to automate the entire process.
Let’s start with a Python script that will automatically clone your program:
def clone_program(programName,programId,folderId):
url="https://"+MUNCHKIN+".mktorest.com/rest/asset/v1/program/"+programId+"/clone.json"
token=get_access_token()
params={'access_token': token,
"Content-Type": "application/x-www-form-urlencoded"}
body="name="+programName+"&folder={'id':"+folderId+",'type':'Folder'}"
url=url+"?"+body
response=requests.post(url=url,params=params)
data=response.json()
programid=data['result'][0]['id']
return programid
2. Updating Tokens
Now that our programs are cloned, we need to populate them with the correct values. Using the API, we can update text tokens, date tokens, etc. across multiple programs simultaneously — saving time and reducing the risk of outdated information being sent to our audience.
Use this Python script for updating text tokens:
def updateTextToken(programid,tokenName,tokenValue):
url = "https://"+MUNCHKIN+".mktorest.com/rest/asset/v1/folder/"+str(programid)+"/tokens.json"
token=get_access_token()
headers = {
"Authorization": "Bearer "+token,
"Content-Type": "application/x-www-form-urlencoded"}
body="name="+tokenName+"&value="+str(tokenValue)+"&type=text&folderType=Program"
url=url+"?"+body
response = requests.post(url, headers=headers)
data=response.json()
3. Activating Smart Campaigns
Finally, we must bring our programs to life by activating our smart campaigns.
Use this last Python script to achieve this:
def activateSC(campaigns):
for campaign in campaigns: url="https://"+MUNCHKIN+".mktorest.com/rest/asset/v1/smartCampaign/"+str(campaign)+"/activate.json"
token=get_access_token()
params={'access_token': token}
response=requests.post(url=url,params=params)
data=response.json()
With Great Power Comes Great Responsibility
While the Marketo API opens up a world of automation possibilities, we need to use it wisely.
Here are a few major considerations we want to leave you with:
1. Always have a backup plan.
If you’re going to clone 25 programs, for example, make sure you can delete those 25 programs if necessary. Create a “delete campaign” as a safety net so you can undo any changes.
2. Test, test, test.
In your typical development process, you would usually build things in a lower “beta” environment where everything can be tested. In Marketo, you can’t do this. You need to test things in production to see what your results are going to be.
For example, if you want to update 100 landing pages using the API, start by updating just 1 landing page first. Did the changes to that page go through as planned? If the answer is no, you’ll need to go back and fix things before you bulk-update the next 99 pages. Then retest the change, and so on.
Automation is our friend, but we don’t want to create more technical debt — and we definitely don’t want to create technical debt that we can’t automate.
As long as we keep this in mind and proceed with caution, we’ll be fine!
By carefully leveraging the Marketo API to automate these repetitive processes, we’re:
✅ Improving consistency
✅ Enabling greater scalability
✅ Freeing up valuable time for more strategic initiatives
And if you need any help using the Marketo API, book a 30-min call with one of our experts here!