Setting up Slack Bot

Using Knit's Communication APIs, you can send text as well as interactive messages to any Slack channel or user either using Knit's Bot or your own Bot. In this guide, we will help you understand which kind of bot to use for development and for production. Read on to know more.

Using Knit's Slack Bot

🚧

Knit Slack Bot is meant for testing only and getting familiar with communication APIs. For the production use cases, you must setup their own bots.

If you wish to use Knit Slack Bot then it is super simple one step process . You just need to select Slack and a typical questions (similar to other apps) will be asked and you need to follow OAuth flow and app will be installed in your workspace.

However, this should be done only for development/testing. Please do not use Knit's Bot in production!


Using your own Bot

👍

You should use your own Bot in production. Do not use Knit's Bot for production use cases.

There are two simple steps to get started with your own Bot.

  1. Create your Bot with Slack.
  2. Register the OAuth creds like client ID and secret of your Bot with Knit.

1. Create your Bot with Slack

Follow these steps below to create a Bot on Slack.

1. Visit Your Apps and sign in with the account to create App.

2. Click on the option: Create new App

3. Select the option: From scratch

4. You will be asked Name of App and can choose workspace linked to signed in account in which you wish to create app. Click on: Create App

5. On clicking Basic Information in the left panel, at the end of page you can add Display Information like App Image, Description etc.

6.Now configure the redirect URL .

Things to consider:

  1. Use https://app.getknit.dev/oauth/authorize
  2. Do not forget to click on Save URLs.

7. Add following scopes

  • channels:read
  • chat:write
  • chat:write.customize
  • chat:write.public
  • groups:read
  • users:read
  • users:read.email

8. If you want to subscribe to other Slack events, click here and do the steps mentioned in this guide.

9. Congratulations! Your Bot setup is done. Next, you must enable public distribution of the Bot for your users to discover and use this new Bot. To begin, click on Manage Distribution on the left panel

10. To finally enable public distribution, just tick the checkbox for I’ve reviewed and removed any hard-coded information and then click on Activate Public Distribution button.

11. Congratulations! Your Bot is now available for others to install.

You have now created your own Slack Bot! There's one small step to go before you can use Knit's API on your new Bot. Read on!

2. Register the OAuth creds like client ID and secret of your Bot with Knit

Share Bot's client ID and client secret with Knit via Register OAuth Cred API and that's it. You're all set to use Knit's API!

📘

Do you want to receive updates about slack event like app un-installation, token revoked etc.? Add Knit webhook into your Slack Bot configuration. Click here for details.