Slack Message#

class SlackMessage(*blocks, token: str = '', text: str = '')[source]#

Bases: object

A Slack message

Parameters:
  • *blocks – any child blocks

  • token – the Slack token

  • text – the message alternative text, shown if the message cannot be rendered by Slack

add_block(block: SlackMessageBlock) None[source]#

Add a block to the message.

render() str[source]#

Render the message content to JSON.

send(channel: str = '') dict[source]#

Send the message to Slack.

Parameters:

channel – the channel to send the message to