github.com/argoproj/argo-cd/v2@v2.10.9/docs/operator-manual/notifications/services/googlechat.md (about)

     1  # Google Chat
     2  
     3  ## Parameters
     4  
     5  The Google Chat notification service send message notifications to a google chat webhook. This service uses the following settings:
     6  
     7  * `webhooks` - a map of the form `webhookName: webhookUrl`
     8  
     9  ## Configuration
    10  
    11  1. Open `Google chat` and go to the space to which you want to send messages
    12  2. From the menu at the top of the page, select **Configure Webhooks**
    13  3. Under **Incoming Webhooks**, click **Add Webhook**
    14  4. Give a name to the webhook, optionally add an image and click **Save**
    15  5. Copy the URL next to your webhook
    16  6. Store the URL in `argocd-notification-secret` and declare it in `argocd-notifications-cm`
    17  
    18  ```yaml
    19  apiVersion: v1
    20  kind: ConfigMap
    21  metadata:
    22    name: <config-map-name>
    23  data:
    24    service.googlechat: |
    25      webhooks:
    26        spaceName: $space-webhook-url
    27  ```
    28  
    29  ```yaml
    30  apiVersion: v1
    31  kind: Secret
    32  metadata:
    33    name: <secret-name>
    34  stringData:
    35    space-webhook-url: https://chat.googleapis.com/v1/spaces/<space_id>/messages?key=<key>&token=<token>  
    36  ```
    37  
    38  6. Create a subscription for your space
    39  
    40  ```yaml
    41  apiVersion: argoproj.io/v1alpha1
    42  kind: Application
    43  metadata:
    44    annotations:
    45      notifications.argoproj.io/subscribe.on-sync-succeeded.googlechat: spaceName
    46  ```
    47  
    48  ## Templates
    49  
    50  You can send [simple text](https://developers.google.com/chat/reference/message-formats/basic) or [card messages](https://developers.google.com/chat/reference/message-formats/cards) to a Google Chat space. A simple text message template can be defined as follows:
    51  
    52  ```yaml
    53  template.app-sync-succeeded: |
    54    message: The app {{ .app.metadata.name }} has successfully synced!
    55  ```
    56  
    57  A card message can be defined as follows:
    58  
    59  ```yaml
    60  template.app-sync-succeeded: |
    61    googlechat:
    62      cardsV2: |
    63        - header:
    64            title: ArgoCD Bot Notification
    65          sections:
    66            - widgets:
    67                - decoratedText:
    68                    text: The app {{ .app.metadata.name }} has successfully synced!
    69            - widgets:
    70                - decoratedText:
    71                    topLabel: Repository
    72                    text: {{ call .repo.RepoURLToHTTPS .app.spec.source.repoURL }}
    73                - decoratedText:
    74                    topLabel: Revision
    75                    text: {{ .app.spec.source.targetRevision }}
    76                - decoratedText:
    77                    topLabel: Author
    78                    text: {{ (call .repo.GetCommitMetadata .app.status.sync.revision).Author }}
    79  ```
    80  All [Card fields](https://developers.google.com/chat/api/reference/rest/v1/cards#Card_1) are supported and can be used
    81  in notifications. It is also possible to use the previous (now deprecated) `cards` key to use the legacy card fields,
    82  but this is not recommended as Google has deprecated this field and recommends using the newer `cardsV2`.
    83  
    84  The card message can be written in JSON too.
    85  
    86  ## Chat Threads
    87  
    88  It is possible send both simple text and card messages in a chat thread by specifying a unique key for the thread. The thread key can be defined as follows:
    89  
    90  ```yaml
    91  template.app-sync-succeeded: |
    92    message: The app {{ .app.metadata.name }} has successfully synced!
    93    googlechat:
    94      threadKey: {{ .app.metadata.name }}
    95  ```