Skip to content

This workshop will help you get started with the Twilio SendGrid Mail Send API and Dynamic Templates.

License

Notifications You must be signed in to change notification settings

TwilioDevEd/twilio_sendgrid_101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twilio SendGrid 101: An Introduction to Sending Transactional Email

Contents

Workshop description

Email is reliable, global, and offers flexibility that can't be met by other communications channels.

In this workshop, you'll learn how to implement the Twilio SendGrid Email API, and you can expect some deliverability tips to help you start sending at scale. What kind of scale? In 2022, SendGrid sent more than 1.6 trillion messages — 50 billion of which were sent during the Black Friday and Cyber Monday week alone while maintaining a 99 percent delivery rate.

You'll also see how the SendGrid dynamic templating system makes it possible to personalize your messages for each customer, allowing you to build lasting connections with your audience.

Documentation and resources

The following documentation and resources will help you build upon what you learn in this workshop.

Twilio SendGrid documentation and API reference

Transactional vs Marketing email

Mail Send API quickstarts by language

API keys and environment variables

Helper libraries

Design and template documentation

Sender verification documentation

More information about Sender Identity and email authentication

Sending attachments with Node.js

Workshop outline

This outline provides abbreviated steps to help you follow along with the workshop. You can use this outline and the app in the 5K9 directory to replicate the workshop on your own.

Prerequisites and setup

  1. Sign up for a SendGrid account.
  2. Create and store an API key.
  3. Domain authentication.

Workshop steps

  • Introduction
    • Overview
      • Mail Send API
      • Transactional vs marketing email
      • Templates and personalization
      • Deliverability
    • App overview
      • Twilio SendGrid App
      • Gmail inbox
      • Running app
        • Goofy intro about 5K9
        • Show form fill and receipt of confirmation email
  • Transactional vs marketing email
    • Definitions and examples
    • 80/20 ratio for transactional messages
  • Building the app
    • Build signup-confirmation.js
      • Helper library
        • Install helpler library: npm i @sendgrid/mail
        • Import helper: const sg = require("@sendgrid/mail");
      • API keys
        • Set API key: sg.setApiKey(process.env.SENDGRID_API_KEY);
        • Create an API key in the SendGrid UI
          • Restricted access key
      • Message object
        • Create and explain msg {} object and fields.
          • to: "wadec.demos@gmail.com"
          • from: "wadec.demos@gmail.com"
          • subject: "Welcome to 5K9"
          • html: "Hello, <strong>Runner</strong>!"
      • Send first request
      • Deliverability
        • Examine message warning
        • SPF, DKIM
        • Complete domain authentication
          • Automated security benefits
          • Send to a coworker
      • Modify code and send a second request: from: {email: "signup@5k9.run"}
      • Show warning is gone
      • Drop full code sample
        • Callout
          • Set to address from reqData
          • Set from from process.env
      • Templates
        • Prepare code
          • Stage templateId
          • Set dynamicTemplateData from reqData
        • Build a template
          • Add template
          • Add version
            • Show premade templates
            • Design Editor benefits
            • Quick overview
            • Show modified template with dog
        • Handlebars
          • Walk handlebars examples in template
            • Variable replacement
            • Conditionals
        • Switch template version for Halloween

About

This workshop will help you get started with the Twilio SendGrid Mail Send API and Dynamic Templates.

Topics

Resources

License

Stars

Watchers

Forks