Marketers find love in the API economy

If you’ve seen the Martech 5000 graphic, you know the landscape of marketing tools can be described differently depending on who you ask, but generally they fall somewhere on the spectrum between disgusting and amazing.

If you had asked the me-of-five-years-ago, I’d have probably said, “That’s stupid™. Are there more problems being created than there are being solved with this many (software) tools out there?

I was scared! As a newly anointed marketing ops manager at a software company that had just gone public, I was terrified that I had a growing stack of marketing tools, of which nearly half relied on some manual export of CSVs to move or transform data.

Not to mention the fickle, native enterprise integrations between our marketing and sales automation platforms. It was non-stop fire fighting on the data side, and my options were relegated to either improving integrations myself, or by hiring outside experts. The engineering team (rightly so) was fighting their own set of fires.

Dare I say API-first

The fractured nature of the Martech ecosystem leaves many marketers—regardless of team or company size—without a well-worn path to a connected stack. It’s my opinion that both business and individual consumers have been trained to rely on pre-built integrations to streamline communications and processes. And if that pre-built integration doesn’t exist, marketers are faced with the same two options I had: fix it yourself, or contract the work.

Now ask the me-of-today—where the landscape of SaaS platforms continues to evolve at a rapid pace—I’ll tell you that a silly graphic shouldn’t scare you. With the way many SaaS products are being built (dare I say API-first), there’s nothing wrong with a billion tools as long as you know how to bend them to your will.

Said another way, we shouldn’t rely solely on a native integration to determine whether or not a SaaS tool will work for us. Why? The ability for emerging technology or startups to provide those integrations out of the gate is probably a second thought.

Consider what happens when a new technology hits the market. Let’s take Trello as an example. Do you think the first thing the product team set out to tackle was integrations with every known tool out there? No.

Their first initiative was to create the API, then rebuild the core product to utilize the API. And that means exactly nothing to the uninitiated. So let’s talk briefly about what an API is (disclaimer: this is for marketers, by marketers).

APIs are the communication layer between the user (via the graphical interface or via direct API access) of a platform and the data stored in the back end. The API provides a set of rules to anyone/anything that’s trying to access the data. Here’s a plain-English request to an API:

Dear https://freegeoip.net/json/,
I’d like you to send me the IP address from which I’m writing you today, along with the geographical information about my location. I hope it’s not too much to ask.
Kind regards,
Bill

The basic parts of the request are simple. I need a URL (endpoint) and the details of what I’m asking for. The endpoint itself is typically organized like folders on your computer, where the last directory in the endpoint describes the data resource you’re accessing from the API.

So in the example above, we’re simply asking for the response from freegeoip.net to come back to us formatted as a JSON object. JSON is human-readable and is also organized much like a folder structure on your computer. There can be one or many nodes (i.e. levels) in a JSON object, and when that object is sent or received by an API, the application knows how to interpret it.

Every marketer, whether they know it or not, has the ability to utilize an API with Webhooks. Webhooks are requests sent to an API. These requests can be sent manually (as we will explore below), automatically using a web service built by an engineer, by using a third party multi-tool integration platform like Zapier, or even marketing platforms like Customer.io and Contentful.

Here are a few illustrations of how I personally use Webhooks every day to send data from one application to another:

  1. Send website form submissions to Zapier using a Webhook endpoint as the form action endpoint
  2. a. Get web visitor IP address using freegeoip.net
    b. Use IP address to look up company name from Clearbit
  3. Add converted customers to Facebook or Adroll custom audiences
  4. Send marketing activities to Segment.com
  5. Add new prospects to my marketing database

For more about what marketers can do with webhooks, I’ve got a webinar coming up on April 11th featuring guests from Zapier and Livestorm! Don’t miss it!

The secret weapon of modern marketers | Customer.io
Have you ever failed to execute on an idea because you didn’t have the technical chops to send data from one place to…app.livestorm.co

I want you to try something for yourself. I dare you to get this wrong!

We’re going to ask an API for some information (a GET request) Open the “Terminal” application on your Mac. It’s under Applications > Utilities > Terminal.

Copy and paste the following line into Terminal and press enter.

curl freegeoip.net/json/ | json_pp

You should see something like this:

