Module trase.tools.slack.send_slack_message

This script sends a message to a specified Slack channel using the Slack API and AWS Secrets Manager.

The script retrieves the Slack API token from AWS Secrets Manager, uses the channel ID of the specified Slack channel, and sends a specified message to that channel.

Global Variables: - DEFAULT_AWS_SECRET_NAME: The default name of the secret in AWS Secrets Manager that stores the Slack API token. - DEFAULT_AWS_REGION: The default AWS region where the secret is stored. - DEFAULT_CHANNEL_NAME: The default name of the Slack channel to send the message to.

Usage: From command line: python send_slack_message.py –message "Your message here" [–channel "channel_id"] [–aws_secret_name "secret_name"] [–aws_region "region"] When imported: send_slack_message(message_text, channel=DEFAULT_CHANNEL_ID, aws_secret_name=DEFAULT_AWS_SECRET_NAME, aws_region=DEFAULT_AWS_REGION)

Functions

def send_slack_message(message_text, channel_id='CTCPU2DPH', aws_secret_name='slack_sagemaker_token', aws_region='eu-west-1', username=None, icon_emoji=None)

Classes

class SlackNotifier (channel_id, aws_secret_name, aws_region)

Methods

def get_slack_token(self)
def send_message(self, message_text, channel_id, username=None, icon_emoji=None)