Skip to content

Slack

Slack

Run maira commands and playbooks from slack and send notifications to slack from playbooks

Description

Slack integration lets you run individual maira commands, mpl statements and entire playbooks right from slack. The output can then be shared in with other peopl from within slack.

You can also send a notification from your playbooks to a specific user or channel in slack.

Installation

SaaS Deployment

To integrate with Slack, click on Add to Slack

Once added to your slack workspace, you can issue /mpl login command to connect slack user with maira user. Once user connection is successful, you can use /mpl help command to get help with maira.

On-Prem Deployment

If you are using on-prem deployment of Maira, the standard Maira app will not work. You need to create a new app in your workspace. Below are the instructions:

  1. Go to workspace dropdown(top left)>Settings and Administration> Manage Apps
  2. Click on 'Build' in top right Corner
  3. Click 'Create New App' > 'From an App Manifest'
  4. Choose the Workspace and replace the manifest YAML file shown in next step and click on 'create'

    display_information:
      name: Maira
    features:
      bot_user:
        display_name: Maira
        always_online: true
      shortcuts:
        - name: Run Maira Command
          type: global
          callback_id: maira_functionalities
          description: Choose from various Maira Functionalities
        - name: Execute Playbook
          type: global
          callback_id: execute_playbook
          description: Execute any playbook
      slash_commands:
        - command: /mpl
          description: Execute mpl command
          usage_hint: mpl command.
          should_escape: false
    oauth_config:
      scopes:
        bot:
          - app_mentions:read
          - channels:read
          - chat:write
          - chat:write.public
          - commands
          - incoming-webhook
          - users:read
          - channels:manage
    settings:
      event_subscriptions:
        bot_events:
          - app_mention
      interactivity:
        is_enabled: true
      org_deploy_enabled: false
      socket_mode_enabled: true
      token_rotation_enabled: false
    

  5. Click 'Install to Workspace' > Select a channel > click 'Allow'

  6. Use the Bot User OAuth Token from OAuth and Permissions page of the app to fill the slack_bot_token value in maira.yml
  7. Select Basic Information link from the left sidebar and scroll down to section App-Level Token. Click on the Generate Token and Scopes button.
  8. Enter a Name, select connections:write scope, and click Generate. Use this token to fill slack_app_token value in maira.yml in Maira gitops based deployment
slack:
  socket_mode: true
  slack_app_token: ""
  slack_bot_token: ""
  log_level: info