A presentation at Litmus Live San Francisco in in San Francisco, CA, USA by Heidi Olsen
$ Demystifying APIs for Better Email Programs #LitmusLive • @swisswebmiss
Hello, my name is Heidi. Senior Front End Engineer @Bumped #LitmusLive • @swisswebmiss
https://eroi.com/profile-center #LitmusLive • @swisswebmiss
Behind the scenes Collect data about your subscribers Trigger emails based on behavior #LitmusLive • @swisswebmiss Automate tedious, time-consuming tasks
ESP vetting Free Plan • Create a list of 20 subscribers ¯_(ツ)_/¯ Sign Up #LitmusLive • @swisswebmiss Your Plan Platinum Plan • Will send email • • Will bend spacetime continuum Pre-built webform, add your logo! • Will also definitely send email Sign Up Contact Us
#LitmusLive • @swisswebmiss
If you develop emails, do you also work with APIs? #LitmusLive • @swisswebmiss Yes 36% No 64% Reporting from 55 people on Twitter and Women of Email Facebook Group
Job responsibilities Read API docs Put in requests for data Build and test dynamic logic Write SQL to query databases #LitmusLive • @swisswebmiss
Email developers !!= Real developers #LitmusLive • @swisswebmiss
Email developers !!=== Real developers Doubts? Check out amiarealdeveloper.com #LitmusLive • @swisswebmiss
We have the skills! (to avoid expensive ESP bills) Understand and analyze data #LitmusLive • @swisswebmiss Write complex logic in code Great at debugging
What’s so special about APIs? #LitmusLive • @swisswebmiss
#LitmusLive • @swisswebmiss
Automation Sync data between systems #LitmusLive • @swisswebmiss Build and trigger dynamic campaigns Analyze campaign metrics
Deliverability Marketing IP #LitmusLive • @swisswebmiss Transactional IP
Omnichannel Pulling data from multiple channels to build and deploy hyper-personalized messages. #LitmusLive • @swisswebmiss
Let’s dig in What is an API and what is not an API? Let’s write an API call! Enhance your customer journey API tips and tricks #LitmusLive • @swisswebmiss
What is an API? #LitmusLive • @swisswebmiss
Application Programming Interface #LitmusLive • @swisswebmiss
Application Programming Interface #LitmusLive • @swisswebmiss
Application Programming Interface HTTP REQUEST https://litmus.com #LitmusLive • @swisswebmiss
Application Programming Interface HTTP REQUEST https://litmus.com HTTP RESPONSE #LitmusLive • @swisswebmiss
Application Programming Interface HTTP REQUEST https://litmus.com HTTP RESPONSE #LitmusLive • @swisswebmiss
Types of APIs SOAP REST API Protocol API Architectural Style Reliable success and retry logic Excellent performance and scalability Server to server Client to server, optimized for the web #LitmusLive • @swisswebmiss
Authorization Since HTTP is stateless, every request will need to be authenticated. An API token or key acts as a password to an account, but more secure. #LitmusLive • @swisswebmiss
Anatomy of an API Call POST https:!//api.endpoint.com/3.0/lists/12345 HTTP Method: GET POST PATCH DELETE Fetching either a collection or a single resource Add a new resource to a collection Update a resource Delete a collection or record #LitmusLive • @swisswebmiss
Anatomy of an API Call POST https:!//api.endpoint.com/3.0/lists/12345 Endpoint URL #LitmusLive • @swisswebmiss
Anatomy of an API Call POST https:!//api.endpoint.com/3.0/lists/12345 API Version #LitmusLive • @swisswebmiss
Anatomy of an API Call POST https:!//api.endpoint.com/3.0/lists/12345 Resource (collection/ID) #LitmusLive • @swisswebmiss
Anatomy of an API Call POST Body https:!//api.endpoint.com/3.0/lists/12345 { } "email_address": "janet@thegoodplace.gov", "status": "subscribed", "first_name": "Janet", "last_name": "Demon" #LitmusLive • @swisswebmiss
API Responses HTTP/1.1 200 OK JSON { } "id": "666123666", "email_address": "janet@thegoodplace.gov", "first_name": "Janet", "last_name": "Demon", "ip_opt": "12.34.56.666", "timestamp_opt": "2018-10-31T12:00:07+00:00" #LitmusLive • @swisswebmiss
API Responses Status Code HTTP/1.1 200 OK { } "id": "666123666", "email_address": "janet@thegoodplace.gov", "first_name": "Janet", "last_name": "Demon", "ip_opt": "12.34.56.666", "timestamp_opt": "2018-10-31T12:00:07+00:00" #LitmusLive • @swisswebmiss
Status Codes 200-299 All good fam. 300-399 Try down the street. 400-499 Yo, you messed up. 500-599 Its not you, its me. The server. #LitmusLive • @swisswebmiss
What is not an API WTF is an SDK? #LitmusLive • @swisswebmiss
Software Development Kit API SDK An interface that allows software to talk to other software Set of tools, libraries, code samples, and/or guides Allow for the functioning of applications Allow for creation of applications #LitmusLive • @swisswebmiss
Webhook No request needed Register your URL with the service Avoids expensive rate limits #LitmusLive • @swisswebmiss Hey, what’s going on tonight? VS Hey, hit me up when you know what’s happening.
Let’s write an API call! #LitmusLive • @swisswebmiss
Tools Email Service Provider API Development Environment Terminal Application OR mailchimp.com #LitmusLive • @swisswebmiss getpostman.com iterm2.com
Setup Take note of the following values: • API Key • Datacenter: https://usXX.admin.mailchimp.com • List ID • Merge tags: Subscriber attributes #LitmusLive • @swisswebmiss
//TODO GET Get information about all segments in a list #LitmusLive • @swisswebmiss
Authenticate Type: Basic Auth Username: Your Mailchimp username Password: Your API Key #LitmusLive • @swisswebmiss
HTTP Request Select GET from HTTP request dropdown #LitmusLive • @swisswebmiss
API Endpoint Add API Endpoint to request URL: https:!//{datacenter}.api.mailchimp.com/3.0/lists/{list_id}/segments #LitmusLive • @swisswebmiss
Response Status Code Download JSON Response #LitmusLive • @swisswebmiss
//TODO POST Add a subscriber to a segment #LitmusLive • @swisswebmiss
Authenticate $ curl -H "Authorization: apikey 1234567890" #LitmusLive • @swisswebmiss
HTTP Request $ curl -H "Authorization: apikey 1234567890" -X POST #LitmusLive • @swisswebmiss
API Endpoint $ curl -H "Authorization: apikey 1234567890" -X POST https:"//{dc}.api.mailchimp.com/lists/ {list_id}/segments/{segment_id}/members #LitmusLive • @swisswebmiss
Body of request $ curl -H "Authorization: apikey 1234567890" -X POST https:"//{dc}.api.mailchimp.com/lists/ {list_id}/segments/{segment_id}/members -d '{"email_address" : "eleanor@earth.gov", "status" : "subscribed"}' #LitmusLive • @swisswebmiss
Response $ HTTP/1.1 200 OK { "id": "666-777-666", "email_address": "eleanor@earth.gov", "status": "subscribed" } #LitmusLive • @swisswebmiss
Enhance your customer journey #LitmusLive • @swisswebmiss
ONBOARDING Museum of Ice Cream To Heidi Olsen Welcome to the Museum of Ice Cream family! WELCOME EMAIL Welcome to the Museum of Ice Cream Why use an API? • • Specify a transaction-specific IP Faster deployment Which do you prefer? Tell us more about yourself and receive exclusive discounts, event invites and first dibs on new products! Chocolate Vanilla
https://www.museumoficecream.com/preference-center DATA GATHERING PREFERENCE CENTER Tell us more about yourself. Which flavor do you prefer? Chocolate Why use an API? • • Self-host page on your site Full control of the presentation and data Vanilla Both What would you like to hear about? Discounts Events New Products How do you like to receive messages? Email SMS/Text Update Snail Mail
STAY RELEVANT SMS MESSAGE Why use an API? • • Send to multiple channels from one platform Segment users based on preferences Use the code SPRINKLES to receive 20% off your order today!
AUTOMATED MSG PAYMENT ERROR Museum of Ice Cream To Heidi Olsen Important: Card payment did not go through. Why use a Webhook? • • Partner vendors like Stripe will ping your IP when there is an issue Automate program to send message to subscriber to ensure package ships on time. Oh no! There was a card error. The card you provided did not go through, please update your payment so your package can ship on time! Update Payment
Museum of Ice Cream To Heidi Olsen We found something you might like! OMNICHANNEL PERSONALIZED EMAIL Since you liked our sprinkle brushes… Sprinkles Makeup Case Why use an API? Channel your inner child and jump right into the sprinkle pool. Add to Cart • • Pull data from an eCommerce platform like Shopify Encourage your customers to engage across multiple channels including Instagram See the museum through our followers eyes View on Insta
MEASURE SUCCESS 100 70 REPORTING Why use an API? • • Expedites data transfer from multiple sources Parses data in readable format 75 52.5 50 35 25 17.5 0 0 April May June July
API tricks and tips #LitmusLive • @swisswebmiss
Vetting APIs Data architecture + language bindings Average downtime + availability Request limits + cost Documentation + support #LitmusLive • @swisswebmiss
Resources Mailchimp API documentation » Huge collection of free APIs » Curated list of fun APIs » Intro to REST APIs online course » #LitmusLive • @swisswebmiss
Next steps: Read through your ESP’s API documentation Practice writing calls in a sandbox account Strategize ways to enhance emails with APIs Believe in yourself #LitmusLive • @swisswebmiss
#LitmusLive • @swisswebmiss
Thank you #LitmusLive • @swisswebmiss
When a project calls for a custom feature that stretches beyond what an ESP can handle, email marketers are confronted with a difficult choice: Pay additional money or use an API. For many, APIs are monstrous beasts that leave them feeling intimidated and forcing them to spend big money in the process. But APIs don’t have to be scary. In fact, APIs can transform your campaigns from static and predictable into dynamic, unexpected, and valuable. Walk through a customer journey and see how APIs can be put to work to enhance the subscriber experience, with plenty of tips on API basics, tools, and usage to get over the fear of using APIs.
Here’s what was said about this presentation on social media.
Thank you everyone who came to my talk about APIs 🚀 I'll be at table 6 if you have any questions. Also big shout out to @tatianatmac for the custom t-shirt. I like to think it brought me luck ✨ check out her other shirts here https://t.co/oBGuDKhXCt #LitmusLive pic.twitter.com/RHpUTJIDMu
— Heidi Olsen (@SwissWebMiss) November 9, 2018
@SwissWebMiss Loved your presentation on APIs! What a great step-by-step how-to. I'm definitely taking this one back with me. #LitmusLive
— Kate Tinklenberg (@kTinklenberg) November 9, 2018
My notes for @SwissWebMiss’s #litmuslive talk on demystifying APIs pic.twitter.com/0bZ25tOuHr
— Sarah Esterman (@sarahesterman) November 9, 2018
BORTLES. #LitmusLive @SwissWebMiss @TheGoodPlaceNBC pic.twitter.com/IW8cHciR0Y
— Liz Leslie (@liz_leslie) November 9, 2018
Hope all y'all who just learned all about RESTful APIs from @SwissWebMiss can appreciate how awesome her shirt is. #LitmusLive
— Inkceptional (@Inkceptional) November 9, 2018
A tremendous amount of audible note taking (furious typing and writing) during @SwissWebMiss's amazing presentation on APIs. #LitmusLive
— Inkceptional (@Inkceptional) November 9, 2018
@SwissWebMiss API demystified #litmuslive pic.twitter.com/oTID2cHb0z
— Nick Goldsberry (@nickgoldsberry) November 9, 2018
As a Janet fan, I love these API examples from @SwissWebMiss at #LitmusLive pic.twitter.com/5RT305jSqR
— Jason Rodriguez (@RodriguezCommaJ) November 9, 2018
Learning about APIs for emails, something I've been wanting to build for work. Dope. Thanks @SwissWebMiss! Also nice Good Place reference here #litmuslive pic.twitter.com/BGu4CrzT0w
— Yunnie (@yunniekim) November 9, 2018
Love these slides by @SwissWebMiss! 🙌🏽
— Crystal Ledesma (@sentbycrystal) November 9, 2018
Email Developers = Real Developers #LitmusLive pic.twitter.com/AcsfaQufLf
Demystifying APIs start with defining what they are...and fun fact, you use APIs all the time, every day! @SwissWebMiss #LitmusLive pic.twitter.com/DeNJSuDeSR
— Lauren Kremer (@laurenkremer) November 9, 2018
Preach it! @SwissWebMiss demystifying the power of APIs in email development so you can automate! 🙌🏼 #LitmusLive
— Sean Kennedy (@Sean_Kennedy) November 9, 2018
News flash: email developers have the potential to be and are real developers. #litmuslive @SwissWebMiss @litmusapp pic.twitter.com/xQFT42w0q5
— Yunnie (@yunniekim) November 9, 2018
Email developers not real developers - @SwissWebMiss 😂🤣😂🤣 #buttrue #email #LitmusLive
— Mary Halpin (@MaryHalpin) November 9, 2018
Pretty sure that @SwissWebMiss has the best shirt of the day at #Litmuslive. Custom made by @tatianatmac from what I hear. 👏👏👏 pic.twitter.com/a8zdZItx13
— Jason Rodriguez (@RodriguezCommaJ) November 9, 2018