Table of Contents
Introduction
Introduction
Jason Lengstorf introduces the course and makes the case for using chatops to improve communication processes and reduce administrative tasks.Project Overview
Jason walks through the accounts and tooling required for the course. GitHub, Slack, Notion, and Netlify accounts will be required to complete the course, along with Node version 16 and the Netlify CLI. The free tier of each platform is all that is required.
Application Setup
Creating a Netlify Tunnel
Jason sets up the live tunnel using the Netlify CLI. The live tunnel makes the local development environment publicly available through a URL generated by Netlify.Slack App Setup
Jason creates the Slack application and adds it to the test workspace. Scope permissions are assigned, and the slash command is configured.API Credentials
Jason saves the API credentials in the project and uses them to permit the application to send messages back through the API to the user. A utility method is created to eliminate duplicate boilerplate code for fetch requests.Sending a Command
Jason creates a function for handling the slash command from Slack. When the command is sent to the API, the handler validates the input and returns a message to Slack. Before the slash command can be run, the application must be added to the channel.
Exploring Slack Bot Features
Securing the Application
Jason creates another utility method for ensuring requests to the Slack bot are API requests from Slack and not a malicious third party. The SLACK_SIGNING_SECRET environment variable is combined with a hashing algorithm to authenticate the request.Slack Block Kit
Jason introduces the Slack Block Kit UI framework. It allows developers to customize the order and appearance of information in the application. Users can be guided through the application's capabilities with composable, updating, and sequencing blocks.Generating a Modal
Jason uses a modal to display the blocks when the command is triggered. The handleSlashCommand method will send a modal when it receives the "/foodfight" slash command.Handling User Input
Jason updates the application endpoint to handle the user input and return a message to Slack. The returned message displays in the same channel and includes a mention of the user along with their submitted message.Handling a Shortcut
Jason creates a shortcut in the Slack UI to ask a user to use the slash command. This is encourages team members to adhere to a process in a less intrusive way and reduces friction on the team.
Using a Notion Database
Integration with Notion
Jason creates a Notion integration which will allow the Slack application to send data to a Notion database. An example database is provided and can be duplicated into individual Notion accounts. A notionAPI helper method is also created.Getting Items from Notion
Jason creates a helper method to retrieve a list of items from the Notion database. It filters based on the status of "new" so items already in progress or completed are not returned.Saving Items to Notion
Jason creates a helper method to save items to the Notion database. The saveItem method will get called any time a new food fight message is submitted from the modal in Slack.Creating a Reminder
Jason creates a cron job to run at a set interval and posts a list of unaddressed items to the slack channel.Deploying to Netlify
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.