Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

I have a question about setting up slack in argocd-notifications-secret's notifiers.yaml. #11

Closed
BangShinChul opened this issue Jan 17, 2020 · 8 comments

Comments

@BangShinChul
Copy link

Hello! 😃

I am very interested in your work.
I've been waiting for the notification feature on the Argo CD.
Thank you for your works!

Back to the point, so I tried to test your project right away.
Back to the point
So I tried to test your project right away.

But setting up Slack is too difficult.
I'm wonder that what tokens does mean in the https://argoproj-labs.github.io/argocd-notifications/ documentation?
How can I find this token?

Please Let me know.
Thank you.

@muenchdo
Copy link
Contributor

First you need to create a new App in your Slack workspace: https://api.slack.com/apps?new_app=1

Then, in OAuth & Permissions, add a new OAuth scope chat:write:bot. Scroll up and click Install App to Workspace and complete the setup. Afterwards you will see the OAuth Access Token which you can use for Argo CD notifications.

I hope that helps 🙂

@BangShinChul
Copy link
Author

@muenchdo
Wow! Thank you for your reply!
Your answer was very helpful 😄

@BangShinChul
Copy link
Author

@muenchdo

Can I ask additional questions?

As you answered, I created a Slack App and received an OAuth token for chat:write:bot And I set a argocd-notifications-secret with this token.
But the message doesn't come to my slack channel.. 😢

Here's what I worked on:

Copied the contents of https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/stable/manifests/install.yaml in my local.

And I edited as below :

...
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-notifications-cm
data:
  config.yaml: |
    triggers:
      name: on-sync-succeeded
        condition: on-sync-succeeded
        template: app-sync-succeeded
        enabled: true
    templates:
      name: app-sync-status
        title: Application {{.app.metadata.name}} sync status is {{.app.status.sync.status}}
        body: |
          Application {{.app.metadata.name}} sync is {{.app.status.sync.status}}.
          Application details: {{.context.argocdUrl}} / applications / {{. App.metadata.name}}
---
apiVersion: v1
kind: Secret
metadata:
  name: argocd-notifications-secret
stringData:
  notifiers.yaml: |
    slack:
      token: <My slack apps OAuth access token>
type: Opaque
...

Then I proceeded to apply with the following command :
kubectl apply -n argocd -f install.yaml

And I changed the contents of Application distributed through Argo CD with the following command :

my app name: test-app
my slack channel name: product-argo-cd

kubectl patch app test-app -n argocd -p '{"metadata": {"annotations": {"recipients.argocd-notifications.argoproj.io": "slack: product-argo-cd"}}}'- type merge

I just worked like this.
Have you missed anything?

@muenchdo
Copy link
Contributor

There shouldn't be a space in your annotation, it should be slack:product-argo-cd. You also might need to add the Slack App to your product-argo-cd channel.

(I can also really recommend joining the Argo community Slack)

@BangShinChul
Copy link
Author

@muenchdo

As you answered, I removed the whitespace and tried again, but still no message.. 😞
As you've recommended, I'll ask you to join the Argo community Slack channel.
Thank you for your help! 👍

@alexmt
Copy link
Collaborator

alexmt commented Jan 17, 2020

Hello @BangShinChul ,

Thank you for trying argocd-notification! Answered the question in slack channel: https://argoproj.slack.com/archives/CSPC6G5JQ/p1579290125002700

@alexmt alexmt closed this as completed Jan 17, 2020
@alexmt
Copy link
Collaborator

alexmt commented Jan 17, 2020

Created ticket to document slack app creation :) #12

@uttamanand-whs
Copy link

how to get it worked with existing channel on slack ? I am setting the token for the existing slack channel.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants