fix: update invalid inbound/outbound activities#340
Conversation
There was a problem hiding this comment.
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
ActivityParamsto only includeMessageActivityInput,TypingActivityInput, and (temporarily)MessageReactionActivityInput. - Remove several inbound-only
*ActivityInputtypes from the outboundActivityParamsunion 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) <[email protected]>
f150bd0 to
2b7b7f8
Compare
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) <[email protected]>
Manual Test Results — Echo Bot (Python)Tested on branch
All 5 test steps from the test plan passed. The narrowed sendable union (message + typing only) works correctly; incoming event handlers are unaffected. |
|
I did another pass with Claude and based on scanning APX repo - it accepts message, command, and typing:
thus, Can you re-test different requests with these activities to verify acurracy? |
There was a problem hiding this comment.
Makes sense to me. @lilyydu based on your models work, I think you're better suited to approve.
Edit: saw your message above.
|
Why keep
When I tried it out, at least |
equivalent to these 2 python PRs: microsoft/teams.py#340 (not all applicable bc TS doesnt have defined inbound/outbound interfaces) microsoft/teams.py#336 This pull request adds deprecation warnings to several activity-related interfaces and types to clarify that certain properties and activities are no longer recognized or returned by the service backend. This improves the clarity of the API and helps developers avoid using obsolete features. Verified with APX repo and manual testing. **Deprecation of properties and activities:** * Marked the `relatesTo` property as deprecated in the base `IActivity` interface, the `Activity` class, and in all derived activity interfaces where it appears, indicating it is no longer returned by the backend. * Added `@deprecated` annotations to the `withRelatesTo` method in the `Activity` class for consistency. **Deprecation of activity types not recognized by the backend:** * Marked the `IHandoffActivity` and `ITraceActivity` interfaces as deprecated * Marked the `IEndOfConversationActivity` interface and `EndOfConversationCode` type as deprecated --------- Co-authored-by: lilydu <[email protected]> Co-authored-by: Copilot <[email protected]>
Summary
Fixes #338.
removed:
ConversationUpdateActivityInputinbound and outbound
HandoffActivitytype: "event"+name: "handoff.initiate"HandoffActionInvokeActivitywhich we haveinbound and outbound
TraceActivityMessageDeleteActivityInputMessageUpdateActivityInputCommandSendActivityInputCommandResultActivityInput