Slack Interactive Notification

Create Slack App

Follow the instructions below to create a Slack App From Scratch.

  1. Create a slack channel either public or private. Ignore this, if you already have a workspace and channel.

  2. Click the below URL and sign in to your Slack account to create an application. https://api.slack.com/apps?new_app=

  3. Click “Create an App

  4. Click on “From scratch” in the popup window as shown below:

  5. Type your “App Name” and “Pick a workspace to develop your app in” from the dropdown and then click “Create App”.

  6. Once the application is created, navigate to “OAuth & Permissions" under “Features” as the app requires permission to send notifications. Click “OAuth & Permissions” from the navigation menu and scroll down to find the "Scopes" and then click “Add an OAuth Scope”. Refer to the image below.

  7. The scopes govern a Slack app's capabilities and permissions. Provide the permissions chat:write and chat:write.customize. Refer to the image below.

  8. Once the scope is created, Scroll back to the top and click the “Install to Workspace” button.

  9. Click “Allow” button to allow your workspace for notifications.

  10. Now users can see the “Bot User OAuth Token”. Copy it to local.

  11. Convert your token to base64 encoded.

  12. Edit the secret called “argocd-notifications-controller-secret”.

    apiVersion: v1
    kind: Secret
    metadata:
      name: argocd-notifications-secret
    stringData:
      slack-token: <base64 encoded auth-token>

  13. Configure the Slack integration token in configmap called “argocd-notifications-controller-cm”.

    apiVersion: v1configure the Slack integration token in configmap called argocd-notifications-controller-cm
    
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: argocd-notifications-cm
    data:
      service.slack: |
        apiURL: <url>  # optional URL, e.g.https://example.com/api
        token: $slack-token
        username: <override-username> # optional username
        icon: <override-icon>         # optional icon for the message (supports both emoij and url notation)

Make sure you have the slack template in the same configmap. For more information on templates, click here.

Your application is installed now in the workspace and you need to integrate your application into Slack channels by following the below steps.

Integration to Slack Channel

  1. Go to your Slack application and click on your “Channel Name”(for example “maheshapp-argo-pub”) from the channel list and again click on the “Channel name” that appears right side to view channel details. Refer to the image below.

  2. Now click on the “Integrations” tab and then click on “Add an App”. Refer to the image below.

  3. Search with your app name and Click “Add”.

  4. Now configure notification in the argo application.

  5. Edit the application and add annotations to it as shown below.

      annotations:
        notifications.argoproj.io/subscribe.on-deleted.slack: maheshapp-argo-pub
        notifications.argoproj.io/subscribe.on-deployed.slack: maheshapp-argo-pub
        notifications.argoproj.io/subscribe.on-sync-failed.slack: maheshapp-argo-pub
        notifications.argoproj.io/subscribe.on-sync-status-unknown.slack: maheshapp-argo-pub
        notifications.argoproj.io/subscribe.on-health-degraded.slack: maheshapp-argo-pub
        notifications.argoproj.io/subscribe.on-sync-succeeded.slack: maheshapp-argo-pub

  6. Now Sync your application. Based on your app status, notifications will be triggered. Refer to the image below.

Last updated