Npm i Installs the web Slack API that exposes API methods. This will give you a few prompts, no need to answer all of them, just keep pressing enter to use the default values. Navigate into the folder and initialize the project by running npm init. Open your terminal and create a new folder called autostandup or whatever name you find fitting. Send a confirmation message to the user.Įnough mambo jambo! Let’s look at some code.Process POST requests from Slack as a result of our users sending the /standup slash command.Let’s begin by recapping what the scope of our Node.js application will be. Great! Now that our Slack app is successfully configured and installed, we can begin working on the Node.js application. Our application will only be making use of the Bot User OAuth Access Token, copy it and save it privately. This will make the app available to the users in the workspace plus generate all the necessary tokens our application will need to make authenticated requests to Slack’s API.Īfter installing the app to your workspace, click the OAuth & Permissions menu item available to the right of the screen to get the authentication tokens we’ll be using. Creating a new workspace for testing is desirable and pretty much straight forward. ![]() Installing the Slack app directly into the workspace being used by your organization isn’t a great idea since a lot of testing is involved which may be disturbing to users. dialog/new endpoint persisting the standup details in our database and sending confirmation to the user. Once the dialogue is submitted we hit the. We’ll create a new slash command called /standup and set the webhook to our server side endpoint that will handle this action: To enable slash commands, click on the Slash Commands feature button as shown in the image above. ![]() Every time an action happens through a slash command or interactive component, Slack will make a POST request to our registered webhook and our application will need to respond accordingly. These features involve actions that are initiated by the user inside Slack. Set your bots Display Name and Default Username to auto standup or whatever name you find fitting.įor slash commands and interactive components to work, our app will need to provide webhooks that Slack can post to. To enable bot users, click on the “Bots” feature button as shown in the image above. Interactive Components – Any interactions with actions, dialogs, message buttons, or message menus will be sent to a URL you specify here. We’ll use this to allow the user to initiate a dialog for the standup. Slash Commands – This will allow users to invoke app methods that we expose. For our auto-standup bot to work, we’ll need to enable the following features:īot Users – This will enable our app to interact with users in a more conversational manner Next we’ll need to configure our new slack app with the features we’ll be using to achieve our needed functionality. If you don’t have a workspace, you can create one here. To create your new Slack app, go to this page and set your app name as well as the workspace you’ll be developing your app in. In our case, we’ll be adding our custom stand up functionality. Slack apps allow you to add more functionality into your Slack workspace. You’ll also need to have basic knowledge of the Express web framework as well as ngrok or any other secure tunneling service to make your localhost publicly reachable. Prerequisitesīefore getting started you will need to have node installed on your machine. Our app will allow users to submit their standups by invoking a slash command on Slack, which will fire up a dialog/form to submit their standups and send a confirmation message to the user once the standup is persisted to the database. In this tutorial, we’ll be building a Slack app called autostandup that provides functionality to submit standups. Since the app is pretty huge I will split the tutorial into various posts. This would save us from doing mundane compiling tasks and create a better experience for everyone involved… a.k.a laziness for the win :p. We decided to build a Slack app using Node.js. After some hours of reading and re-reading the Slack API documentation we realized we could make the idea a reality. I met another colleague from another team who had the same issue and had thought of building a bot that would compile standups for various teams and individuals. However, as time went by the task was too repetitive and had lots of back and forth reminding team members to send their standups. At first it was a great experience, and even better we could alternate shifts with another intern. ![]() After joining Ona as a Software Engineering Intern, I was tasked to compile and post standups for all the members of the project we were working on.
0 Comments
Leave a Reply. |