Skip to content

feat(teams-workflows): add rawCardPayload option to send AdaptiveCard directly#441

Open
aspenneberg wants to merge 1 commit into
argoproj:masterfrom
aspenneberg:master
Open

feat(teams-workflows): add rawCardPayload option to send AdaptiveCard directly#441
aspenneberg wants to merge 1 commit into
argoproj:masterfrom
aspenneberg:master

Conversation

@aspenneberg

@aspenneberg aspenneberg commented Apr 20, 2026

Copy link
Copy Markdown

Summary

Some Microsoft Teams webhook endpoints — particularly custom Power Automate flows — expect the AdaptiveCard JSON posted directly as the request body, without the standard Teams message envelope:

{ "type": "message", "attachments": [{ "contentType": "application/vnd.microsoft.card.adaptive", "content": { ...card... } }] }

These flows accept the card at the root level instead:

{ "type": "AdaptiveCard", "version": "1.4", "body": [...], "actions": [...] }

This PR adds a rawCardPayload boolean option to TeamsWorkflowsOptions, configurable at the same level as recipientUrls. When true, the service skips the envelope and sends the AdaptiveCard JSON directly as the POST body. The option works for both the built-in card builder and custom adaptiveCard JSON templates.

Configuration

service.teams-workflows: |
  recipientUrls:
    my-channel: https://prod-xx.westeurope.logic.azure.com/...
  rawCardPayload: true

Changes

  • TeamsWorkflowsOptions: new RawCardPayload bool \json:"rawCardPayload"`` field
  • teamsWorkflowsNotificationToReader: accepts the flag and returns bare card bytes when true, for both the custom adaptiveCard path and the built-in card builder path
  • Two new tests: TestTeamsWorkflows_RawCardPayload_BuiltIn and TestTeamsWorkflows_RawCardPayload_CustomCard

Test plan

  • go test ./pkg/services/... -run TestTeamsWorkflows — all existing tests pass, two new tests pass
  • Verify with a custom Power Automate flow webhook that the card is delivered without the envelope when rawCardPayload: true
  • Verify existing behaviour is unchanged when rawCardPayload is omitted (defaults to false)

… JSON directly

Signed-off-by: D055531 <a.spenneberg@sap.com>
@codecov

codecov Bot commented Apr 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.16%. Comparing base (da04400) to head (e8eea89).
⚠️ Report is 37 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #441      +/-   ##
==========================================
+ Coverage   55.41%   57.16%   +1.74%     
==========================================
  Files          46       48       +2     
  Lines        4125     3726     -399     
==========================================
- Hits         2286     2130     -156     
+ Misses       1511     1241     -270     
- Partials      328      355      +27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pasha-codefresh pasha-codefresh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants