You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(chat): add chat.get_user() for cross-platform user lookups (#90)
Ports vercel/chat#391 — adds chat.get_user(adapter, user_id) and per-adapter get_user implementations across all 8 platforms.
- Chat.get_user(adapter: str | Adapter, user_id: str) -> User | None resolves string adapter names through registered adapters
- Adapter Protocol gains async def get_user(user_id: str) -> User | None
- User extended with optional email, display_name, avatar_url
- Per-adapter implementations: Slack users.info, Discord GET /users/{id}, Google Chat users.get, GitHub GET /users/{login}, Linear GraphQL user(id:), Teams Graph /users/{aadObjectId} (uses #85's AAD cache), Telegram getChat (best-effort), WhatsApp (Cloud API has no separate lookup)
- Slack get_user awaits _resolve_token_async() so it works under callable bot_token resolvers (#87) when called from background contexts (cron, etc.)
- Lazy imports of platform SDKs inside each method (hazard #10)
- Resolved merge conflicts with #85/#86/#87/#88/#89 — all surface areas coexist
26 new tests in test_get_user_adapters.py + 3 in test_chat_faithful.py.
Copy file name to clipboardExpand all lines: docs/UPSTREAM_SYNC.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -515,6 +515,8 @@ stay explicit instead of being rediscovered in code review.
515
515
| Google Chat file uploads | Ignored in message parse | Supported | API complexity; can add later |
516
516
| Discord Gateway WebSocket | HTTP interactions only | Both HTTP and Gateway | Gateway requires persistent connection |
517
517
| Teams `User-Agent: Vercel.ChatSDK` outbound header | Not set on `aiohttp` calls | Propagated by `botbuilder` 2.0.8 | Python Teams adapter doesn't use `botbuilder` (raw `aiohttp`). Upstream's vercel/chat#415 was a JS-only `botbuilder` SDK bump that flipped `X-User-Agent` → `User-Agent`. No equivalent dependency to bump on the Python side. Setting a `User-Agent` on the ~9 outbound `aiohttp` call sites would be a defense-in-depth nice-to-have; deferred to a follow-up. |
518
+
| Telegram `get_user().is_bot`| Always `False` (matches upstream — `getChat` does not expose `is_bot`) | Always `false` (same caveat documented in upstream code comment) | The Telegram Bot API's `getChat` endpoint does not surface the `is_bot` field that's available on the `User` object inside incoming `Message` updates. Callers needing bot detection must use `message.author.is_bot` from webhooks instead of `chat.get_user(...).is_bot`. |
519
+
| WhatsApp `get_user`| Raises `ChatNotImplementedError` (`Chat.get_user` translates to "does not support get_user") | Not implemented upstream either (no `getUser` on the WhatsApp adapter) | WhatsApp Cloud API has no user lookup endpoint — phone numbers are the only stable identifier and there's no equivalent of `users.info` exposed to business apps. Documented explicitly so callers don't expect parity with Slack/Teams/Discord. |
0 commit comments