SlackToolkit
init
- timeout (Optional[float]): The timeout value for API requests in seconds. If None, no timeout is applied. (default: :obj:
None
)
_login_slack
- slack_token (str, optional): The Slack API token. If not provided, it attempts to retrieve the token from the environment variable SLACK_BOT_TOKEN or SLACK_USER_TOKEN.
- ssl (SSLContext, optional): SSL context for secure connections. Defaults to
None
.
create_slack_channel
- name (str): Name of the public or private channel to create.
- is_private (bool, optional): Whether to create a private channel instead of a public one. Defaults to
True
.
join_slack_channel
get_slack_channel_information
function first to get the
channel id
.
Parameters:
- channel_id (str): The ID of the Slack channel to join.
leave_slack_channel
get_slack_channel_information
function first to get the
channel id
.
Parameters:
- channel_id (str): The ID of the Slack channel to leave.
get_slack_channel_information
get_slack_channel_message
get_slack_channel_information
function first to get the
channel id
.
Parameters:
- channel_id (str): The ID of the Slack channel to retrieve messages from.
send_slack_message
get_slack_channel_information
function first to get the
channel id
.
Parameters:
- message (str): The message to send.
- channel_id (str): The ID of the channel to send the message to.
- file_path (Optional[str]): The local path of a file to upload with the message.
- user (Optional[str]): The ID of a user to send an ephemeral message to (visible only to that user).
delete_slack_message
get_slack_channel_information
function first to get the
channel id
.
Parameters:
- time_stamp (str): The ‘ts’ value of the message to be deleted. You can get this from the
get_slack_channel_message
function. - channel_id (str): The ID of the channel where the message is. Use
get_slack_channel_information
to find thechannel_id
.