3. What
is
SendGrid?
• Cloud-‐based
SMTP
provider
• Massively
scalable
• AnalyCcs
on
emails
you
send
• Robust
APIS
for
developers
to
integrate
#delivered2012
4. If
you
learn
1
thing...
SendGrid
>
Email
Relay
#delivered2012
5. APIs
Overview
What
APIs
does
SendGrid
Offer?
• SMTP
API • Subuser
API
• Web
API • CredenCals
API
• NewsleNer
API • Event
Webhook
• Reseller
API • Inbound
Parse
Webhook
API
#delivered2012
6. 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
#delivered2012
7. What
I
got
out
of
lunch
Time is valuable.
Especially developer time.
#delivered2012
8. SMTP
API
Custom
SMTP
header
that
contains
instrucCons
on
how
to
process
your
email
X-SMTPAPI: { ... }
Add
extra
informaCon,
filters,
&
manipulaCons:
•
Define
mulCple
recipients
•
Text
SubsCtuCons
•
Categories
•
Unique
arguments
/
IdenCfiers
#delivered2012
11. Customer
Highlight
qup.tv
Queue,
rate,
or
watch
movies
on
Ne]lix
instant
with
one
click!
#delivered2012
12. 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)
#delivered2012
13. 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”
#delivered2012
14. 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
#delivered2012
15. NewsleEer
API
Access
the
SendGrid
newsleNer
app
via
the
API
https://sendgrid.com/api/newsletter/<ACTION>.<FORMAT>
You
can
create
&
manage...
•
NewsleNer
content
•
Recipient
lists
•
Sender
idenCCes
•
Scheduled
deliveries
#delivered2012
16. 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
#delivered2012
17. Event
No2fica2on
Webhook
Receive notifications when SendGrid events happen
POST
•Processed •Opened
•Dropped •Clicked Your
ApplicaCon
receives
•Delivered •Spam
Reported an
event
POST
•Bounced •Unsubscribed (like
a
form
submit)
#delivered2012
18. Event
No2fica2on
Webhook
What does an event notification look like?
{
"email":"john@example.com",
"timestamp": 1322000095,
"unique_arg":"some argument",
"event":"delivered"
}
#delivered2012
19. Event
No2fica2on
Webhook
Q:
Why
would
I
want
to
use
the
event
webhook?
A:
Use
it
to
enhance
your
exisCng
email
funcConality
and
gain
smart
customer
insight.
(It’s a very reactive API)
#delivered2012
20. 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
#delivered2012
21. Customer
Highlight
thebirdy.com
Answer
one
email
a
day,
and
track
what
you
spend.
Create
categories
by
tagging
your
purchases
like
#twiNer.
Super
simple.
#delivered2012
22. Inbound
Parse
Webhook
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
#delivered2012
23. 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
#delivered2012