{
  "name": "microsoft-teams-post",
  "title": "Post a message to Microsoft Teams",
  "category": "Notifications",
  "tags": [
    "notifications",
    "python"
  ],
  "version": "1.0.0",
  "date": "2026-07-16",
  "notes": "Initial release.",
  "latest": true,
  "installable": true,
  "url": "https://catalog.dagweave.com/api/v1/items/microsoft-teams-post/1.0.0.json",
  "templateUrl": "https://catalog.dagweave.com/api/v1/items/microsoft-teams-post/1.0.0/template.yaml",
  "entrypoint": "post",
  "parameters": [
    {
      "name": "message",
      "title": "Message",
      "description": "The message text to post to the Teams channel.",
      "type": "string",
      "required": true
    },
    {
      "name": "webhook-secret-key",
      "title": "Webhook secret key",
      "description": "Key within the Secret that holds the webhook URL.",
      "type": "string",
      "required": false,
      "default": "url"
    },
    {
      "name": "webhook-secret-name",
      "title": "Webhook secret name",
      "description": "Name of the Kubernetes Secret in the run namespace holding the Teams incoming-webhook URL.",
      "type": "string",
      "required": false,
      "default": "teams-webhook"
    }
  ],
  "images": [
    {
      "ref": "python@sha256:20a82dbc2783112ddb91d1534603f802d222a3e63e593cd002eb2ac534e70211",
      "repository": "python",
      "digest": "sha256:20a82dbc2783112ddb91d1534603f802d222a3e63e593cd002eb2ac534e70211"
    }
  ],
  "install": {
    "kubectl": "kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/microsoft-teams-post/1.0.0/template.yaml",
    "argo": "argo template create -n argo https://catalog.dagweave.com/api/v1/items/microsoft-teams-post/1.0.0/template.yaml"
  },
  "template": "apiVersion: argoproj.io/v1alpha1\nkind: WorkflowTemplate\nmetadata:\n  name: microsoft-teams-post\n  labels:\n    dagweave.io/catalog-item: microsoft-teams-post\n  annotations:\n    # The catalog semver this manifest was authored at. The dagweave app records\n    # (catalog-item-id, semver) -\u003e content-hash -\u003e base-vN when it mints the tenant\n    # cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.\n    dagweave.io/catalog-version: \"1.0.0\"\n    dagweave.io/catalog-category: \"Notifications\"\nspec:\n  entrypoint: post\n  templates:\n    - name: post\n      inputs:\n        parameters:\n          # The message text to post to the Teams channel.\n          - name: message\n          # Name/key of the Kubernetes Secret in the run namespace holding the Teams\n          # incoming-webhook URL. Defaults let a user leave them blank in the Inspector.\n          - name: webhook-secret-name\n            default: teams-webhook\n          - name: webhook-secret-key\n            default: url\n      container:\n        # Pinned by digest per the catalog convention: an image rebuild can never\n        # silently change the behaviour of an already-released item version.\n        # python:3.15-alpine — a Teams incoming webhook expects a JSON body, so the\n        # payload is built with json.dumps (which correctly escapes any quotes,\n        # newlines or control characters in the message) rather than shell string\n        # assembly. urllib performs the POST, so no extra image is needed.\n        image: python@sha256:20a82dbc2783112ddb91d1534603f802d222a3e63e593cd002eb2ac534e70211\n        command: [python3, -c]\n        # Values arrive as env vars (below), never interpolated into the program\n        # source, so a message with any content is safe.\n        args:\n          - |\n            import json, os, urllib.request\n            payload = json.dumps({\"text\": os.environ[\"MESSAGE\"]}).encode(\"utf-8\")\n            req = urllib.request.Request(\n                os.environ[\"WEBHOOK_URL\"],\n                data=payload,\n                headers={\"Content-Type\": \"application/json\"},\n                method=\"POST\",\n            )\n            with urllib.request.urlopen(req) as resp:\n                print(\"Teams webhook responded:\", resp.status)\n        env:\n          - name: MESSAGE\n            value: \"{{inputs.parameters.message}}\"\n          - name: WEBHOOK_URL\n            valueFrom:\n              secretKeyRef:\n                name: \"{{inputs.parameters.webhook-secret-name}}\"\n                key: \"{{inputs.parameters.webhook-secret-key}}\"\n",
  "templateSha256": "d66e18d7adc4951f27463a77e2c31b9ab3d13fd89236380dd0f39f6ba7c035cd",
  "source": "https://github.com/dagweave/catalog/tree/67458f74dbbf913b03177f3cefc69424be85eb1d/catalog/microsoft-teams-post",
  "catalogSha": "67458f74dbbf913b03177f3cefc69424be85eb1d"
}
