# Add Slack Notifications to Argo CD Applications

Yes. An agent configures Argo CD Notifications for Slack, subscribes your Applications to sync-failed and health-degraded events, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-slack-notifications/argo-cd/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent starts by reading how the repository declares its Applications, because the subscription has to land where every Application is generated, not on one hand-written manifest. In a GitOps repository shaped like argoproj/argocd-example-apps, the `apps` directory is an app-of-apps Helm chart: `apps/Chart.yaml` names it `applications`, `apps/values.yaml` holds a `config.spec` block with the `repoURL` and `targetRevision: master` and an `applications` list with one entry per example (`guestbook`, `helm-guestbook`, `sync-waves`, `sock-shop` and the rest, some with a `tool.helm.releaseName` or a `tool.plugin.name`), and `apps/templates/applications.yaml` ranges over that list to emit one `Application` named `example.<name>` with a `resources-finalizer`, `CreateNamespace=true` and automated sync with `prune` and `selfHeal`. There is no `notifications.argoproj.io` annotation anywhere, no `argocd-notifications-cm` and no `argocd-notifications-secret`.

Argo CD Notifications is driven by annotations on the Application and by a ConfigMap in the `argocd` namespace, so the agent changes both. In `apps/templates/applications.yaml` it adds an `annotations` block under `metadata` with `notifications.argoproj.io/subscribe.on-sync-failed.slack` and `notifications.argoproj.io/subscribe.on-health-degraded.slack`, each set to a channel read from `.Values.notifications.slackChannel`, and wraps the block in a `with` so an installation that leaves the value empty renders the same manifests as today. It adds `notifications` to `apps/values.yaml` with `slackChannel: ""` and a comment on where the channel name comes from. Nothing about `config.spec`, the sync policy or the per-application `tool` settings changes.

For the controller side it adds a new `notifications` directory beside `apps` with an `argocd-notifications-cm` ConfigMap and an `argocd-notifications-secret` Secret stub. The ConfigMap defines `service.slack` with `token: $slack-token`, the two triggers `trigger.on-sync-failed` (condition `app.status.operationState.phase in ['Error', 'Failed']`) and `trigger.on-health-degraded` (condition `app.status.health.status == 'Degraded'`), and a template for each that names the application, the revision and a link built from `context.argocdUrl`. The Secret is a template with `slack-token` left as a placeholder and a note that the real value is applied out of band; the agent never writes a token into the repository. Because the upstream chart has no CI of its own, the agent checks its work with `helm template apps --set notifications.slackChannel=deployments` and `kubectl apply --dry-run=client -f notifications/` in the sandbox, and diffs the rendered Applications against the current render to show that only the annotations differ.

The agent also adds a short section to `README.md` under the `apps` row saying which events post to Slack, how to set the channel value, and that the Secret must be created in the `argocd` namespace before the ConfigMap takes effect. Nothing is pushed to any cluster: the change is a pull request against the repository Argo CD watches, so the Application controller picks it up on the next sync like any other change.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add Argo CD Notifications for Slack to this repository and open a pull request. Read README.md, apps/Chart.yaml, apps/values.yaml and apps/templates/applications.yaml first. In the Application template, add notifications.argoproj.io/subscribe.on-sync-failed.slack and notifications.argoproj.io/subscribe.on-health-degraded.slack annotations whose value is a new notifications.slackChannel value, rendered only when the value is set; add that value to apps/values.yaml, empty by default. Add a notifications/ directory with an argocd-notifications-cm ConfigMap for the argocd namespace that defines service.slack with token $slack-token, the two triggers and a template for each that names the app, the revision and a link from context.argocdUrl, plus an argocd-notifications-secret with a placeholder slack-token and no real value. Render the chart with helm template with and without the channel set, run kubectl apply --dry-run=client on the notifications directory, paste both outputs in the pull request, and add a README section on setting the channel and creating the secret. Do not change sync policies, finalizers or any other application setting.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request with four kinds of change: the two annotations in `apps/templates/applications.yaml` inside a `with .Values.notifications.slackChannel` block, a `notifications` key in `apps/values.yaml`, a new `notifications/` directory with the `argocd-notifications-cm` ConfigMap and the `argocd-notifications-secret` stub, and a README section. The description shows the `helm template` output for one Application with the channel set, the same render with it unset to prove the default is a no-op, and the client-side dry run of the ConfigMap and Secret.

