Skip to content

Latest commit

 

History

History
186 lines (113 loc) · 7.29 KB

notes.md

File metadata and controls

186 lines (113 loc) · 7.29 KB

Learn to code with TwilioQuest

Understanding Webhooks

Unit 1 - Integration

In this unit we will focus on combining applications together. We'll do this by handling events triggered by applications.

Video 1 - Welcome

Prerequisites

📚 Learn more

Video 2 - Defining Events, Handlers, and Hooks

📚 Learn more

Video 3 - Lightbulb moment

💡 Ideas

  • Think about the weather. Do you want to use the light if it gets rainy/snowy/chilly/hot?
  • What about your location? Want to trigger something when you leave a certain area at a certain time?
  • Think about notifications you get on your phone. Would those be cool to light up the weird dog lamp thing?
  • What about controlling your lights based on a text message?

📚 Learn more

Video 4 - Finding Inspiration

Unit 2 - Capturing Data from a Webhook

In this unit we'll take a look at a specific Webhook implementations GitHub and Discord.

Video 1 - Diving into Webhooks

Video 2 - Explore the Request

Video 3 - Using the Data

Video 4 - Developing Locally

⚠️ I made a mistake! I cloned in my ~/Code directory because I forgot to cd courses.

Installations

Video 5 - Opening a Tunnel

Installations

Install nodemon:

npm install -g nodemon

📚 Learn more

Video 6 - Serverless

npm install netlify-cli -g

📚 Learn more

🖊 Correction

📓 I figured out what my problem was! After you change environment variables in Netlify, you need to re-deploy. That's the reason it worked once I re-deployed it. I decided to keep the bugs in there so you know that we all make mistakes. Also it should give you some first hand knowledge of how to debug a webhook.

I hope you enjoy the lemonade made from the lemons of that bit 🍋s.

Unit 3 - Hooking it altogether

In this unit we'll build an entire application that leans almost entirely on the concept of Webhooks. We'll build an idea capturing hotline that transcribes the ideas and then sends you a text message.

Video 1 - Introducing the projects

Video 2 - Text Affirmation

The following TwiML will send a text message when set up to handle incoming messages.

<Response>
    <Message>You got this!💪</Message>
</Response>

This is using a Webhook. When the message comes in, control is passed to your application (it just happens to be in a TwiML Bin), and you return these instructions.

📚 Learn more

Video 3 - Setting up the flow

📚 Learn more

Video 4 - Handle things locally

npm install twilio-cli -g

Optionally on a Mac, you could use Homebrew

brew tap twilio/brew && brew install twilio

Install the Serverless Toolkit plugin:

twilio plugins:install @twilio-labs/plugin-serverless

Serverless Function boilerplate:

exports.handler = (context, event, callback) => {
  callback(null, "Hi mom!");
};

Start your local development server

twilio serverless:start

Video 5 - Deploying your serverless function

twilio serverless:deploy

Video 6 - That’s a Wrap