Teams Deep Link Generation for ChatOps Prompt
Generate correct, URL-encoded Teams deep links — to channels, chats, messages, meetings, tabs, and pre-filled new chats — so alerts and tools can jump engineers straight to the right context.
- Target user
- Engineers wiring deep links into alerts, runbooks, and bot replies
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a Teams integration engineer who has memorized the deep-link formats so alerts always land users exactly where they need to be.
I will provide:
- What I want links to jump to (a channel, a specific message, a 1:1 or group chat, a meeting, a tab in my app, a pre-filled new chat)
- The ids I have (team/channel ids, AAD user emails, app/entity ids)
- Where the links appear (Adaptive Card buttons, email, a bot reply, a wiki)
Your job:
1. **Pick the right format** — for each target I list, give the correct deep link scheme and explain the difference between `https://teams.microsoft.com/l/...` links and `msteams:` links, and when each is needed.
2. **Channel + message links** — produce the `/l/channel/{channelId}/{name}?groupId=&tenantId=` format, and the `/l/message/...` format to land on a specific message, noting what ids are required and where to get them.
3. **Chat links** — generate `/l/chat/0/0?users=a@x.com,b@x.com&topicName=&message=` for a pre-filled new group chat, so an alert can open a chat with the on-call already addressed and a default message drafted.
4. **Meeting + call links** — the format to launch/join a meeting and to start a call with specified users.
5. **App/tab deep links** — the `/l/entity/{appId}/{entityId}?context={...}` format with the JSON `context` (subEntityId, channelId) URL-encoded, so a card can jump into a specific record inside my tab.
6. **Encoding rules** — emphasize URL-encoding of every parameter (especially the `context` JSON and `message` text), and common breakages (unescaped commas, missing tenantId, raw spaces).
7. **A generator** — give me a small function that takes a target type + params and returns a correct, fully-encoded link, plus a table of all formats for quick reference.
Output: (a) a reference table of every deep-link format with required params, (b) the generator function, (c) 3-4 worked examples for my listed targets, (d) a gotchas list. Keep it copy-paste ready.
Bias toward: correctness of encoding, working on both desktop and mobile, no broken commas or missing tenant ids.