Most developers know about SendGrid's SMTP relay services and the deliverability benefits, but did you know that there are also a host of other SendGrid APIs that can make your life even easier? Join SendGrid's developer evangelists Swift and Brandon West as they break down the available APIs and teach you how to use them to unleash the full power of email in your application.
1. The Power of Email APIs
Presenters:
Swift and Brandon West
2. Swift
swift@sendgrid.com
@SwiftAlphaOne
Brandon West
brandon.west@sendgrid.com
@brandonmwest
#SGWebinar
3. What is SendGrid?
• Cloud-based SMTP provider
• Massively scalable
• Analytics on emails you send
• Robust APIS for developers to integrate
#SGWebinar
5. Overview of the SendGrid APIs
• SMTP API • Inbound Parse
• Web API Webhook
• Event Webhook • Reseller API
API
#SGWebinar
6. SMTP API
• Custom SMTP header that contains
instructions on how to process your
email
• Define multiple recipients
• Text Substitutions
• Categories
•Unique arguments / Identifiers
#SGWebinar
8. 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)
#SGWebinar
9. Web API
• If you don’t have access to SMTP, you can
use the Web API to 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”
#SGWebinar
10. Webhooks
• Webhooks are like an inverse API call;
you define the endpoint, and we POST
WEB
HOOK
#SGWebinar
11. Event Notification Webhook
Receive notifications when SendGrid events happen
POST
•Processed •Opened
•Dropped •Clicked Your Application receives
•Delivered •Spam an event POST
•Bounced Reported (like a form submit)
#SGWebinar
12. Event Notification Webhook
What does an event notification look like?
{
"email":"john@example.com",
"timestamp": 1322000095,
"unique_arg":"some argument",
"event":"delivered"
}
#SGWebinar
13. Inbound Parse Webhook
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
#SGWebinar
14. Inbound Parse Webhook
(Setup Guide)
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
#SGWebinar
15. Additional APIs
• Customer Subuser API
– Manage and control subuser accounts
• Reseller API
– For partners that want to integrate their
platform with SendGrid
#SGWebinar