Skip to content

Slack_Channel_Bot is a C# console application that listens for messages in a specific Slack channel and responds to them based on certain keywords. It uses the RestSharp library for making API requests to the Slack API.

License

Notifications You must be signed in to change notification settings

seymenbahtiyar/Slack_Channel_Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Slack Channel Bot

Slack Channel Bot is a C# console application that listens for messages in a specific Slack channel and responds to them based on certain keywords. It uses the RestSharp library for making API requests to the Slack API.

Setup

  1. Create a new bot(app) in your Slack workspace and generate a bot token for it. And you must add the necessary bot scopes.
  2. Set the slackBotToken, slackChannelIDForListen, and slackBotUserID variables in the Program.cs file to the appropriate values for your Slack bot and channel.
  3. Run the application.

Usage

The SlackChannelBot listens for incoming messages in the specified Slack channel and responds to them based on certain keywords.

Available Commands

  • -help: Shows a list of available commands.

Example Usage

User: Hello!

Bot:

image

Methods

  • Main(string[] args): The entry point of the application. Initializes the application and starts listening for incoming messages.
  • GetLastMessage(): Retrieves the timestamp of the last message received in the specified Slack channel.
  • ListenForMessages(): Listens for incoming messages in the specified Slack channel and responds to them based on certain keywords.
  • SendMessage(string userId, string text): Sends a message to the specified user in the specified Slack channel.

Variables

  • slackBotToken: The bot token for authentication.
  • lastMessageTimestamp: A variable to store the timestamp of the last message received.
  • slackChannelIDForListen: The ID of the Slack channel where the bot will listen for incoming messages.
  • slackBotUserID: The ID of the Slack bot user.
  • slackBaseURL: The base URL for the Slack API.

License

MIT

About

Slack_Channel_Bot is a C# console application that listens for messages in a specific Slack channel and responds to them based on certain keywords. It uses the RestSharp library for making API requests to the Slack API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages