Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SendGrid API Workshop - SendGrid Delivered NYC

Swift
September 12, 2012

SendGrid API Workshop - SendGrid Delivered NYC

This is the deck I used at the New York City stop of the SendGrid Delivered tour. It covers most of SendGrids APIs and what they can do

Swift

September 12, 2012
Tweet

More Decks by Swift

Other Decks in Programming

Transcript

  1. #delivered2012 What  is  SendGrid? • Cloud-­‐based  SMTP  provider • Massively

     scalable • AnalyCcs  on  emails  you  send • Robust  APIS  for  developers  to  integrate
  2. #delivered2012 What  APIs  does  SendGrid  Offer? API APIs  Overview •

    Subuser  API • CredenCals  API • Event  Webhook • Inbound  Parse  Webhook • SMTP  API • Web  API • NewsleNer  API • Reseller  API
  3. #delivered2012 APIs  Overview Q:  Why  should  I  care  about  the

     SendGrid  APIs? A:  There  are  a  lot  of  reasons,  but  the  short  list  is... •  Reduce  code  complexity •  Deeper  analyCcs  &  tracking •  Less  resource  consumpCon •  BeNer  UX
  4. #delivered2012 SMTP  API Custom  SMTP  header  that  contains  instrucCons  on

     how  to   process  your  email Add  extra  informaCon,  filters,  &  manipulaCons: •  Define  mulCple  recipients •  Text  SubsCtuCons •  Categories •  Unique  arguments  /  IdenCfiers X-SMTPAPI: { ... }
  5. #delivered2012 SMTP  API Example:  Billing  noCficaCon X-SMTPAPI: { "to": ["[email protected]"],

    "category": "billing_notifications", "unique_args": { "user_id": "12345" }, "sub": { "%amount%": ["$9.95"] } }
  6. #delivered2012 Web  API Send  mail  or  manipulate  SendGrid  se_ngs  via

     HTTP Anything  (almost)  you  can  do  from  the  SendGrid   dashboard,  you  can  do  from  the  Web  API •  Edit  profile  /  account  informaCon •  Add  new  Incoming  Parse  endpoints •  Retrieve  stats •  Manage  lists  (Bounces,  Blocks,  Unsubscribes,  etc.) •  Add  /  Remove  filters  (apps)
  7. #delivered2012 Web  API Web  API  endpoints  have  the  following  format:

    https://sendgrid.com/api/<MODULE>.<ACTION>.<FORMAT> Example:  Send  Email  over  HTTP curl -X POST http://sendgrid.com/api/mail.send.json \ -d “[email protected]” \ -d “[email protected]” \ -d “subject=hello world email” \ -d “text=some body text” \ -d “api_user=your_sendgrid_username” \ -d “api_key=your_sendgrid_key”
  8. #delivered2012 Web  API  vs.  SMTP  API Q:  Why  would  I

     use  HTTP  instead  of  SMTP? (Don’t worry, this is a really common question) A:  Normally,  you  won’t  have  to.    Unless... •  Your  ISP  is  blocking  common  SMTP  ports •  There  is  high  latency  between  your  app  and  SendGrid •  Difficult  to  install  /  configure  SMTP  drivers •  Simplicity  for  developers
  9. #delivered2012 NewsleEer  API Access  the  SendGrid  newsleNer  app  via  the

     API You  can  create  &  manage... •  NewsleNer  content •  Recipient  lists •  Sender  idenCCes •  Scheduled  deliveries https://sendgrid.com/api/newsletter/<ACTION>.<FORMAT>
  10. #delivered2012 Webhooks Q:  What  are  Webhooks? A:  Webhooks  are  like

     inverse  API  calls;  you  tell  us   where  the  data  needs  to  go,  we  send  it  there. WEB HOOK
  11. #delivered2012 •Processed •Dropped •Delivered •Bounced •Opened •Clicked •Spam  Reported •Unsubscribed

    POST Your  ApplicaCon  receives   an  event  POST (like  a  form  submit) Receive notifications when SendGrid events happen Event  No2fica2on  Webhook
  12. #delivered2012 What does an event notification look like? { "email":"[email protected]",

    "timestamp": 1322000095, "unique_arg":"some argument", "event":"delivered" } Event  No2fica2on  Webhook
  13. #delivered2012 Q:  Why  would  I  want  to  use  the  event

     webhook? A:  Use  it  to  enhance  your  exisCng  email   funcConality  and  gain  smart  customer  insight. Event  No2fica2on  Webhook (It’s a very reactive API)
  14. #delivered2012 POST Lets you receive email in your application EMAIL

    1. User sends email to *@yourapplication.com 2. SendGrid parses email & attachments 3. SendGrid POSTs the email to your application Inbound  Parse  Webhook
  15. #delivered2012 Customer  Highlight thebirdy.com Answer  one  email  a  day,  and

     track  what  you  spend.  Create   categories  by  tagging  your  purchases  like  #twiNer.  Super  simple.
  16. #delivered2012 2. Point your domain’s MX records at SendGrid Type

    Value MX 0 mx.sendgrid.net 3. Return a 200 status code from your application 1. Configure your hostname and URL settings http://sendgrid.com/developer/reply Inbound  Parse  Webhook
  17. #delivered2012 AddiGonal  APIs   Subuser  API •  Manage  and  control

     subuser  accounts Reseller  API •  For  partners  who  want  to  integrate  their  pla]orm  with  SendGrid Mul2ple  Creden2als  API •  Add  new  API  keys  and  users  to  your  account