Teams

Parameters

The Teams notification service send message notifications using Teams bot and requires specifying the following settings:

  • recipientUrls - the webhook url map, e.g. channelName: https://example.com

Configuration

  1. Open Teams and goto Apps
  2. Find Incoming Webhook microsoft app and click on it
  3. Press Add to a team -> select team and channel -> press Set up a connector
  4. Enter webhook name and upload image (optional)
  5. Press Create then copy webhook url and store it in argocd-notifications-secret and define it in argocd-notifications-cm
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: <config-map-name>
  5. data:
  6. service.teams: |
  7. recipientUrls:
  8. channelName: $channel-teams-url
  1. apiVersion: v1
  2. kind: Secret
  3. metadata:
  4. name: <secret-name>
  5. stringData:
  6. channel-teams-url: https://example.com
  1. Create subscription for your Teams integration:
  1. apiVersion: argoproj.io/v1alpha1
  2. kind: Application
  3. metadata:
  4. annotations:
  5. notifications.argoproj.io/subscribe.on-sync-succeeded.teams: channelName

Templates

Teams - 图1

Notification templates can be customized to leverage teams message sections, facts, themeColor, summary and potentialAction feature.

  1. template.app-sync-succeeded: |
  2. teams:
  3. themeColor: "#000080"
  4. sections: |
  5. [{
  6. "facts": [
  7. {
  8. "name": "Sync Status",
  9. "value": "{{.app.status.sync.status}}"
  10. },
  11. {
  12. "name": "Repository",
  13. "value": "{{.app.spec.source.repoURL}}"
  14. }
  15. ]
  16. }]
  17. potentialAction: |-
  18. [{
  19. "@type":"OpenUri",
  20. "name":"Operation Details",
  21. "targets":[{
  22. "os":"default",
  23. "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
  24. }]
  25. }]
  26. title: Application {{.app.metadata.name}} has been successfully synced
  27. text: Application {{.app.metadata.name}} has been successfully synced at {{.app.status.operationState.finishedAt}}.
  28. summary: "{{.app.metadata.name}} sync succeeded"

facts field

You can use facts field instead of sections field.

  1. template.app-sync-succeeded: |
  2. teams:
  3. facts: |
  4. [{
  5. "name": "Sync Status",
  6. "value": "{{.app.status.sync.status}}"
  7. },
  8. {
  9. "name": "Repository",
  10. "value": "{{.app.spec.source.repoURL}}"
  11. }]

theme color field

You can set theme color as hex string for the message.

Teams - 图2

  1. template.app-sync-succeeded: |
  2. teams:
  3. themeColor: "#000080"

summary field

You can set a summary of the message that will be shown on Notifcation & Activity Feed

Teams - 图3

Teams - 图4

  1. template.app-sync-succeeded: |
  2. teams:
  3. summary: "Sync Succeeded"