Fireship · @fireship

Scheduled Cloud Functions - NOT for Robocallers

Uploaded April 23, 2019 · Length 7:30

Scheduled Cloud Functions - NOT for Robocallers

Summary

Create a scheduled task queue with Firebase Cloud Functions, using pub/sub and Firestore to run backend code at any time.

  • firebase cloud functions
  • scheduled tasks
  • pub/sub
  • firestore
  • task queue
  • backend code
  • cron schedule

Transcript preview

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

  1. 0:00

    yesterday you may have seen a video

  2. 0:01

    about building an industrial scale Robo

  3. 0:03

    collar I decided to take that video down

  4. 0:05

    and destroy all the physical copies

  5. 0:06

    because even though it's an obvious joke

  6. 0:07

    it's not the right way to be using those

  7. 0:09

    tools but the good news is that I recut

  8. 0:11

    that video and it keeps the most

  9. 0:12

    important part intact which is building

  10. 0:14

    a scheduled task queue with firebase

  11. 0:15

    cloud functions and make sure to leave a

  12. 0:17

    comment on this video for the t-shirt

  13. 0:18

    giveaway even if you left a comment on

  14. 0:20

    the original and lastly I just want to

  15. 0:22

    take a second to say thank you for

  16. 0:23

    supporting the channel

  17. 0:24

    20:19 has already exceeded my

  18. 0:25

    expectations and the video ID list seems

  19. 0:27

    to get longer and longer just don't

  20. 0:29

    expect any Robo color tutorials anytime

  21. 0:31

    soon

  22. 0:35

    - call me ASAP as possible Thanks

  23. 0:38

    Americans get at least 5 billion spam

  24. 0:40

    robo calls per month and that number

  25. 0:42

    gets bigger and bigger every year

  26. 0:43

    personally I get at least 10 of those

  27. 0:45

    calls per day and I finally just decided

  28. 0:47

    if you can't beat them join them in

  29. 0:49

    today's video we're going to not build a

  30. 0:51

    robo caller music and a brand new cloud

  31. 0:53

    function type from firebase but more

  32. 0:55

    importantly we're going to build a task

  33. 0:56

    runner that allows us to schedule any

  34. 0:58

    back-end code to run at any time if

  35. 1:00

    you're new here like and subscribe and

  36. 1:01

    you can find the whole source code on

  37. 1:03

    fire ship IO and leave a comment below

  38. 1:05

    for a chance to win this one-of-a-kind

  39. 1:06

    t-shirt next week so firebase released a

  40. 1:08

    new function type a couple days ago it's

  41. 1:10

    a pub sub function which allows you to

  42. 1:12

    pass messages in between Google services

  43. 1:14

    that is also integrated with Google

  44. 1:16

    cloud scheduler this means you can run

  45. 1:18

    any back-end code at a specific point in

  46. 1:19

    time using a cron tab schedule this is

  47. 1:22

    great if you know exactly when you want

  48. 1:23

    to schedule a job in advance but I want

  49. 1:25

    to push things a step further by

  50. 1:26

    integrating firestore to create a

  51. 1:28

    dynamic task runner that allows you to

  52. 1:30

    schedule a job at any point in time that

  53. 1:32

    allows you or your users to schedule

  54. 1:33

    anything dynamically such as

  55. 1:35

    notifications reminders or as we'll see

  56. 1:37

    soon definitely not robocallers make

  57. 1:40

    sure you have the latest version of

  58. 1:41

    firebase tools installed version 6.7 or

  59. 1:43

    version 2.3 of the firebase functions

  60. 1:46

    module from there we can initialize a

  61. 1:49

    new project by running firebase and it

  62. 1:50

    functions I'll be using typescript and

  63. 1:52

    you'll see why it's so valuable for a

  64. 1:54

    project like this in a few minutes let's

  65. 1:56

    start by taking a look at a basic

  66. 1:57

    schedule pub/sub function in the index

  67. 1:59

    TS i have a reference to the admin SDK