In this unit we will focus on combining applications together. We'll do this by handling events triggered by applications.
- 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?
- The dog lamp LIFX lightbulb
In this unit we'll take a look at a specific Webhook implementations GitHub and Discord.
- First blog post about "Web hooks" - Wayback machine
- 📹 Web Hooks and the Programmable World of Tomorrow- 2009 talk about Webhooks @ Google
~/Code
directory because I forgot to cd courses
.
- 14 ways to open Command Prompt in Windows 10
- Install Git
- Install Node
- Install npm
- Install Visual Studio Code
- Optional - Connect GitHub with ssh
Install nodemon:
npm install -g nodemon
npm install netlify-cli -g
- Making asynchronous programming easier with async and await
- Netlify Dev - Local server
- Cloud Computing Providers - GitHub
📓 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.
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.
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.
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
twilio serverless:deploy