Skip to content

Commit c20d283

Browse files
authored
Merge pull request #1968 from OfficeDev/v-ajayjadhav/targetedMessagesPython
Adding Agent-targeted-messages python sample
2 parents f15e396 + 1d82193 commit c20d283

7 files changed

Lines changed: 1429 additions & 0 deletions

File tree

.github/workflows/build-complete-samples.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,10 @@ jobs:
542542
name: 'tab-request-approval'
543543
version: '3.10.x'
544544

545+
- project_path: 'samples/TeamsSDK/agent-targeted-messages/python/agent-targeted-messages'
546+
name: 'agent-targeted-messages'
547+
version: '3.12.x'
548+
545549
- project_path: 'samples/TeamsSDK/bot-ai-messages/python/bot-ai-messages'
546550
name: 'bot-ai-messages'
547551
version: '3.12.x'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CLIENT_ID=
2+
CLIENT_SECRET=
3+
TENANT_ID=
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Targeted Messages in Microsoft Teams - Python
2+
3+
This sample demonstrates how to use **targeted messaging** in Microsoft Teams. Targeted messages are private messages that appear in a channel or group chat but are **only visible to a specific user**. The sample implements a reminder bot where all bot responses — confirmations, reminder deliveries, active reminder lists, and snooze confirmations — are sent as targeted messages.
4+
5+
## Prerequisites
6+
7+
- [Python >=3.12, <3.15](https://www.python.org/downloads/)
8+
- pip (recommended) or [uv](https://docs.astral.sh/uv/)
9+
10+
## Run the sample
11+
12+
1. Navigate to this directory:
13+
```bash
14+
cd samples/TeamsSDK/agent-targeted-messages/python/agent-targeted-messages
15+
```
16+
2. Run the agent using pip:
17+
18+
```bash
19+
pip install -e .
20+
python main.py
21+
```
22+
23+
### Alternative: Using uv
24+
25+
1. Install dependencies using uv:
26+
```bash
27+
uv sync
28+
```
29+
30+
2. Run the agent:
31+
```bash
32+
uv run main.py
33+
```
34+
35+
The agent will start listening on `http://localhost:3978`.
36+
37+
Refer to the main [README.md](../../../README.md) to interact with your agent in the agentsplayground or in Teams.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[
2+
{
3+
"name": "officedev-microsoft-teams-samples-agent-targeted-messages-python",
4+
"source": "officeDev",
5+
"title": "Targeted Messages",
6+
"shortDescription": "This sample agent demonstrates how to use targeted messaging in Microsoft Teams to send private reminders, confirmations, and lists visible only to the intended recipient.",
7+
"url": "https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/TeamsSDK/agent-targeted-messages/python/agent-targeted-messages",
8+
"longDescription": [
9+
"This sample demonstrates targeted messaging in Microsoft Teams using Python. Targeted messages are private messages visible only to a specific user within a channel or group chat. The agent implements a reminder system where every response — reminder confirmations, deliveries, active reminder lists, and snooze confirmations — is sent as a targeted message using MessageActivityInput.with_recipient(). It also demonstrates proactive targeted messaging via app.send() and interactive Adaptive Cards with Action.Execute for dismiss, snooze, and cancel actions."
10+
],
11+
"creationDateTime": "2026-04-28",
12+
"updateDateTime": "2026-04-28",
13+
"products": [
14+
"Teams"
15+
],
16+
"metadata": [
17+
{
18+
"key": "TEAMS-SAMPLE-SOURCE",
19+
"value": "OfficeDev"
20+
},
21+
{
22+
"key": "TEAMS-SERVER-LANGUAGE",
23+
"value": "python"
24+
},
25+
{
26+
"key": "TEAMS-SERVER-PLATFORM",
27+
"value": "python"
28+
},
29+
{
30+
"key": "TEAMS-FEATURES",
31+
"value": "agent,targeted-messaging,proactive-messaging,adaptive-cards"
32+
}
33+
],
34+
"thumbnails": [
35+
{
36+
"type": "Image",
37+
"order": 100,
38+
"url": "https://raw.githubusercontent.com/OfficeDev/Microsoft-Teams-Samples/main/samples/TeamsSDK/agent-targeted-messages/assets/agent-targeted-messages.gif",
39+
"alt": "Targeted Reminder Agent showing reminder delivery with snooze and dismiss options"
40+
}
41+
],
42+
"authors": [
43+
{
44+
"gitHubAccount": "OfficeDev",
45+
"pictureUrl": "https://avatars.githubusercontent.com/u/6789362?s=200&v=4",
46+
"name": "OfficeDev"
47+
}
48+
],
49+
"references": [
50+
{
51+
"name": "Teams developer documentation",
52+
"url": "https://aka.ms/TeamsPlatformDocs"
53+
},
54+
{
55+
"name": "Teams developer questions",
56+
"url": "https://aka.ms/TeamsPlatformFeedback"
57+
},
58+
{
59+
"name": "Teams development videos from Microsoft",
60+
"url": "https://aka.ms/sample-ref-teams-vids-from-microsoft"
61+
},
62+
{
63+
"name": "Teams development videos from the community",
64+
"url": "https://aka.ms/community/videos/m365powerplatform"
65+
}
66+
]
67+
}
68+
]

0 commit comments

Comments
 (0)