Skip to content

Sample: opt targeted-messages example into slash commands#430

Merged
corinagum merged 2 commits into
mainfrom
cg/slash-commands-sample
May 20, 2026
Merged

Sample: opt targeted-messages example into slash commands#430
corinagum merged 2 commits into
mainfrom
cg/slash-commands-sample

Conversation

@corinagum

@corinagum corinagum commented May 19, 2026

Copy link
Copy Markdown
Contributor

Updates the targeted-messages example to demonstrate the slash-commands opt-in per the docs spec (microsoft/teams-sdk#2843, MicrosoftDocs/msteams-docs#14182).

Changes

  • examples/targeted-messages/appPackage/manifest.json (new) — shipped at manifestVersion: "devPreview" because the slash-commands opt-in fields are only defined in the devPreview schema today:
    • bots[].supportsTargetedMessages: true opts the bot into receiving slash-command-style targeted messages.
    • bots[].commandLists[].triggers: ["slash"] declares test send / test update / test delete / test public / test inbound as slash commands surfaced in the Teams / picker (scoped to team and groupChat).
  • .gitignore — narrowly-scoped exception so this one example's manifest can be tracked. The general examples/**/appPackage/ exclusion remains in place for other examples.
  • examples/targeted-messages/src/main.py — new test inbound handler that reads activity.recipient.is_targeted and reports whether the inbound message was delivered as a targeted message (the signal slash commands arrive with).
  • examples/targeted-messages/README.md — refreshed commands table, new "Manifest configuration" section documenting the new fields.

Test plan

  • python3 -m py_compile examples/targeted-messages/src/main.py clean
  • pyright examples/targeted-messages/src/main.py clean
  • examples/targeted-messages/appPackage/manifest.json validates against the Teams devPreview schema (placeholder ${{...}} tokens excepted)
  • Sample bot's test inbound handler verified live in Teams: broadcast branch fires when the inbound is not targeted (the targeted branch will fire once slash commands start delivering with recipient.is_targeted = True)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 19, 2026 19:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Updates the examples/targeted-messages sample to demonstrate opting targeted-messages into Teams slash commands via the devPreview manifest schema, and adds an inbound check to show when a message arrived as “targeted”.

Changes:

  • Add a devPreview Teams manifest that opts the bot into slash-triggered targeted messages and lists slash commands.
  • Add test inbound handler to report whether the inbound activity was targeted.
  • Update docs and .gitignore to track the sample’s manifest and describe the new configuration/commands.

Reviewed changes

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

File Description
examples/targeted-messages/src/main.py Adds test inbound command handler and updates help text.
examples/targeted-messages/appPackage/manifest.json New devPreview manifest enabling slash-triggered targeted messages and listing commands.
examples/targeted-messages/README.md Updates commands table and documents devPreview manifest opt-in fields.
.gitignore Un-ignores the targeted-messages manifest so it can be committed.

Comment thread examples/targeted-messages/src/main.py Outdated
Comment thread examples/targeted-messages/appPackage/manifest.json
Comment thread examples/targeted-messages/README.md
corinagum added 2 commits May 20, 2026 14:34
Adds the devPreview manifest fields per the slash-commands docs spec
(microsoft/teams-sdk#2843, MicrosoftDocs/msteams-docs#14182):

- bots[].supportsTargetedMessages: true
- bots[].commandLists[].triggers: ["slash"]

Ships the manifest at appPackage/manifest.json (with a narrowly-scoped
.gitignore exception for this example) so the slash-commands opt-in is
discoverable. Adds a `test inbound` handler that demonstrates
`activity.recipient.is_targeted` detection (the signal slash commands
arrive with). README documents the new fields and handler.
activity.recipient is typed Account (non-Optional) on MessageActivity,
so the 'is not None' branch was unreachable and triggered
reportUnnecessaryComparison.
@corinagum
corinagum force-pushed the cg/slash-commands-sample branch from 29ee5d4 to e7a3e09 Compare May 20, 2026 21:37
@corinagum
corinagum merged commit 2090f29 into main May 20, 2026
7 checks passed
@corinagum
corinagum deleted the cg/slash-commands-sample branch May 20, 2026 23:24
corinagum added a commit that referenced this pull request May 27, 2026
## Summary

Brings `origin/main` into `release` for the **2.0.12** release. **No
carve-outs this time** — Quoted Replies (PR #321) is included.

`version.json`: `2.0.11` → `2.0.12`.

Aligns with teams.ts/teams.net cadence.

## What's in this release (delta from 2.0.11)

**Features**
- Quoted Replies & new quotes features (#321) — previously held back
- SuggestedActionSubmitActivity for `suggestedAction/submit` invoke
(#434)
- Default targeted replies for targeted inbound messages (#439)
- Reactions API marked GA (#427) — already shipped in 2.0.11 actually,
ignore if duplicate
- Prompt Preview support (#397)
- Sample: opt targeted-messages into slash commands (#430)
- Sample: a2a-in-teams (#401)
- Sample: proactive message update (#405)
- Allow custom HTTP client via `AppOptions` (#416)

**Security & fixes**
- Lock JsonWebToken trust-boundary contract (#432)
- Bump starlette 1.0.0 -> 1.1.0 for PYSEC-2026-161 / BadHost (#441)
- warn when bot starts without credentials (#435)
- fix(apps): support AAD v1 issuers in Entra token validation (#422)
- fix(apps): log inbound activities at info, warn on missing
Authorization (#425)
- fix(http-stream): wait for in-flight flush before sending final close
(#419)
- Mark reactions API as GA and fix sample remove flow (#427)
- Revert serviceUrl allowlist (ADO 5310460) (#415)
- Route `app.get_app_graph` + `ctx.*_graph` to sovereign endpoints via
`cloud.graph_scope` (#402)

**Deprecations / package changes**
- Remove ai, openai, mcpplugin, a2a, and devtools packages (#413)
- Restore and deprecate devtools package (#410)
- Deprecate ai, openai, mcpplugin, a2a packages (#406)
- Add agent framework example, remove chatprompt/mcp client samples
(#386)

**Dependency bumps**
- urllib3 2.6.3 → 2.7.0 (#426)
- python-multipart 0.0.26 → 0.0.27 (#424)
- microsoft-kiota-http 1.9.7 → 1.9.9 (#423)
- idna 3.11 → 3.15 (#431)
- starlette 1.0.0 → 1.1.0 (#441, security)
- /examples/tab/Web: qs, postcss, uuid, follow-redirects bumps

## Quoted Replies inclusion notes

- Teams client rendering is in-sync with the wire format as of
2026-05-06.
- APX QR rollout completed: Public 2026-04-10, GCCH/DoD/Gallatin
2026-04-14.
- Builder methods (`prepend_quote()`, `add_quote()`), `ctx.quote()`, and
the quote-aware `ctx.reply()` behavior are all present in this release.
- `examples/quoting` is included.

## Conflict resolution

The 2.0.11 release branch had the QR-removed shape for four files; took
`main`'s (QR-included) version for all of them:
- `examples/targeted-messages/src/main.py`
- `packages/api/src/microsoft_teams/api/activities/message/message.py`
- `packages/apps/src/microsoft_teams/apps/routing/activity_context.py`
- `packages/apps/tests/test_activity_context.py`

`version.json` conflict resolved to `2.0.12`.

## Test plan

- [x] `uv sync` clean
- [x] `poe check` (ruff format + lint) — clean
- [x] `poe test` — 609 passed
- [x] `pyright` — 0 errors, 0 warnings
- [ ] Pipeline build + test stages green on `release` after merge
- [ ] Publish pipeline run with **Public** → ESRP approval → PyPI
- [ ] `pip install microsoft-teams-apps==2.0.12` smoke install

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Aamir Jawaid <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: Shanmathi Mayuram Krithivasan <[email protected]>
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.

3 participants