{
“region_code” : “OR”,
“ip” : “38.111.111.111”,
“longitude” : -122.6157,
“time_zone” : “America/Los_Angeles”,
“city” : “Portland”,
“metro_code” : 820,
“region_name” : “Oregon”,
“country_code” : “US”,
“latitude” : 45.4407,
“zip_code” : “97222”,
“country_name” : “United States”
}

Guess what? You just made your first call to an API with cURL! You just used the free, open API at freegeoip.net to return your geographic location and IP address. (cURL is a free utility installed on every Mac that sends requests to URLs…more here).

Now that you’ve asked an API for information, let’s send some information to an API! In your Terminal window, you can copy and paste the following line and press enter:

curl -d “cookie=chocolate-peanut-butter” -X POST https://webhook.site/a41a0b1f-4cd4-4a9c-a86a-fe233bf589a2

After you sent it, go here and take a look in the left hand column for your request. If you completed the first example to look up your IP address, you’ll be able to find your request by IP address!

Okay, that’s all fine and good, but what about the real marketing stuff?

Okay, here’s one full-fledged example from Customer.io on how you can use Webhooks to send a real, honest-to-goodness postcard.

Lob is an API to send physical mail. You can connect Customer.io to Lob using Webhooks to send a postcard, letter, or even send a check. In our example, we’re going to trigger a postcard to be sent to customers with a mailing address.

What you need

  1. A free trial account with Customer.io with a few test profiles (with mailing addresses) created
  2. A free Lob account with a test API key

Get your Lob API key

If you don’t have a Lob account, start by creating one over at Lob.com. In your Lob account, you’ll want the API Key from your account. We recommend starting with your “Test API Key” from your settings.

Create your campaign in Customer.io

Create a campaign in Customer.io where you want to add the Webhook action. For our example, we’re using a segment triggered campaign with the segment “signed up” as our trigger.

Add your Webhook action to the workflow

Add a new Webhook action in the campaign’s workflow, and give it a name. Then click Add Request.

You’ll then be brought to the Webhook composer.

Add your Webhook headers

Next to POST, add in the test API key and the postcard API endpoint in this format:

https://[API-KEY]:@api.lob.com/v1/postcards 

Your headers should look something like:

Customize your postcard

Copy and paste this example code in to the content area for your webhook.

{
“description”: “What a fancy postcard”,
“to”: {
“name”: “{{ customer.first_name }} {{ customer.last_name }}”,
“address_line1”: “{{ customer.address_1 }}”,
“address_city”: “{{ customer.city }}”,
“address_state”: “{{ customer.State }}”,
“address_zip”: “{{ customer.zip }}”,
“address_country”: “US”
},
“from”: {
“name”: “Your Company”,
“address_line1”: “123 Main St”,
“address_line2”: “Ste 300”,
“address_city”: “Portland”,
“address_state”: “OR”,
“address_zip”: “97205”,
“address_country”: “US”
},
“front”: “http://userimg.customeriomail.com/WimaKyKwRvusmPIsxsUm_Ian1.jpg”,
“back”: “<html style=’padding: 1in; font-size: 18;’>Hi {{ customer.first_name }}, Thanks for being our customer!</html>”
}

You’ll want to adjust the liquid for mailing addresses to match your custom attribute names in Customer.io.

For details on customizing the front or back of the postcard, take a look at Lob’s documentation.

When you’re done, you’ll have a finished webhook that looks something like:

Send request

When you’re ready to test, you can click Send Request. Customer.io will show you the response from the Lob API.

If you’re successful, you’ll see a 200 OK.

Success!

In Lob, you should now see your postcard successfully created.

Don’t rely on native integrations

When I was making buying decisions for marketing teams with $1M+ budgets I could be selective. What I didn’t realize is that by being “selective” I was discounting some potentially great solutions with shorter times-to-value by just utilizing what already existed. Even a basic understanding of how an API works, knowing what tools you have at your disposal, and not being scared (like I was) to try something new, will help you connect your world a little more than it is right now.

For more about what marketers can do with webhooks, I’ve got a webinar coming up on April 11th featuring guests from Zapier and Livestorm! Don’t miss it!

The secret weapon of modern marketers | Customer.io
Have you ever failed to execute on an idea because you didn’t have the technical chops to send data from one place to…app.livestorm.co

Join our mailing list for updates on our content and more!