SendGrid Delivered API Workshop

2,302 views

Published on

SendGrid API Overview, from SendGrid Deliever Nov 8 2012

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,302
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • Scalable: thousands of emails per second, hundreds of millions per day, billions per month\n
  • Scalable: thousands of emails per second, hundreds of millions per day, billions per month\n
  • Scalable: thousands of emails per second, hundreds of millions per day, billions per month\n
  • Scalable: thousands of emails per second, hundreds of millions per day, billions per month\n
  • Install a gem called pony\nset some defaults\nconstruct a message and send it\ncheck that the email arrived\n
  • \n
  • - less logic in your code that triggers mailers\n - Events, stats, real-time\n - Scheduling and multiple recipients reduce need for worker\n - Respond to messages from inbox\n
  • - less logic in your code that triggers mailers\n - Events, stats, real-time\n - Scheduling and multiple recipients reduce need for worker\n - Respond to messages from inbox\n
  • - less logic in your code that triggers mailers\n - Events, stats, real-time\n - Scheduling and multiple recipients reduce need for worker\n - Respond to messages from inbox\n
  • - less logic in your code that triggers mailers\n - Events, stats, real-time\n - Scheduling and multiple recipients reduce need for worker\n - Respond to messages from inbox\n
  • - less logic in your code that triggers mailers\n - Events, stats, real-time\n - Scheduling and multiple recipients reduce need for worker\n - Respond to messages from inbox\n
  • Story about how/why the company was founded\nDevelopers are doers, so if they need to send email, they’re likely to fall down an email configuration rabbit hole and disappear\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • These categories and arguments are also passed as part of our event webhook, so it’s pretty easy to create a local archive of all mail events.\n
  • From Hack the Midwest, Kansas City, June 2012.\n
  • Apps example -- for password resets, bypass list management\n
  • Apps example -- for password resets, bypass list management\n
  • Apps example -- for password resets, bypass list management\n
  • Apps example -- for password resets, bypass list management\n
  • Apps example -- for password resets, bypass list management\n
  • \n
  • \n
  • - Best setup is to set up a local mail server that queues up messages and then relays through SendGrid\n - Handing your email off to fault tolerant machines\n - Graceful queuing and resending\n - Connection reuse and pipelining\n
  • - Best setup is to set up a local mail server that queues up messages and then relays through SendGrid\n - Handing your email off to fault tolerant machines\n - Graceful queuing and resending\n - Connection reuse and pipelining\n
  • - Best setup is to set up a local mail server that queues up messages and then relays through SendGrid\n - Handing your email off to fault tolerant machines\n - Graceful queuing and resending\n - Connection reuse and pipelining\n
  • - Best setup is to set up a local mail server that queues up messages and then relays through SendGrid\n - Handing your email off to fault tolerant machines\n - Graceful queuing and resending\n - Connection reuse and pipelining\n
  • - Best setup is to set up a local mail server that queues up messages and then relays through SendGrid\n - Handing your email off to fault tolerant machines\n - Graceful queuing and resending\n - Connection reuse and pipelining\n
  • \n
  • \n
  • Limits of the “spam report” events - not all providers, such as gmail, let us listen to that feedback loop.\nLimits of “open tracking” - requires an image to be displayed.\n
  • \n
  • - Job application example\n- React to bounces on the fly\n- Analyze user behavior and optimize\n- Red alerts\n
  • Possible use cases:\n - Respond to discussions\n - Upload file attachments\n - Post blog articles\n
  • \n
  • \n
  • Subuser use case - Someone that wants to manage their clients individually for stats, etc\nReseller use case - Windows Azure, Heroku, etc\nMultiple Credentials use case - EVERYONE should use this.\n
  • Subuser use case - Someone that wants to manage their clients individually for stats, etc\nReseller use case - Windows Azure, Heroku, etc\nMultiple Credentials use case - EVERYONE should use this.\n
  • Subuser use case - Someone that wants to manage their clients individually for stats, etc\nReseller use case - Windows Azure, Heroku, etc\nMultiple Credentials use case - EVERYONE should use this.\n
  • Subuser use case - Someone that wants to manage their clients individually for stats, etc\nReseller use case - Windows Azure, Heroku, etc\nMultiple Credentials use case - EVERYONE should use this.\n
  • Subuser use case - Someone that wants to manage their clients individually for stats, etc\nReseller use case - Windows Azure, Heroku, etc\nMultiple Credentials use case - EVERYONE should use this.\n
  • Subuser use case - Someone that wants to manage their clients individually for stats, etc\nReseller use case - Windows Azure, Heroku, etc\nMultiple Credentials use case - EVERYONE should use this.\n
  • API Workshop demo\nSwift’s Playlist Demo\n
  • \n
  • \n
  • \n
  • SendGrid Delivered API Workshop

    1. 1. API Workshop#SGDelivered
    2. 2. Hi, I’m Brandon. @brandonmwest brandon.west@sendgrid.com#SGDelivered
    3. 3. What is SendGrid?#SGDelivered
    4. 4. What is SendGrid? • Cloud-based SMTP provider#SGDelivered
    5. 5. What is SendGrid? • Cloud-based SMTP provider • Massively scalable#SGDelivered
    6. 6. What is SendGrid? • Cloud-based SMTP provider • Massively scalable • Analytics on emails you send#SGDelivered
    7. 7. What is SendGrid? • Cloud-based SMTP provider • Massively scalable • Analytics on emails you send • Robust APIs for developers to integrate#SGDelivered
    8. 8. If you learn 1 thing... SendGrid > Email Relay#SGDelivered
    9. 9. APIs Overview Q: Why should I care about the SendGrid APIs?#SGDelivered
    10. 10. APIs Overview Q: Why should I care about the SendGrid APIs? A: There are a lot of reasons, but the#SGDelivered
    11. 11. APIs Overview Q: Why should I care about the SendGrid APIs? A: There are a lot of reasons, but the • Reduce code complexity#SGDelivered
    12. 12. APIs Overview Q: Why should I care about the SendGrid APIs? A: There are a lot of reasons, but the • Reduce code complexity • Deeper analytics & tracking#SGDelivered
    13. 13. APIs Overview Q: Why should I care about the SendGrid APIs? A: There are a lot of reasons, but the • Reduce code complexity • Deeper analytics & tracking • Less resource consumption#SGDelivered
    14. 14. APIs Overview Q: Why should I care about the SendGrid APIs? A: There are a lot of reasons, but the • Reduce code complexity • Deeper analytics & tracking • Less resource consumption • Better UX#SGDelivered
    15. 15. Why Use SendGrid? Time is valuable.Especially developer time.#SGDelivered
    16. 16. APIs Overview What APIs does SendGrid Offer? API#SGDelivered
    17. 17. APIs Overview What APIs does SendGrid Offer? • SMTP API API#SGDelivered
    18. 18. APIs Overview What APIs does SendGrid Offer? • SMTP API • Web API API#SGDelivered
    19. 19. APIs Overview What APIs does SendGrid Offer? • SMTP API • Web API • Newsletter API API#SGDelivered
    20. 20. APIs Overview What APIs does SendGrid Offer? • SMTP API • Web API • Newsletter API • Reseller API API#SGDelivered
    21. 21. APIs Overview What APIs does SendGrid Offer? • SMTP API • Subuser API • Web API • Newsletter API • Reseller API API#SGDelivered
    22. 22. APIs Overview What APIs does SendGrid Offer? • SMTP API • Subuser API • Web API • Credentials API • Newsletter API • Reseller API API#SGDelivered
    23. 23. APIs Overview What APIs does SendGrid Offer? • SMTP API • Subuser API • Web API • Credentials API • Newsletter API • Event Webhook • Reseller API API#SGDelivered
    24. 24. APIs Overview What APIs does SendGrid Offer? • SMTP API • Subuser API • Web API • Credentials API • Newsletter API • Event Webhook • Reseller API • Inbound Parse Webhook API#SGDelivered
    25. 25. SMTP API Custom SMTP header that contains instructions on how to process your email X-SMTPAPI: { ... } Add extra information, filters, & manipulations:#SGDelivered
    26. 26. SMTP API Custom SMTP header that contains instructions on how to process your email X-SMTPAPI: { ... } Add extra information, filters, & manipulations: • Define multiple recipients#SGDelivered
    27. 27. SMTP API Custom SMTP header that contains instructions on how to process your email X-SMTPAPI: { ... } Add extra information, filters, & manipulations: • Define multiple recipients • Text Substitutions#SGDelivered
    28. 28. SMTP API Custom SMTP header that contains instructions on how to process your email X-SMTPAPI: { ... } Add extra information, filters, & manipulations: • Define multiple recipients • Text Substitutions • Categories#SGDelivered
    29. 29. SMTP API Custom SMTP header that contains instructions on how to process your email X-SMTPAPI: { ... } Add extra information, filters, & manipulations: • Define multiple recipients • Text Substitutions • Categories • Unique arguments / Identifiers#SGDelivered
    30. 30. SMTP API Example: Billing notification X-SMTPAPI: { "to": ["brandon.west@sendgrid.com"], "category": "billing_notifications", "unique_args": { "user_id": "12345" }, "sub": { "%amount%": ["$9.95"] } }#SGDelivered
    31. 31. SMTP API Example: Billing notification (cont)#SGDelivered
    32. 32. Metadata from Rails # Set headers for SendGrid. def add_sendgrid_headers(action, args) mailer = self.class.name args = Hash[ method(action).parameters.map(&:last).zip(args) ] headers "X-SMTPAPI" => { category: [ mailer, "#{mailer}##{action}" ], unique_args: { environment: Rails.env, arguments: args.inspect } }.to_json end#SGDelivered
    33. 33. Metadata from Railsclass ApplicationMailer < ActionMailer::Base # Call add_sendgrid_headers after generating each mail. def initialize(method_name=nil, *args) super.tap do add_sendgrid_headers(method_name, args) if method_name end end private # Set headers for SendGrid. def add_sendgrid_headers(action, args) mailer = self.class.name args = Hash[ method(action).parameters.map(&:last).zip(args) ] headers "X-SMTPAPI" => { category: [ mailer, "#{mailer}##{action}" ], unique_args: { environment: Rails.env, arguments: args.inspect } }.to_json endend#SGDelivered
    34. 34. Rails Metadata#SGDelivered
    35. 35. Customer Highlight qup.tv Queue, rate, or watch movies on Netflix instant with one click!#SGDelivered
    36. 36. Web API Send mail or manipulate SendGrid settings via HTTP Anything (almost) you can do from the#SGDelivered
    37. 37. Web API Send mail or manipulate SendGrid settings via HTTP Anything (almost) you can do from the • Edit profile / account information#SGDelivered
    38. 38. Web API Send mail or manipulate SendGrid settings via HTTP Anything (almost) you can do from the • Edit profile / account information • Add new Incoming Parse endpoints#SGDelivered
    39. 39. Web API Send mail or manipulate SendGrid settings via HTTP Anything (almost) you can do from the • Edit profile / account information • Add new Incoming Parse endpoints • Retrieve stats#SGDelivered
    40. 40. Web API Send mail or manipulate SendGrid settings via HTTP Anything (almost) you can do from the • Edit profile / account information • Add new Incoming Parse endpoints • Retrieve stats • Manage lists (Bounces, Blocks, Unsubscribes, etc.)#SGDelivered
    41. 41. Web API Send mail or manipulate SendGrid settings via HTTP Anything (almost) you can do from the • Edit profile / account information • Add new Incoming Parse endpoints • Retrieve stats • Manage lists (Bounces, Blocks, Unsubscribes, etc.) • Add / Remove filters (apps)#SGDelivered
    42. 42. Web API Web API endpoints have the following https://sendgrid.com/api/<MODULE>.<ACTION>.<FORMAT>#SGDelivered
    43. 43. Web API Web API endpoints have the following https://sendgrid.com/api/<MODULE>.<ACTION>.<FORMAT> Example: Send Email over HTTP#SGDelivered
    44. 44. Web API Web API endpoints have the following 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”#SGDelivered
    45. 45. Web API vs. SMTP Q: Why would I use HTTP instead of SMTP? (Don’t worry, this is a really common question)#SGDelivered
    46. 46. Web API vs. SMTP 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...#SGDelivered
    47. 47. Web API vs. SMTP 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#SGDelivered
    48. 48. Web API vs. SMTP 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#SGDelivered
    49. 49. Web API vs. SMTP 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#SGDelivered
    50. 50. Web API vs. SMTP 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#SGDelivered
    51. 51. Newsletter API Access the SendGrid newsletter app via the API https://sendgrid.com/api/newsletter/<ACTION>.<FORMAT> • Newsletter content • Recipient lists • Sender identities • Scheduled deliveries#SGDelivered
    52. 52. Webhooks Q: What are Webhooks? WEB HOOK#SGDelivered
    53. 53. 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#SGDelivered
    54. 54. Event Notification Receive notifications when SendGrid events happen HTTP POST (like a form submit)#SGDelivered
    55. 55. Event Notification Receive notifications when SendGrid events happen HTTP POST (like a form submit) •Processed •Opened •Dropped •Clicked •Delivered •Spam Reported •Bounced •Unsubscribed#SGDelivered
    56. 56. Event Notification What does an event notification look like? { "email":"john@example.com", "timestamp": 1322000095, "unique_arg":"some argument", "event":"delivered" }#SGDelivered
    57. 57. Event Notification Q: Why would I want to use the event A: Use it to enhance your existing email functionality and gain smart customer insight. reactive API) (It’s a very#SGDelivered
    58. 58. Inbound Parse Lets you receive email in your application EMAIL POST#SGDelivered
    59. 59. Inbound Parse Lets you receive email in your application EMAIL POST 1. User sends email to *@yourapplication.com 2. SendGrid parses email & attachments 3. SendGrid POSTs the email to your application#SGDelivered
    60. 60. Customer Highlight thebirdy.com Answer one email a day, and track what you spend. Create categories by tagging your purchases like #twitter. Super simple.#SGDelivered
    61. 61. Inbound Parse 1. Configure your hostname and URL settings http://sendgrid.com/developer/reply 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#SGDelivered
    62. 62. Additional APIs#SGDelivered
    63. 63. Additional APIs Subuser API#SGDelivered
    64. 64. Additional APIs Subuser API • Manage and control subuser accounts#SGDelivered
    65. 65. Additional APIs Subuser API • Manage and control subuser accounts Reseller API#SGDelivered
    66. 66. Additional APIs Subuser API • Manage and control subuser accounts Reseller API • For partners who want to integrate their platform with SendGrid#SGDelivered
    67. 67. Additional APIs Subuser API • Manage and control subuser accounts Reseller API • For partners who want to integrate their platform with SendGrid Multiple Credentials API#SGDelivered
    68. 68. Additional APIs Subuser API • Manage and control subuser accounts Reseller API • For partners who want to integrate their platform with SendGrid Multiple Credentials API • Add new API keys and users to your account#SGDelivered
    69. 69. Demo Time! http://github.com/theycallmeswift#SGDelivered
    70. 70. Questions?#SGDelivered
    71. 71. Resources • Documentation/API Workshop: http://docs.sendgrid.com/ • Official Libraries: https://github.com/ sendgrid/ • Support: http://support.sendgrid.com/#SGDelivered
    72. 72. Thanks! @brandonmwest brandon.west@sendgrid.com#SGDelivered

    ×