# 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=>

   <figure><img src="https://lh6.googleusercontent.com/rZuUUVci3RVjit69hjAq5B0nVhBp6F7pohvzwTrQ1plMKgt1_lFsuz_xLPm8Wg81W0kkOlyF15ycM4YprvBuQ5vPeryz1CsSU1YW6dYznBRJJMuJ_ms1upbdGmhZ_7IGS9C_ScML13DuVqKUBILyW0eGi3iZooMEXHAW6QF_T54oVjEMjPcr1-YFiA" alt=""><figcaption></figcaption></figure>

3. Click “**Create an App**”

   <figure><img src="https://lh6.googleusercontent.com/83Zj4QlcTSDCWkOafq7prmLStRfoq3gHiUuPp4GdpUhdxa4LclhQPa3dEL7L2ro81oLOjQr9uSUYncMgVFX5Ax2OmefxsVSMl4n6K2JgUtoVO0V8g5h6-9GD8ehKia-TqW0b3OJbIHPbyDsURH6IbtfQZyRJRwi9b-dyEkQSw-fxOF8225aBIUUr-g" alt=""><figcaption></figcaption></figure>

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

   <figure><img src="https://lh4.googleusercontent.com/Qx4QUeo0ZoFB88begxHUGYs4sP3mc-Mz4iyY92io6ugjkxKOcwQRfgWZcROG2ctALq4hB4fFRb5_9PGK-gi_oVtBZO8a0RrHUkoNlI6NDQmt7vW46DWXKhFlDM4KO1ug5FISptHezqFZzabbY2yXKbXqnC8hK4h8hHUm96atG7iNXAstpsn5u41RXg" alt=""><figcaption></figcaption></figure>

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

   <figure><img src="https://lh4.googleusercontent.com/sMeVWBr4kbbY9AJvrV4jyzfny-vpPAQhNSeKRiEuMvFNYlbV0Al6bZIzuMr2ewulVOzLXleh6mk7rJqm5y1yZhzZJpT9ZtEbqVPDun0pBDXEzRB_otoejgxiDllOGF-MmAasV8NF5NJ4IcEIReTCaDGz8OTwjuTQ4IiEwhNBu_vTxox6rT_Or2YB1g" alt=""><figcaption></figcaption></figure>

6. &#x20;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.

   <figure><img src="https://lh5.googleusercontent.com/0KYxeETvkNVBStZqcWRt34bldc57qqH19uWGvRqZFfrNYl3xvyOdBLnl3NVdL6JhDo6Vi16d-0FjylNwo0z6GPTzl-C8UMDvp_e9xsoml_T4Uez_mqbNOhWlfrzrjDL2Mi_C8guOMQ-UWO1GSwpIs2a4RYl68szjGN-Mf_DlulYAjSgFEbJuY_dp4w" alt=""><figcaption></figcaption></figure>

