Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/miteshsharma/slackbot

Creating a slack bot with event API, web API, and RTM stream connection to chat with a bot in specified channel
https://github.com/miteshsharma/slackbot

golang notification slackbot test

Last synced: 7 days ago
JSON representation

Creating a slack bot with event API, web API, and RTM stream connection to chat with a bot in specified channel

Awesome Lists containing this project

README

        

# Go SlackBot

We are running an slack bot that listens to bot messages in a specified channel to reply to user. This connection is created using RTM stream connection with slack.

Slack Channel --> Message to SlackBot --> Parse Message --> Reply --> Go to slack channel

Slack parameters needed:

1. token: Bot User OAuth Token in OAuth & Permissions
2. channelName: Default channel to be used
3. signingSecret: Available in App Credentials
4. clientId: Available in App Credentials
5. clientSecret: Available in App Credentials

Add slack button: https://api.slack.com/docs/slack-button

Enable Home tab to show home screen:

Screenshot 2022-09-25 at 4 50 27 PM

Add interactivity URL for callbacks in section: Interactivity & Shortcuts

URL from current project: /api/v1/slack/interaction

Add slash comment in section: Slash Commands

Slash comment API: /api/v1/slack/command (All commands handled in same API)

Screenshot 2022-09-25 at 4 52 01 PM

Enable events API callback on receiving mentions, home page view etc to take action in Event Subscriptions section:

Event API: /api/v1/slack

Screenshot 2022-09-25 at 4 52 48 PM

Subscribe bot for different events that we want to be called in event API webhook specified:

Screenshot 2022-09-25 at 4 53 02 PM