1. Login to slack app
- create a workspace
2. Create a Slack App
- Go to https://api.slack.com/apps
- Click "Create An App"
- Select "From scratch"
- Enter an App Name (e.g., "check blocked users") and select your workspace
- Click on "Create App"
- You will get 'Basic information' interface
- Under the 'Basic information', open "Add features and functionality"
3. Creating Bot
- Select "Bots".
- You will be redirected to "App Home".
- Under the "First, assign a scope to your bot token", click the button "Review Scopes to Add".
- You will be redirected to "OAuth & Permissions".
- Under the "OAuth & Permissions", scroll to "Scopes", open "Bot Token Scopes".
- Click on "Add an OAuth Scope".
- Add
app_mentions:read
To view messages (that directly mention @checkblockedusers in conversations). - Add
chat:write
to (send messagae as @checkBlockedUser). - Add
channels:history
(View messages and other content in public channels that checkusers has been added to) - Scroll up to "OAuth Tokens for Your Workspace" and click on "Install to Workspace".
4. Get Your Bot Token
- Click on "Allow", you will be redirected to "OAuth and Permissions" again,
- Copy the "Bot User OAuth Token" and save it for later use in firebase functions.
5. Set Up Event Subscriptions
- In the left sidebar, click on "Event Subscriptions" and "Enable Events".
- In the Request URL, paste the webhook url, where you want to get events, i.e onRequest cloud function URL in our case. which well get afer step 6.
- Open "Subscribe to bot events", add
app_mention:read
- Click "Save Changes" at the bottom of the page
6. Setup firebase cloud functions
- create onRequest firebase cloud fucntion and deploy it, copy the function url to paste in "Event subscription"
7. Add Your App to a Channel
- Open your Slack workspace
- Go to the channel where you want to add the bot
- Type /invite @YourBotName (replace with your bot's username)
8. Test bot
- Mention bot with text such as "@YourBotName abc" or "@YourBotName test@gmai.com".
- Your bot should respond with whether the user is blocked or not