A reviewer checks that the trigger conditions match the Argo CD Notifications catalog they expect, that the annotation keys use the `subscribe.<trigger>.<service>` form the controller reads, that the Secret in the repository carries no token, and that `helm template` with the value empty renders byte-for-byte what main renders today. Then they create the real `argocd-notifications-secret` in the cluster, set `notifications.slackChannel` for their installation, and merge; the app-of-apps syncs the annotations onto every Application it manages.

## Run it on every new Argo CD repository

A platform team that runs several Argo CD installations starts one run per GitOps repository with `POST /o/{org}/sessions`, this prompt and that repository in `resources`. The agent reads each repository's own layout, whether the Applications come from an app-of-apps chart, an ApplicationSet or plain manifests, and puts the subscription where that repository generates them, so the same request works across repositories that are not laid out alike.

The key's `webhook_url` receives `run.completed` for each run it starts, with a `session_url` to read the pull request link, so a script can post the links to the team channel as they open. A retry of a start is safe with a `request_id`, a UUID, in the body.

## Why run it on Rush?

Notifications configuration is easy to get subtly wrong: an annotation key with the trigger and service in the wrong order, a template that references a field the Application status does not carry, or a channel hard-coded into a template that is meant to be reused. In a Rush sandbox the agent renders the chart with `helm template` before and after, dry-runs the ConfigMap against the Kubernetes schema, and keeps both outputs in the transcript, so the pull request shows the exact manifests Argo CD will apply rather than a description of them.

The work is also one that a platform engineer starts and walks away from: hand the repository over from the terminal, let the agent read the chart and the values, and come back to a pull request whose render diff is already in the description. The same request runs across every GitOps repository the team owns, each in its own sandbox, with the record of every command kept beside the result.

## Frequently asked questions

### Does this put a Slack token in the repository?

No. The ConfigMap references the token as `$slack-token`, which Argo CD Notifications resolves from `argocd-notifications-secret` at runtime. The Secret the agent adds is a stub with a placeholder value and a README note; the real Secret is created in the `argocd` namespace by hand or by your secrets tooling, outside the pull request.

### What if my Applications are not generated by an app-of-apps chart?

The prompt tells the agent to read how Applications are declared first. On a repository that uses an ApplicationSet, it adds the annotations to the ApplicationSet's `template.metadata`; on plain `Application` manifests, it adds them to each file. The ConfigMap and Secret are the same in every case because they belong to the controller, not to the Applications.

### Which events are covered?

Sync failures and health degradation, the two most teams want first. The triggers are plain condition expressions in the ConfigMap, so adding `on-deployed` or `on-sync-status-unknown` later is one more trigger, one more template and one more annotation key, and the agent's README section says where each lives.

### Will the change sync anything on its own?

Not until it is merged. The pull request only touches the repository Argo CD watches. Once merged, the app-of-apps Application syncs the new annotations onto the child Applications, and the ConfigMap in `notifications/` is applied by whichever Application or manual step your installation uses for the `argocd` namespace, which the README section calls out.

## More Argo CD jobs

- [Add Sync Retries to Argo CD Applications](https://getrush.ai/run/add-sync-retries/argo-cd/)
- [Add Sync Waves to an Argo CD Application So Databases Start Before Services](https://getrush.ai/run/add-sync-waves/argo-cd/)
- [Add Sync Windows to Argo CD Projects](https://getrush.ai/run/add-sync-windows/argo-cd/)

## More jobs like this: Hand off a long task

- [Add a Slash Command to a discord.js Bot](https://getrush.ai/run/add-slash-command/discord-js/)
- [Add a Slash Command With a Modal to a Slack Bolt App](https://getrush.ai/run/add-slash-command/slack-bolt/)
- [Add Slim CI for a dbt Project With GitHub Actions](https://getrush.ai/run/add-slim-ci/dbt/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