7. The [**scopes** ](https://api.slack.com/scopes)govern a Slack app's capabilities and permissions. Provide the permissions **chat:write** and **chat:write.customize**. Refer to the image below.

   <figure><img src="https://lh6.googleusercontent.com/yjx1-GVPUZ7CODiuYFHGs-4SJkIWkTtsbkY5xIhlQJezDyqnW2EtRZvCcYKpCjmPpk8u5cWbpQHLczeq17V-T04VjxB0Xzs0zkiJef9_GqxLXo_cShDhJ2f2KBWGYP3siKWxKABxPND7MMjex4xukCH5uNVC-d_atR-b4vgLzfnmYXy4J4Yy7VD_Nw" alt=""><figcaption></figcaption></figure>

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

   <figure><img src="https://lh6.googleusercontent.com/qCouproCSrHWYaV45Xtz-gmaUYAxkFUQvtCEKBUIZiTFndBDzSnGx4TuV8DuLSW91VLlwSdFBhDE_-dPv3ljugMra_PpcDCpdK5C6gOs50eBQ9d_PGv5i_k0gdaM8b17aY235SPmHVNXliyxQuKZLoc69jixC4AlOS6W-wUiYgGbgvEUVkIDKteZcA" alt=""><figcaption></figcaption></figure>

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

   <figure><img src="https://lh5.googleusercontent.com/QZyy3BxLCxphS5zm397HKuVa4my5QhIeMM517zWOAh3zuR-m9WEu_Kw75L5nLq_SOr2sT421ygcz37j5i2JyefOltbvLKSrizf-3w-Wloh8jh964lrCOSxM3H4HKd3EyFt1kfhZ5y7_5eSuLAGrFAAQE8EzzX03W_OKm7ulGpoKLYjCU3tr7MuNfSw" alt=""><figcaption></figcaption></figure>

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

    <figure><img src="https://lh4.googleusercontent.com/jSLXp_W4gJ_ikvHPJMq-Zvzz8yjIfG2l18M2Wg53wDFkwwdom0WVjlvoLz_uZI-jSrBn-wx6jnv6iSncFYealyqObt-I_10eeItxH01sXqyvJkUY_mS6jCU0ZocA_2pE0y_Pbut0LjAB18n2BKRJ8o8vID9qQIsc-jq_vnT2hulqpYghS6B6aCTDhg" alt=""><figcaption></figcaption></figure>

11. Convert your token to base64 encoded.&#x20;

12. Edit the secret called “**argocd-notifications-controller-secret**”.&#x20;

    ```
    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**”.&#x20;

    <pre data-overflow="wrap"><code>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: &#x3C;url>  # optional URL, e.g.https://example.com/api
        token: $slack-token
        username: &#x3C;override-username> # optional username
        icon: &#x3C;override-icon>         # optional icon for the message (supports both emoij and url notation)
    </code></pre>

Make sure you have the slack template in the same configmap. For more information on templates, click [**here**](https://argocd-notifications.readthedocs.io/en/stable/services/slack/#templates).&#x20;

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.

   <figure><img src="https://lh5.googleusercontent.com/GeDYwiqgwWUdrlmEo-TTmRj5UEHFmbJJIpoqiqRTXx4KGO3nIqtUjZ8_scDjAPTAxa4al_Tc-SzWPKtaEQ2ckyMIqi8azx6ruYVQ3msV29-ROU9aEkpgek_z_apiAP4351foAw85y7HUV4ZW15uLOOxC___w5WW1fh99Muwek_gTFz-w2B5jpIhySw" alt=""><figcaption></figcaption></figure>
2. Now click on the “**Integrations**” tab and then click on “**Add an App**”. Refer to the image belo&#x77;**.**

   <figure><img src="https://lh6.googleusercontent.com/We0Khyu7DyaHveIgscdMY_oacal0O8bWQp7Y-rX4r8wsoLNRqBPjQAcUtpwYU-GfLIsG8Y1oIflWcoB6L0wFJK8WnqLUocgx7LGgu-NEm1PF8lG5sU0LeYz73XGu3JiC8Ow0XnMtH5B0oWS5lka1poDpjAlTS7gwq9KcAETUyYHoR-Wjsapaq58Tow" alt=""><figcaption></figcaption></figure>
3. Search with your app name and Click “**Add**”.

   <figure><img src="https://lh4.googleusercontent.com/jgIqj_NMA36GXEyq5aanDYNTBaT0DZYcP_bys42Ki4m_yU2CAXKXD3QmaOGYCi8SKucJROLi4wo-8sHRzp6oEC-86rHOmAagaI8gcab5lUYhfHCFbsU27lbSseT7CxF3oc6EzI7mCKSnUWJlHUZBrB39_c-tBa98KuGHYJDyY6URGXz36ZH6uBRUHA" alt=""><figcaption></figcaption></figure>
4. Once the app is added, it notifies in the channel. Refer to the image below.\
   ![](https://lh6.googleusercontent.com/__ojAlgupSLiOefC2BoZVJiUhZ3VtA0WeUxWOB0wruDHVHmhGeGhGPvrJIMEv3QPFTYuLra_kWKF2suNwlCDts7dMEOpW5fq4-0DOXmRV5EiqeOjwWQd13sw_VbwKBFWm_hnCrDrbD2MGvA90Zgwi-zbPzZEguQc4YTL2Sy9XQ4uhBK8oPqiH71Xrg)
5. Now configure notification in the argo application.&#x20;
6. 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
   ```

   <figure><img src="https://lh5.googleusercontent.com/94U1eoRxEnRbei6FHNfu01PVcZroBUY8PaRZP-MYHAz40SsfrisAJh7Hp2YIgX2mw7mmVREM6MbT298TA60ykTNlWCoeXy0TZkZ8ut_2qK2I0C7vJWaQYC9zLUnPDyGTIIOLMDkXPOIZbuDBOwXIFM5NulBDK-jp8F1kEOYS1X7f1YkSm4of08CsjQ" alt=""><figcaption></figcaption></figure>
7. Now Sync your application. Based on your app status, notifications will be triggered. Refer to the image below.

   <figure><img src="https://lh3.googleusercontent.com/DhCKm8L-4v4Kfktwmm3RgpnahHOedCAge_CMSoA-h2F0noKBABjGzm896noxB7BRx6VXLOMECl5m6KIWM3ER3RJUAe9JckahtsMNHYEOBl-_VZCLWY8f-RXCq0KWZbwtRf6nFys8NmV8H1lwuV37OOYETqbgzaGxdBKLkHvRMfzDPlmhf72-Ch45fA" alt=""><figcaption></figcaption></figure>
