Ensure your Slack application is properly configured before proceeding with the integration.
Configuring Slack Notifications
The Slack notification service requires an application token with the correct permissions to post messages. To obtain this token:- Create a new Slack application in your workspace.
- Navigate to the OAuth section of your Slack app.
- Add the necessary OAuth scopes, e.g.,
chat:writeandchat:write:customize. - Install the app into your workspace and select the Slack channel where notifications should be sent.
- Store the received OAuth token in the ArgoCD Notifications secret.
notifications.argoproj.io/subscribe.on-sync-succeeded.slack along with the designated Slack channel name.
Important: Simply configuring these steps is not sufficient. ArgoCD sends notifications only after a trigger is defined and a corresponding message template is created.
Understanding Triggers and Templates
A trigger defines the condition under which a notification is sent. Each trigger contains:- A name
- A condition (e.g.,
app.status.sync.status == 'Synced') - A reference to a notification template
Synced, directly using the application object value. The trigger then calls the notification template app-sync-succeeded-slack, which formats the notification message.
A notification template is responsible for generating the message that is sent to Slack. These templates are defined in the ArgoCD Notifications ConfigMap, and you can reference the same template across multiple triggers to maintain consistency.
If additional details such as repository URL, author details, or commit messages should be included in the notification, consider leveraging Slack attachments by modifying the existing template.
Example Configurations
Below are the configuration examples for setting up ArgoCD Notifications:Update the ConfigMap
Configure the Secret
Patch the ArgoCD Application
Sample Slack Notification Output
To include additional details in your notifications, modify your template to add Slack attachments for richer messaging.