Skip to content

feat: add chat.getUser() for cross-platform user lookups#391

Open
bensabic wants to merge 3 commits intomainfrom
feat/get-user
Open

feat: add chat.getUser() for cross-platform user lookups#391
bensabic wants to merge 3 commits intomainfrom
feat/get-user

Conversation

@bensabic
Copy link
Copy Markdown
Contributor

  • Add UserInfo type and optional getUser() method to the Adapter interface
  • Implement on Slack, Discord, Google Chat, GitHub, Linear, and Telegram adapters
  • Returns null when user not found, throws ChatError("NOT_SUPPORTED") for adapters without support
  • Add "Who Am I" button to the example app
  • Add docs with API reference, UserInfo type table, and error handling examples

Add UserInfo type and optional getUser() method to the Adapter interface.
Implement on Slack (extends existing lookupUser with email/avatar),
Discord, Google Chat, GitHub, Linear, and Telegram adapters.

Add "Who Am I" button to the example app demonstrating the feature.
Update docs with getUser API reference and usage examples.
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat Ready Ready Preview, Comment, Open in v0 Apr 16, 2026 1:04pm
chat-sdk-nextjs-chat Ready Ready Preview, Comment, Open in v0 Apr 16, 2026 1:04pm

@bensabic
Copy link
Copy Markdown
Contributor Author

@heyitsaamir any chance we can add Teams support for this?

@bensabic bensabic requested a review from dancer April 16, 2026 03:34
Comment thread packages/chat/src/chat.ts
@heyitsaamir
Copy link
Copy Markdown
Contributor

@heyitsaamir any chance we can add Teams support for this?

It should be possible!

  const member = await app.api.conversations
    .members(activity.conversation.id)
    .getById(activity.from.id);

Lmk if that doesn't work!

@heyitsaamir
Copy link
Copy Markdown
Contributor

So the above will get you the member, but it requires the conversation id. Members in Teams aren't global members, but more based on membership of a conversation.

If you want global members, you can do that via graph, but it'll require some graph permissions i believe (User.Read.All).
Then call it like:

const graphUser = await app.graph.call(endpoints.users.get({ 'user-id': activity.from.aadObjectId! }));

@bensabic
Copy link
Copy Markdown
Contributor Author

So the above will get you the member, but it requires the conversation id. Members in Teams aren't global members, but more based on membership of a conversation.

If you want global members, you can do that via graph, but it'll require some graph permissions i believe (User.Read.All). Then call it like:

const graphUser = await app.graph.call(endpoints.users.get({ 'user-id': activity.from.aadObjectId! }));

Ah thank you for this! Do you by any chance have time to push it to the PR? Mainly ask as you'd know exactly which methods to use and what to troubleshoot accordingly

- slack: return null from lookupUser on failure instead of fallback
  object, removing the isBot === undefined sentinel in getUser
- slack: use image_192 instead of image_72 for better avatar quality
- gchat: cache avatarUrl from webhook sender payload
- gchat: return avatarUrl in getUser response
- gchat: fix tests to use current cache format with isBot field
- docs: document null return, fix example to use message.author
@heyitsaamir
Copy link
Copy Markdown
Contributor

heyitsaamir commented Apr 16, 2026

So the above will get you the member, but it requires the conversation id. Members in Teams aren't global members, but more based on membership of a conversation.

If you want global members, you can do that via graph, but it'll require some graph permissions i believe (User.Read.All). Then call it like:

const graphUser = await app.graph.call(endpoints.users.get({ 'user-id': activity.from.aadObjectId! }));

Ah thank you for this! Do you by any chance have time to push it to the PR? Mainly ask as you'd know exactly which methods to use and what to troubleshoot accordingly

Give me a couple of days :). I can include it after this PR goes in?

@bensabic
Copy link
Copy Markdown
Contributor Author

So the above will get you the member, but it requires the conversation id. Members in Teams aren't global members, but more based on membership of a conversation.

If you want global members, you can do that via graph, but it'll require some graph permissions i believe (User.Read.All). Then call it like:

const graphUser = await app.graph.call(endpoints.users.get({ 'user-id': activity.from.aadObjectId! }));

Ah thank you for this! Do you by any chance have time to push it to the PR? Mainly ask as you'd know exactly which methods to use and what to troubleshoot accordingly

Give me a couple of days :). I can include it after this PR goes in?

That'd be perfect, thank you so much!

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