Skip to content

feat: SuggestedActionSubmitActivity for suggestedAction/submit invoke#464

Open
singhk97 wants to merge 15 commits into
mainfrom
kavin/custom-invoke
Open

feat: SuggestedActionSubmitActivity for suggestedAction/submit invoke#464
singhk97 wants to merge 15 commits into
mainfrom
kavin/custom-invoke

Conversation

@singhk97
Copy link
Copy Markdown
Collaborator

@singhk97 singhk97 commented Apr 30, 2026

Summary

Adds first-class support for the suggestedAction/submit invoke activity (the platform-side dispatch of an Action.Submit suggested-action click).

  • New typed activity SuggestedActionSubmitActivity and OnSuggestedActionSubmit route extension, modeled after HandoffActivity / OnHandoff.
  • New Microsoft.Teams.Api.Cards.ActionType.Submit value, so bots can construct outbound suggestedActions.actions[] chips with type: "Action.Submit", title, and structured value.
  • All new public surface marked [Experimental("ExperimentalTeamsSuggestedAction")]. Internal references suppress via #pragma.
  • New Samples.SuggestedAction project demonstrates both directions: bot replies with Approve/Reject chips, then handles the resulting invoke.

Test plan

  • dotnet build Microsoft.Teams.sln — clean
  • dotnet test Microsoft.Teams.sln — 1293/1293 pass on both net8.0 and net10.0. Includes a wire-format test asserting the outgoing suggestedActions.actions[].{type,title,value} JSON matches the design spec.
  • Verified end-to-end against the running sample: posted a synthesized invoke, confirmed typed dispatch into SuggestedActionSubmitActivity and that activity.Value round-trips as a JsonElement.
  • Manual verification with a payload from the Teams chat client once the platform side ships.

singhk97 and others added 3 commits April 30, 2026 12:03
…invoke (ADO 5323021)

Replaces the prior generic-fallback approach with a typed activity subclass
and dedicated OnSuggestedActionSubmit route extension, mirroring the existing
HandoffActivity pattern. See SuggestedActionInvoke design spec for the
platform contract.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 30, 2026 19:45
@singhk97 singhk97 changed the title feat: SuggestedActionSubmitActivity for suggestedAction/submit invoke (ADO 5323021) feat: SuggestedActionSubmitActivity for suggestedAction/submit invoke Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds first-class SDK support for the new suggestedAction/submit invoke by introducing a typed activity and a dedicated routing extension, and wires it into invoke dispatch + JSON serialization so apps no longer fail on this invoke name.

Changes:

  • Introduces SuggestedActionSubmitActivity (API) and OnSuggestedActionSubmit / SuggestedActionSubmitAttribute (Apps routing).
  • Updates invoke type dispatch (InvokeActivity.ToType / InvokeActivity.ToType(Type, …)) and the JSON converter to read/write the new activity type.
  • Adds tests + a sample handler that reads a vote field from the invoke payload.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Tests/Microsoft.Teams.Api.Tests/Json/Activity/Invokes/SuggestedActionSubmitActivity.json Adds a representative JSON payload used by tests.
Tests/Microsoft.Teams.Api.Tests/Activities/Invokes/SuggestedActionSubmitActivityTests.cs Adds deserialization + dispatch + path tests for the new activity type.
Samples/Samples.Dialogs/Program.cs Demonstrates handling suggestedAction/submit and echoing a payload field.
Libraries/Microsoft.Teams.Apps/Activities/Invokes/SuggestedActionSubmitActivity.cs Adds routing extension methods + attribute for suggestedAction/submit.
Libraries/Microsoft.Teams.Api/Activities/Invokes/SuggestedActionSubmitActivity.cs Adds the Name.SuggestedActionSubmit constant and SuggestedActionSubmitActivity type.
Libraries/Microsoft.Teams.Api/Activities/Invokes/InvokeActivity.cs Adds invoke-name-to-type dispatch for the new activity.
Libraries/Microsoft.Teams.Api/Activities/InvokeActivity.cs Adds casting + ToType routing for SuggestedActionSubmitActivity.
Libraries/Microsoft.Teams.Api/Activities/InvokeActivity.JsonConverter.cs Adds JSON read/write support for the new invoke activity type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Libraries/Microsoft.Teams.Api/Activities/InvokeActivity.JsonConverter.cs Outdated
Comment thread Samples/Samples.Dialogs/Program.cs Outdated
Comment thread Samples/Samples.Dialogs/Program.cs Outdated
- Move suggestedAction/submit handler out of Samples.Dialogs into a new
  dedicated Samples.SuggestedAction project, registered in the solution.
- Mark the new public surface with [Experimental("ExperimentalTeamsSuggestedAction")]:
  SuggestedActionSubmitActivity, Name.SuggestedActionSubmit, IsSuggestedActionSubmit,
  ToSuggestedActionSubmit(), and the OnSuggestedActionSubmit extensions. Internal
  references and the test/sample suppress the warning via #pragma.
Copilot AI review requested due to automatic review settings May 1, 2026 16:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Samples/Samples.SuggestedAction/Program.cs
singhk97 added 2 commits May 1, 2026 12:30
- Add ActionType.Submit ("Action.Submit") to Microsoft.Teams.Api.Cards.ActionType,
  marked [Experimental("ExperimentalTeamsSuggestedAction")].
- Update sample to construct a reply MessageActivity with two suggested-action
  chips that emit { type: Action.Submit, title, value } per the design spec.
  Uses using-aliases to disambiguate Cards vs MessageActivity types.
- Add wire-format test asserting the bot's outgoing JSON matches the spec.
Copilot AI review requested due to automatic review settings May 1, 2026 16:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Samples/Samples.SuggestedAction/README.md Outdated
Comment thread Samples/Samples.SuggestedAction/README.md Outdated
Copilot AI review requested due to automatic review settings May 1, 2026 16:55
@singhk97 singhk97 review requested due to automatic review settings May 1, 2026 16:55
Copilot AI review requested due to automatic review settings May 1, 2026 16:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +41 to +49
/// <summary>
/// Suggested action of type Action.Submit. The action's Value is delivered to the bot
/// as a <c>suggestedAction/submit</c> invoke without sending a chat-visible message.
/// </summary>
[Experimental("ExperimentalTeamsSuggestedAction")]
public static readonly ActionType Submit = new("Action.Submit");

[Experimental("ExperimentalTeamsSuggestedAction")]
public bool IsSubmit => Submit.Equals(Value);

## Experimental API

`CardActionType.Submit`, `SuggestedActionSubmitActivity`, and `OnSuggestedActionSubmit` are marked `[Experimental("ExperimentalTeamsSuggestedAction")]` because the underlying platform feature is still rolling out. The C# compiler reports references to them as **errors** by default, so consuming code has to opt in.
@@ -0,0 +1,52 @@
// SuggestedAction.Submit and the OnSuggestedActionSubmit handler are marked
Copy link
Copy Markdown
Collaborator

@corinagum corinagum left a comment

Choose a reason for hiding this comment

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

Can last item in test plan be checked off? I think I recall you saying you tested it manually. Approved, pending resolution/close of last Copilot remarks.

singhk97 and others added 2 commits May 6, 2026 18:43
Aligns the experimental invoke name with the platform's actual wire
shape (plural, matching the suggestedActions container on outgoing
messages).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 15, 2026 16:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.


## Experimental API

`CardActionType.Submit`, `SuggestedActionSubmitActivity`, and `OnSuggestedActionSubmit` are marked `[Experimental("ExperimentalTeamsSuggestedAction")]` because the underlying platform feature is still rolling out. The C# compiler reports references to them as **errors** by default, so consuming code has to opt in.
Assert.Equal("suggestedActionSubmitId", activity!.Id);
Assert.Equal("channelId", activity.ChannelId.Value);
Assert.Equal("suggestedActions/submit", activity.Name.Value);
Assert.NotNull(activity.Value);
Comment on lines +12 to +13
[Experimental("ExperimentalTeamsSuggestedAction")]
public static readonly Name SuggestedActionSubmit = new("suggestedActions/submit");
Comment on lines +45 to +46
[Experimental("ExperimentalTeamsSuggestedAction")]
public static readonly ActionType Submit = new("Action.Submit");
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.

4 participants