Automate Your Swag Marketing with Marketo Webhooks and Printfection

August 11, 2015 Justin

Swag: it can be a great way to introduce yourself to leads and make loyal customers feel appreciated.

But let’s face it, finding really cool swag is a challenge. And most of the time you also have to spend a ton of time ordering, transporting, and distributing it.

printfection_demoEnter Printfection. Their stuff looks awesome, and they let your swag-consumers self-serve their orders with a very smooth online process. Just send someone a one-time URL, and that person can choose an item, enter their address, and place an order in about 90 seconds.

There’s just one missing link…out of the box, you still need to do a fair bit of manual work and spreadsheet monkeying to bridge the gap between Printfection and your Marketing Automation platform.

How to Automate your Swag Distribution Right Now

If you use Marketo, you’re in luck, because you can have a “lights out” swag distribution machine in about 5 minutes — meaning you can start offering leads t-shirts and hoodies as easily as you do white papers and e-books today.

How It’s Done

The process is really easy even if you can’t write a line of code. The secret ingredient is a Marketo Webhook, an extremely powerful feature that essentially lets you make an API call from within a Marketo Smart Campaign.

Don’t be scared off by terms like “Webhook” and “API”. Even if you consider yourself non-technical, you don’t need your developer to do it. This one’s all you. Let’s go!

Step 1: Create a Printfection Account

You’ll need to have your Printfection account ready to go before you can integrate it with Marketo.

You can see all the steps in more detail over at the Printfection Website, but basically you need to open an account, create a campaign that offers individual give-away URLs, and stock it with some promotional inventory (like this cool beanie with tassles).

Once you’ve got all that set up, there are two pieces of information you’ll need from your account:

  1. Campaign ID: You can find this by clicking on the campaign inside the Printfection platform and copying the numbers at the end of the URL, after “storeid=”.Printfection_Campaign_ID
  2. API Key: Click on Account Options > API Access and copy down your API key.Printfection_API_KeyCaution! Your API key gives great power. Do not post it on the internet. The one above is not a real key. 

That’s all you need from the Printfection platform.

Step 2: Create a Custom Field for Your Give-Away URL

Let’s say you’re running a campaign to give away your branded tassled beanies to anyone who signs up for a free demo of your product.

You have a “Request a Demo” form all set up. Once people fill out the form, you want to send them a link to get their free beanie, and have the order processed and shipped with absolutely no manual work required by you.

To do this, we first need to create a custom field in Marketo to contain this URL. (You’ll use a token to merge this field into your emails later.)

Inside Marketo, go to Admin > Field Management > New Custom Field. Choose a “String” field and call it whatever you’d like.

Marketo_Giveaway_Field

Step 3: Create Your Marketo Webhook

In Marketo, go to Admin > Webhooks > New Webhook.

The screenshot below shows what yours needs to look like — I’ll explain each field in detail after.

Printfection Marketo Webhook

Webhook Name: Something descriptive and memorable, so you can easily call it in Flow Steps and recognize it in a lead’s Activity Log.

Description: Help your future self or co-workers know what this Webhook is for and what it should do with a concise description.

URL: This is the URL of the Printfection API endpoint used to create a new order. (An “order” is what allows a lead to claim some free swag.)

However, the URL needs to be merged with your secret API key to authenticate you and give access to your Printfection account. The format is:

https://[your-api-key]:@api.printfection.com/v2/orders

Substitute your actual API key in place of [your-api-key].

(Side note: it is also possible to authenticate by adding a custom header and using Basic Access Authentication. When viewing your Webhook, click on Webhook Actions > Set Custom Header.)

Request Type: Choose “POST”.

Template: This is the body of your API request. In it, all you need to include is the Campaign ID of the campaign you want to call. Copy the syntax below and substitute in your campaign ID from your own Printfection campaign.

{"campaign_id":123456}

Request Token Encoding: Choose “JSON”.

Response Type: Choose “JSON”.

Your Webhook is ready to go!

Step 4: Map the API Response

When you run a lead through this Webhook, it will now make a call to the Printfection API and create an order. In response, Printfection will send you some details about that order. You can see all these details in the lead’s Activity Log.

Here you can see that the Webhook was called and that there was a response.

Activity_Detail

And here you can see that the response actually contains an attribute called “url”.

Marketo Webhook Response URL
This is the little gem you want to extract and send to your leads. Fortunately, Webhooks makes that fairly easy.

Go back to Admin > Webhooks and select your new Webhook in the left-side panel. Underneath, you’ll now see a section where you can add and edit Response Mappings.

Marketo Webhook Response Mappings
Click on “Edit” next to Response Mappings, and add a new mapping in the dialogue that appears. The “Response Attribute” is going to be “url” (this identifies the part of the response we want to extract) and the field is going to be the custom field you created in Step 2.

Response_Mapping

Basically, you’re telling Marketo, “look through the response until you see an attribute called ‘url’, then take what comes after it and put it into this field.” It’s that easy!

Step 5: Deploy Your New Marketo Webhook

You can deploy your Webhook using a Flow Step in any Marketo Smart Campaign. For now, let’s create a very simple test campaign so we can verify that it’s working.

Create a Test Lead

Go to Lead Database > New > New Lead and create a test lead with an email address that can receive email. (Hint, if you use Gmail or Google Apps, you can use [your-email]+[any-string]@[your-domain].com and it will still go to your [your-email]@[your-domain].com address!)

Build a Test Email Asset

To make sure that the give-away URL is working properly, we need to create an email that will send that URL to the lead.

Create an email and insert a text call-to-action that links to your give-away URL field using the token for that field. When the email is sent, the token will by replaced dynamically by the lead’s unique give-away URL so they can redeem their swag.

Give-away_URL_Email_Token

Build a Test Smart Campaign

Smart List

Use a “Campaign is Requested” trigger (so we can easily request this campaign for testing purposes).

Test_Campaign_Trigger

Flow Steps

In the first flow step, we’re going to request the Webhook we created.

In the second flow step, we’re going to send the email asset containing the give-away URL to the lead.

Test_Campaign_Flow_Steps

Note: for a production (rather than testing) campaign, I’d certainly recommend using a wait step in between these two steps, to ensure the API has time to come back and populate the URL fields. In my testing this worked just fine even without a wait step, but you want to make sure the email does not send without the URL field being populated.

Send Your Test

Go to Lead Database > All Leads and look up your test lead by email. From the menu, select Lead Actions > Special > Request Campaign, and request the test campaign you just build.

Step 6: Rejoice!

If all has gone well, you should receive your test email with a link to your Printfection give-away. Click on it.

Free_Beanie_Email

You should now be at the Printfection page where the lead can redeem their merchandise. They’re happy getting a cool gift, and you’re happy because software did all the hard stuff.

Free_Beanie_Redemption

You’ve just added some swagger to your Marketing Automation. Good work!

Bonus Step: Think Big

Now that you’ve seen how easy it is to automate the offering and distribution of swag through standard Marketo functionality, it’s time to think about how swag items could increase velocity and conversion at different stages of your funnel.

How could you use swag to attract more net new leads? Re-activate recycled prospects? Increase opportunity velocity?

Time to run some experiments and see what impact it has on conversion, cost, and ROI metrics. But you basically have a whole new channel open to explore. Have fun!

Looking for more ways to geek out on Marketo?

Check out Perkuto’s public Marketo Github Repo, where you can find code snippets for Munchkin code, Marketo Forms 2.0, Marketo Webhooks as well as Marketo REST and SOAP APIs.

Credits: 

We developed this solution as part of a project with Incapsula, the leader in cloud-based website performance and security solutions

Many thanks also to the team at Printfection for their help along the way!

Previous Article
Want the Recipe for Marketo Program Perfection?
Want the Recipe for Marketo Program Perfection?

We’ve all been there – you build a Marketo program, you go to test the program, and it’s broken. You review...

Next Article
The Complete Guide to Marketing Automation Acronyms
The Complete Guide to Marketing Automation Acronyms

New to the sales and marketing industry or marketing automation? Ever try to have a conversation with a new...