Check out a free preview of the full Building a Slack Chat Bot course
The "Deploying to Netlify" Lesson is part of the full, Building a Slack Chat Bot course featured in this preview video. Here's what you'd learn in this lesson:
The application code and cron job are committed and pushed to the remote GitHub repo. Netlify is configured to deploy the application from a specific branch.
Transcript from the "Deploying to Netlify" Lesson
[00:00:00]
>> So the only thing that we have left to do here is actually deploy it, which will give us the ability to see this chron job running. So I'm gonna stop here and I'm going to see all these things that I've got, commit everything. Git commit, let me check out a new branch actually.
[00:00:23]
We'll call this a workshop. Okay, then I'm gonna git commit everything and say working chatops flow. We're gonna git push origin and workshop. Okay, so this is pushed up to my particular branch here. And then if I go into Netlify and look at my app, I've just deployed.
[00:01:00]
Let's see if I get past all my starred stuff. Here's my chat ops. And that was deployed at 9:26. So I think this is set up on the right one, but it's not using the branch that I want cuz I just pushed to my workshop branch. So, I'm gonna change that here to where right now it's on Main.
[00:01:23]
I'm gonna change it to Workshop. I'm gonna save. And then, I can go to My Deploys, and we'll deploy the site so that it uses the Workshop branch. And we can see up here that it's now using that Workshop branch when it deploys. So it's deploying our site, it's got our functions, and it should say that we have a scheduled function.
[00:01:52]
And if I go and look at my function setup here, we can see that we've got this one set up as a scheduled function now. And it should run in one minute. So any second now, we should see that actually execute. I missed a step, actually, because remember, we've got all those environment variables locally.
[00:02:16]
So we need to actually put those environment variables up on Netlify. And because we've got the .env file, this is actually Just delightfully straightforward. I can run ntl env import and then grab the .env file, And that pulls in all those details, which I will hide here. And then we're going to go back out and we're just gonna rebuild one more time now that we've got those environment variables because if I go and look at my settings here, now we'll see that they're actually there.
[00:02:51]
So they weren't there before. That's why it wasn't working. So we'll trigger one more deploy, only takes a few seconds because this is just a couple of functions. We don't have a lot of advanced anything going on in this. All right, that build is complete. Head back out to our functions we can see that our reminder is here.
[00:03:11]
It's scheduled to run every minute next execution in one minute. So we can collapse this down, hide this. And in a minute here we should see our function execute. There we go. So now we have a Notion bot, or a Notion app, I should say, and a Slack app that allow us to run slash commands to add something to our task queue.
[00:03:37]
We've got a shortcut that allows us to remind other people about how to follow that process and to use the slash command. We've got the ability to sync those slash command entries and save that input to Notion. And then we've got the ability for Notion to take that input and send it back using a cron job so that the team is able to see what they're on the hook for and make sure they stay on top of those incoming requests.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops