Configuring Teams notifications
Three commands post to Microsoft Teams, from most to least opinionated:
notify project— deployment cards with issue-tracker linking, for project pipelines. Its issue-linking looks up commits between package versions, so it needs the project to be packaged (2GP Unlocked Package preferred) to have anything to link.notify happy-soup— the same stage-notification pattern, without issue-tracker integration.notify teams— posts an arbitrary JSON payload you build yourself, for anything the other two don’t cover.
All three share one safety default: --enabled must be passed explicitly, or nothing is sent. This lets a pipeline template ship with notification jobs wired in everywhere, while individual projects opt in (or gate it behind a variable like $TEAMS_NOTIFICATIONS_ENABLED) without editing the job definitions.
The before/after pattern — and how it differs by topic
Section titled “The before/after pattern — and how it differs by topic”Both notify project and notify happy-soup are meant to run in --before-script/--after-script pairs, but at different granularity, matching how each deploy topic is structured (see Deploy pipeline stages):
notify projectis meant to wrap the whole pipeline once —--before-scripton the very first stage job (typicallypre-destructive),--after-scripton the very last (typicallypost-destructive).--before-scriptis also when the previously-installed and target package versions get resolved and recorded, so the later--after-scriptrun (potentially in a different job, on a different runner) knows what changed for the issue lookup.notify happy-soupis meant to wrap every stage, since a happy-soup pipeline can run several unrelated apps per stage and you generally want per-stage visibility, not just a single pipeline-level card.
pre-destructive: stage: deploy before_script: - sf simply cicd notify project --before-script --ci-job-stage pre-destructive --alias target-org --enabled script: - sf simply cicd deploy project pre-destructive --ci-job-token $CI_JOB_TOKEN ...
post-destructive: stage: deploy script: - sf simply cicd deploy project post-destructive --ci-job-token $CI_JOB_TOKEN ... after_script: - sf simply cicd notify project --after-script --ci-job-stage post-destructive --ci-job-status $CI_JOB_STATUS --teams-webhook-url $TEAMS_WEBHOOK_URL --enabled--alias target-org must already be an authenticated org alias by the time --before-script runs — same as every deploy * stage command, simply-cicd never authenticates orgs itself. See the GitLab CI pipeline guide for where that authentication step goes in a full pipeline.
If --after-script runs in a job that never ran --before-script (e.g. a standalone rerun), pass --prev-installed-package-version and --target-package-version explicitly instead of relying on values --before-script would otherwise have resolved and stashed.
Collapsing happy-soup’s per-stage notifications to one
Section titled “Collapsing happy-soup’s per-stage notifications to one”By default every stage posts its own card for notify happy-soup. To collapse that into a single end-of-pipeline notification instead, pass --notify-on-completion on every --after-script call, and --is-final-job only on the last one — that combination is what actually triggers the send; every other --after-script call becomes a silent no-op.
Canceled jobs
Section titled “Canceled jobs”A canceled job gets its own card from notify build, notify project, and notify happy-soup, with an amber header, so it can’t be mistaken for a success or a failure. GitLab runs after_script for a canceled job (GitLab 17.0 and later) with CI_JOB_STATUS set to canceled, so passing --ci-job-status $CI_JOB_STATUS as above is all it takes.
Canceling a pipeline usually stops the jobs after the canceled one, so with --notify-on-completion the final job, and with it the only card, may never run. To get a card in that case, give the final job when: always so it runs even after an earlier job was canceled or failed.
Issue linking
Section titled “Issue linking”notify project, notify build, and notify happy-soup search commit messages for issue references (for notify project, between the previously-installed and target package versions) and include them in the Teams card. These flags control it:
--alm-provider— which tracker’s reference format to look for.jiramatchesPROJ-123style keys;gitlab-issuesmatches bare#123references. Without the flag, the notify commands usealm.providerfrom.sfdevrc.json(orSIMPLY_ALM_PROVIDER), thenjira. If.sfdevrc.jsonis malformed, they warn and usejirarather than failing the job.--alm-project-key— the project key to search for. Overridesalm.projectKeysin your repo’s.sfdevrc.json. Only meaningful for prefix-keyed trackers like Jira;gitlab-issuesignores it, since GitLab numbers issues per project.--alm-host— the issue tracker’s hostname, e.g.your-org.atlassian.net. The provider builds each link from it: Jira links tohttps://<host>/browse/PROJ-123, GitLab Issues tohttps://<host>/<project-path>/-/issues/123. For GitLab Issues the host defaults to the pipeline’s own GitLab instance (CI_SERVER_HOST), thengitlab.com. A host with a scheme or a context path (jira.example.com/jira) is used as given. Falls back toalm.hostin.sfdevrc.json(orSIMPLY_ALM_HOST). Without a host, references are shown as plain text instead of links.--alm-project-path— GitLab Issues only: thegroup/projectwhose issues are linked. Defaults to the pipeline’s own project (CI_PROJECT_PATH); fornotify happy-soup, each upgraded package links to its own project.
Configuring the tracker in .sfdevrc.json
Section titled “Configuring the tracker in .sfdevrc.json”Instead of passing flags on every job, describe the tracker once in the alm section of .sfdevrc.json at your repo root:
{ "alm": { "provider": "jira", "host": "your-org.atlassian.net", "projectKeys": ["PROJ", "PLAT"] }}Each field can also come from a plugin-neutral environment variable: SIMPLY_ALM_PROVIDER for alm.provider, SIMPLY_ALM_HOST for alm.host, and SIMPLY_ALM_PROJECT_KEYS (comma-separated) for alm.projectKeys. Precedence is flag (or its SIMPLY_CICD_* variable) > SIMPLY_ALM_* variable > file. So --alm-project-key replaces the configured keys rather than adding to them, and --alm-provider / --alm-host override alm.provider / alm.host.
The flags and environment variables were renamed from jira* to alm* earlier, with no aliases kept: --jira-base-url and --jira-project-key became --alm-base-url and --alm-project-key, and SIMPLY_CICD_JIRA_BASE_URL / SIMPLY_CICD_JIRA_PROJECT_KEY became SIMPLY_CICD_ALM_BASE_URL / SIMPLY_CICD_ALM_PROJECT_KEY. A pipeline still passing the old jira* names fails until it is updated.
Custom payloads with notify teams
Section titled “Custom payloads with notify teams”For anything outside the built-in card templates — a custom alert, a summary that isn’t tied to a deploy stage — build your own JSON payload and post it directly:
sf simply cicd notify teams \ --payload '{"text":"Nightly scratch-org cleanup complete"}' \ --webhook-url $TEAMS_WEBHOOK_URL \ --enabledSee Teams’ incoming webhook payload format for what --payload accepts. All three notify commands accept multiple --teams-webhook-url values if you need to post to more than one channel.
Setting the webhook and issue-tracker config once
Section titled “Setting the webhook and issue-tracker config once”--webhook-url (notify teams), --enabled, --alm-host, and --alm-project-key are all backed by SIMPLY_CICD_* CI/CD variables (SIMPLY_CICD_WEBHOOK_URL, SIMPLY_CICD_ENABLED, SIMPLY_CICD_ALM_HOST, SIMPLY_CICD_ALM_PROJECT_KEY — see Environment variables). Setting these once at the pipeline or group level means every notify * job across every stage can drop the corresponding flag entirely, rather than repeating --enabled on every --before-script/--after-script call shown above. --teams-webhook-url (notify project/notify happy-soup) accepts multiple values, so it isn’t backed by an environment variable and still needs to be passed explicitly.
Getting a webhook URL
Section titled “Getting a webhook URL”Microsoft retired the old Office 365 Connector webhooks — set one up through Teams’ Workflows app (Power Automate) instead:
- In the Teams channel or chat you want notifications in, open Workflows and create a new flow from the “Post to a channel when a webhook request is received” template (or the chat equivalent).
- Name the flow and pick the target team/channel (or chat).
- The template adds a default “Post an adaptive card” action — replace it with a “Post message in a chat or channel” action, since
notify project/notify happy-soup/notify teamspost plain card JSON, not the Workflows adaptive-card schema. - Set that action’s message body to the raw trigger payload (
@{triggerBody().content}in the flow’s expression syntax). - Save, then copy the generated HTTP POST URL off the trigger step — that’s your
--teams-webhook-url/--webhook-url/TEAMS_WEBHOOK_URLCI variable. Treat it as a secret (mask it in CI variables) — anyone with the URL can post into that channel.