Fireship · @fireship

Transactional Email 101 📧 with SendGrid & Firebase Cloud Functions

Uploaded July 9, 2019 · Length 8:10

Transactional Email 101 📧 with SendGrid & Firebase Cloud Functions

Summary

Learn how to send transactional emails with SendGrid and Firebase Cloud Functions, including welcome emails, HTTP callable functions, and database triggers.

  • transactional email
  • sendgrid
  • firebase cloud functions
  • email marketing
  • serverless functions
  • email automation

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    almost every interactive app sends

  2. 0:01

    event-driven email on a per user basis

  3. 0:04

    in today's video we'll look at the

  4. 0:05

    fundamentals of transactional email

  5. 0:07

    you've got mail we'll look at strategies

  6. 0:09

    for sending email at the right time to

  7. 0:11

    increase user engagement and of course

  8. 0:13

    the technical implementation details

  9. 0:15

    with firebase cloud functions and the

  10. 0:17

    send grid transactional email API and

  11. 0:19

    this is also the first video in a new

  12. 0:21

    series called Minimum Viable Product

  13. 0:23

    where we start with a generic spec or

  14. 0:25

    requirement like how do I send email

  15. 0:27

    from my app then build a full stack

  16. 0:28

    solution with multiple front-end or

  17. 0:30

    back-end approaches in this tutorial

  18. 0:32

    you'll see the backend integration with

  19. 0:34

    cloud functions but if you want to

  20. 0:35

    extend it you can go to fire ship i/o

  21. 0:37

    and see integrations for angular react

  22. 0:39

    view svelte and flutter if you're new

  23. 0:41

    here like and subscribe and leave a

  24. 0:43

    comment below for a chance to win this

  25. 0:44

    t-shirt now the great thing about

  26. 0:46

    serverless functions is that they make

  27. 0:48

    it really easy to implement secure

  28. 0:50

    event-driven code today we'll write and

  29. 0:52

    deploy four different cloud functions

  30. 0:53

    each solving a specific problem the

  31. 0:55

    first one will send a welcome email when

  32. 0:57

    a new user signs up the second one is an

  33. 0:59

    HTTP function that can be called

  34. 1:01

    dynamically from your front-end code the

  35. 1:03

    third one is a fire store function which

  36. 1:05

    runs and responds to changes to the

  37. 1:07

    database and the fourth function is

  38. 1:09

    scheduled which allows you to send an

  39. 1:10

    email at a specific time or date we'll

  40. 1:13

    talk about these strategies in a little

  41. 1:14

    more detail as we go along but let's get

  42. 1:16

    started with the initial setup the first

  43. 1:18

    thing you'll need is a send grid account

  44. 1:19

    which is a paid service but it starts

  45. 1:21

    off with a free tier to get you started

  46. 1:22

    now you'll see a lot of different things

  47. 1:24

    on the send grid dashboard but the thing

  48. 1:26

    we're interested in is the transactional

  49. 1:28

    templates page from this page you'll

  50. 1:30

    want to create a new template and then

  51. 1:32

    add a version to it

  52. 1:33

    you can use your own custom HTML or you

  53. 1:35

    can go to their drag-and-drop editor but

  54. 1:37

    when it comes to dynamic transactional

  55. 1:39

    email you'll basically want to create a

  56. 1:41

    template that allows you to pass in a

  57. 1:42

    bunch of data to customize it on a per

  58. 1:44

    user basis and SendGrid uses handlebars

  59. 1:47

    to achieve this in their templates

  60. 1:48

    you'll notice over here on the left that

  61. 1:50

    we have the subject wrapped in

  62. 1:52

    handlebars that's because we'll be

  63. 1:53

    dynamically passing the subject from our

  64. 1:55

    back-end functions then in the email

  65. 1:57

    body we have hello handlebars name which