Communication

BotKube backend reads communication settings from two sources:

  • the comm_config.yaml file placed in the directory specified by the CONFIG_PATH environment variable,
  • the exported environment variables. They take priority and override the configuration specified in the file.

File syntax

The communication configuration file contains:

  • communication platforms configuration,

  • option to toggle notification type to short or long.

# Communication mediums configuration
communications:
  # Settings for Slack
  slack:
    enabled: false
    channel: 'SLACK_CHANNEL'            # Slack channel name without '#' prefix
                                        # where you have added BotKube and
                                        # want to receive notifications in
    token: 'SLACK_API_TOKEN'            # Slack token received after installing
                                        # BotKube Slack app to a workplace
    notiftype: short                    # Change notification type short/long.
                                        # notiftype is optional and default
                                        # notification type is short (if not specified)

  # Settings for Mattermost
  mattermost:
    enabled: false
    url: 'MATTERMOST_SERVER_URL'        # URL where Mattermost is running.
                                        # e.g https://example.com:9243
    token: 'MATTERMOST_TOKEN'           # Personal Access token generated by BotKube user
    team: 'MATTERMOST_TEAM'             # Mattermost Team to configure with BotKube
    channel: 'MATTERMOST_CHANNEL'       # Mattermost Channel for receiving BotKube alerts
    notiftype: short                    # Change notification type short/long you want to receive.
                                        # notiftype is optional and default notification type is short (if not specified)

  # Settings for Microsoft Teams
  teams:
    enabled: false
    appID: 'APPLICATION_ID'
    appPassword: 'APPLICATION_PASSWORD'
    port: 3978
    notiftype: short                    # Change notification type short/long you want to receive.
                                        # notiftype is optional and default notification type is short (if not specified)

  # Settings for Discord
  discord:
    enabled: false
    token: 'DISCORD_TOKEN'	            # BotKube Bot Token
    botid: 'DISCORD_BOT_ID'             # BotKube Application Client ID
    channel: 'DISCORD_CHANNEL_ID'       # Discord Channel id for receiving BotKube alerts
    notiftype: short                    # Change notification type short/long you want to receive. notiftype is optional and Default notification type is short (if not specified)

  # Settings for ELS
  elasticsearch:
    enabled: false
    awsSigning:
      enabled: false                    # enable awsSigning using IAM for Elastisearch
                                        # hosted on AWS, if true make sure AWS
                                        # environment variables are set.
                                        # Ref: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
      awsRegion: 'us-east-1'            # AWS region where Elasticsearch is deployed
      roleArn: ''                       # AWS IAM Role arn to assume for credentials,
                                        # use this only if you dont want to
                                        # use the EC2 instance role or not
                                        # running on AWS instance
    server: 'ELASTICSEARCH_ADDRESS'     # e.g https://example.com:9243
    username: 'ELASTICSEARCH_USERNAME'  # Set creds if using Basic Auth
    password: 'ELASTICSEARCH_PASSWORD'
    # ELS index settings
    index:
      name: botkube
      type: botkube-event
      shards: 1
      replicas: 0

  # Settings for Webhook
  webhook:
    enabled: false
    url: 'WEBHOOK_URL'                 # e.g https://example.com:80

The default configuration can be found at:

Environment variables

The individual communication settings can be specified via environment variables. They take priority and override the configuration specified in the file.

To construct the environment variable name, take any property from the configuration file and make it uppercase. Use the underscore for properties that are nested. That’s all - you have the environment variable name!

For example, such configuration property from YAML:

communications:
  slack:
    token: 'SLACK_API_TOKEN'

is mapped to the COMMUNICATIONS_SLACK_TOKEN environment variable.

This is a useful feature that allows you to store the overall configuration in a file, where sensitive data, such as tokens, can be put in environment variables. See the Tokens from Vault via CSI driver tutorial for an example use-case.