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

SendGrid API Workshop - SendGrid Delivered NYC

10831877bd394c902f1dda20524c86d6?s=47 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



September 12, 2012


  1. #delivered2012 API  Workshop

  2. #delivered2012 Hi,  I’m  Swi3. swift@sendgrid.com @SwiftAlphaOne

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

     scalable • AnalyCcs  on  emails  you  send • Robust  APIS  for  developers  to  integrate
  4. #delivered2012 If  you  learn  1  thing... SendGrid  >  Email  Relay

  5. #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
  6. #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
  7. #delivered2012 What  I  got  out  of  lunch Especially developer time.

    Time is valuable.
  8. #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: { ... }
  9. #delivered2012 SMTP  API Example:  Billing  noCficaCon X-SMTPAPI: { "to": ["swift@sendgrid.com"],

    "category": "billing_notifications", "unique_args": { "user_id": "12345" }, "sub": { "%amount%": ["$9.95"] } }
  10. #delivered2012 SMTP  API Example:  Billing  noCficaCon  (cont)

  11. #delivered2012 Customer  Highlight qup.tv Queue,  rate,  or  watch  movies  on

     Ne]lix  instant  with  one  click!
  12. #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)
  13. #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 “to=john@example.com” \ -d “from=hello@myapp.com” \ -d “subject=hello world email” \ -d “text=some body text” \ -d “api_user=your_sendgrid_username” \ -d “api_key=your_sendgrid_key”
  14. #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
  15. #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>
  16. #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
  17. #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
  18. #delivered2012 What does an event notification look like? { "email":"john@example.com",

    "timestamp": 1322000095, "unique_arg":"some argument", "event":"delivered" } Event  No2fica2on  Webhook
  19. #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)
  20. #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
  21. #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.
  22. #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
  23. #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
  24. #delivered2012 Demo Time! http://github.com/theycallmeswift

  25. #delivered2012 Questions?

  26. #delivered2012 Resources • DocumentaCon:  hNp://docs.sendgrid.com/ • Official  Libraries:  hNps://github.com/sendgrid/ •

    Support:  hNp://support.sendgrid.com/
  27. #delivered2012 Swi3. swift@sendgrid.com @SwiftAlphaOne