Slack Communication Module

Module Location: groclake.toollake.comm.slack

Overview

The Slack module in Toollake allows users to send messages to Slack channels using the Slack SDK. This is particularly useful for real-time notifications, team communication, and automated status updates.

Setup Requirements

To use the Slack module, ensure you have the following: āœ… Slack Bot Token (Set as an environment variable: SLACK_BOT_TOKEN) āœ… Install required packages:

pip install slack-sdk python-dotenv

Class: Slack

The Slack class provides an interface to send messages to Slack channels.

Method: send_message(payload)

Sends a message to a specified Slack channel.

Parameters

Parameter
Type
Description

payload

dict

Dictionary containing message details

message

str

The text message to be sent

channel

str

The Slack channel where the message should be sent (e.g., #general)

Returns

A dictionary with a success message or an error message in case of failure.

Example Usage

from groclake.toollake.comm.slack import Slack

slack = Slack()
response = slack.send_message({
    "message": "Hello team!",
    "channel": "#general"
})
print(response)  # {"message": "Message Sent Successfully"}

Last updated