in your Coda workspace. (This tutorial will walk you through how to do both!) The app will be the bot that actually sends messages in Slack, and the Pack in Coda will allow you to trigger the app to send those messages from within a doc.
Getting Ready
Before diving in, you’ll want to have some links and assets handy:
api.slack.com/apps
a test channel in your Slack workspace
a properly sized high-resolution logo if you want your bot to have one
And of course, keep this doc open so that you can refer to it along with the video.
Video Walkthrough
Prefer to follow along with a video instead of following text instructions? You can play the video below to follow along with the step by step instructions.
Step-by-Step Text Instructions
Once you’ve gathered the necessary assets and links, you can start building your Slackbot system! You’ll begin by building a Slackbot app.
Click the “Create New App” button. When prompted, select the “From scratch” option (not “From manifest”).
Give your app a name and select the Slack workspace to create it in, then click “Create App.”
From here, you’ll be able to manage and edit your new Slack app.
Add Scopes to Your App
From here, you’ll be able to manage and edit your new Slack app. There are only two steps you’ll need to take to finish configuring your app in Slack: adding OAuth scopes and installing the app in your workplace. This will generate an OAuth bot token that your Coda pack can use to talk to
Think of scopes as individual keys that open different doors, and the OAuth bot token as the key ring that holds those keys. You need to give your Slack bot a key to each action that you want to allow it to take. In our case, we’ll just need two keys: chat:write and chat:write.public.
Click the “Bots” card under the “Add features and functionality” heading. From there, you’ll see a screen labeled “App Home.” Under “First, assign a scope to your bot token,” click the “Review Scopes to Add” button.
This will take you to a page labeled “OAuth and Permissions.” Scroll about halfway down until you see the content block labeled “Scopes”.
Click the “Add an OAuth Scope” button under “Bot Token Scopes.” Make sure you click the button under “Bot Token Scopes” and not “User Token Scopes.”
Once you do this, you’ll be prompted to make a selection from a dropdown list. Begin typing “chat” and select the ”chat:write.public” once it appears as a search result.
Once you click on “chat:write.public,” you’ll see a warning popup:
Click “Add scopes” to add both scopes to your app. The result will look like this:
Install the App to Your Workspace (and Generate an OAuth Token)
Next, you’ll install the app into your Slack workspace in order to generate a bot OAuth token. Your Coda Pack will use this token to talk to Slack’s API and perform actions as your bot.
If you’ve just added the scopes to your bot token, you’ll already be on the app management page labeled “OAuth & Permissions.” From here you can click the “Install to Workspace” button:
You can also access the “Install to Workspace” option from the “Basic Information” app management page:
Note that depending on your workspace’s settings, you may be requesting permission to install. Work with your org if this is the case!
Once you get here, you’ll be temporarily done with your Slack app’s configuration, and we’ll move on to creating your Coda Pack!
Create your Coda Pack and add and update the code
Navigate to coda.io. You should see your workspace homepage. In the lefthand nav, look for “Packs” under your workspace name. (If you are a member of more than one workspace, make sure you’re in the correct one.)
Click the “Create a Pack” button in the upper righthand corner.
Select “Start with an empty Pack.”
Go ahead and give your Pack a memorable name now!
Add the code from this doc to your Pack
Even though you’re starting with an empty Pack, a tiny bit of helper code will still show up in the new Pack you’ve just created. Highlight and delete everything so you see a blank code editor.
Copy/paste the entire block of code into your new Pack.
Insert your OAuth token in the Pack code
Your code will need a couple of small edits in order to work. Specifically:
In line 49 of the Pack’s code, replace [YOUR BEARER TOKEN GOES HERE] with the Bot User OAuth token from your Slack app:
Make sure that in doing this you remove the [ and ] brackets!
Repeat this exact step at line 82.
Click “Build” to compile your Pack!
Test your Pack
As soon as you click “Build” in your new Pack, you should see the option to create a test doc. You can choose to test your Pack in a brand new doc using this button, or in an existing doc by installing it in any of your docs.
To test your new Pack, create a new table or add columns to an existing table. Keep in mind that you’ll need to use the ID from the channel you want to send to.
Customize how your Slack App looks
Back in your Slack app’s management page, you can customize your app a bit. Under “Basic Information” for your Slack app, you can scroll toward the bottom of the page until you see “Display Information,” where you can update the look and feel of your Slack App:
🥳🥳🥳 Install your Pack in your Coda docs and let your creativity run wild!
Want to print your doc? This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (