Skip to content

fix: update invalid inbound/outbound activities#340

Open
rajan-chari wants to merge 4 commits intomainfrom
fix/338-remove-unsendable-input-types
Open

fix: update invalid inbound/outbound activities#340
rajan-chari wants to merge 4 commits intomainfrom
fix/338-remove-unsendable-input-types

Conversation

@rajan-chari
Copy link
Copy Markdown
Contributor

@rajan-chari rajan-chari commented Mar 31, 2026

Summary

Fixes #338.

removed:

  • ConversationUpdateActivityInput

    • invalid outbound activity that fails service validation
  • inbound and outbound HandoffActivity

    • not recognized by backend
    • BF has a similar event but it uses type: "event" + name: "handoff.initiate"
    • similiarly exists for copilot but it is only inbound as HandoffActionInvokeActivity which we have
  • inbound and outbound TraceActivity

    • not recognized by backend
    • is only for the BF Emulator which is now deprecated. doc ref
  • MessageDeleteActivityInput

    • invalid outbound activity that fails service validation
    • will be provided in a new API endpoint instead
  • MessageUpdateActivityInput

    • invalid outbound activity that fails service validation
  • CommandSendActivityInput

    • invalid outbound activity that fails service validation
    • not a Teams concept. it's a BF activity type used in the skills protocol — where one bot sends a command to a skill bot and gets a commandResult back.
  • CommandResultActivityInput

    • not recognized by backend
    • not a Teams concept, it's a BF skill that sends back to the parent bot after completing a command.

Copilot AI review requested due to automatic review settings March 31, 2026 22:21
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

This PR updates the outbound “sendable activity” typing surface in the Teams API package to better reflect what the Bot Framework /v3/conversations/{id}/activities endpoints accept, aligning the SDK’s type promises with runtime behavior (Fixes #338).

Changes:

  • Narrow ActivityParams to only include MessageActivityInput, TypingActivityInput, and (temporarily) MessageReactionActivityInput.
  • Remove several inbound-only *ActivityInput types from the outbound ActivityParams union to prevent users from attempting unsupported sends.

The ActivityParams union included 10 *ActivityInput types, but the Teams
service (APX) only accepts `message` and `typing` on outbound POST/PUT.
The other types (messageDelete, messageUpdate, conversationUpdate,
handoff, trace, commandSend, commandResult) are inbound-only event
notifications — sending them produces gateway errors.

Narrowing the union to MessageActivityInput, TypingActivityInput, and
MessageReactionActivityInput (kept temporarily — needs its own send
path via the reactions API) so the type system matches what actually
works at runtime.

The *ActivityInput classes themselves are preserved for model symmetry;
only the union membership changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rajan-chari rajan-chari force-pushed the fix/338-remove-unsendable-input-types branch from f150bd0 to 2b7b7f8 Compare March 31, 2026 22:35
Rewrite header comment to explain the union's purpose without
internal terminology. Explicitly call out MessageReactionActivityInput
as a temporary inclusion pending its own send path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rajan-chari
Copy link
Copy Markdown
Contributor Author

Manual Test Results — Echo Bot (Python)

Tested on branch fix/338-rename-activity-params (PR #342, which stacks on this PR), commit bf62a5c. Python echo bot deployed to BAMI1 tenant via DevTunnel.

# Test Result Details
1 Send a message → bot replies PASS Sent "Hello from bolt test" → bot replied "You said 'Hello from bolt test'" (MessageActivityInput via ctx.send(str))
2 Bot shows typing indicator before reply PASS TypingActivityInput sent in handler before reply
3 Edit a sent message → @app.on_message_update fires PASS Edited message → bot replied "Message updated: 'Hello from bolt test EDITED'"
4 Delete a message → @app.on_message_delete fires PASS Deleted message → bot replied "A message was deleted."
5 No regression in send/typing PASS Both MessageActivityInput and TypingActivityInput work after narrowing the union

All 5 test steps from the test plan passed. The narrowed sendable union (message + typing only) works correctly; incoming event handlers are unaffected.

@lilyydu
Copy link
Copy Markdown
Collaborator

lilyydu commented Apr 1, 2026

I did another pass with Claude and based on scanning APX repo - it accepts message, command, and typing:

  • MessageUpdateActivityInput and MessageDeleteActivityInput can use PUT and DELETE respectively on
    /v3/conversations/{id}/activities/{activityId}
  • CommandSendActivityInput is handled by POST

thus, MessageUpdateActivityInput, MessageDeleteActivityInput, and CommandSendActivityInput should remain in ActivityParams

Can you re-test different requests with these activities to verify acurracy?

Copy link
Copy Markdown
Collaborator

@heyitsaamir heyitsaamir left a comment

Choose a reason for hiding this comment

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

Makes sense to me. @lilyydu based on your models work, I think you're better suited to approve.

Edit: saw your message above.

@jerbob92
Copy link
Copy Markdown

jerbob92 commented Apr 2, 2026

Why keep messageReaction? There is no currently no option to set a reaction from a bot right?

I did another pass with Claude and based on scanning APX repo - it accepts message, command, and typing:

  • MessageUpdateActivityInput and MessageDeleteActivityInput can use PUT and DELETE respectively on
    /v3/conversations/{id}/activities/{activityId}
  • CommandSendActivityInput is handled by POST

thus, MessageUpdateActivityInput, MessageDeleteActivityInput, and CommandSendActivityInput should remain in ActivityParams

Can you re-test different requests with these activities to verify acurracy?

When I tried it out, at least MessageDeleteActivityInput did not work because it's not routed to the correct operation (only update and create are handled in send).

@lilyydu lilyydu changed the title fix: remove unsendable activity types from ActivityParams union fix: update invalid inbound/outbound activities Apr 3, 2026
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.

[Bug]: Updating/deleting messages is not clear

5 participants