Slack notification


Prepare following environmental variables:

export SLACK_TOKEN=xoxb-your-token    // should use token starts with "xoxb-" (bot token is preferable)
export SLACK_CHANNEL=channel-name     // not "#channel-name", just "channel-name"

A Slack bot token can obtain from slack app document.

A bot token needs following scopes:

  • channels:read
  • chat:write
  • files:write

More about scopes are slack scopes document.

Implement Slack notification

Write following codes pass arguments to your gokart workflow.

cmdline_args = sys.argv[1:]
if 'SLACK_CHANNEL' in os.environ:
if 'SLACK_TO_USER' in os.environ: