Forum Discussion
App context returning channel instead of chat info for direct chats on Android
Using the latest versions of microsoft/teams-js SDK and the Teams app, the following code is used to get app context:
import * as microsoftTeams from "@microsoft/teams-js";
microsoftTeams.app.getContext()
This has been working on all platforms for some time, but now returns the incorrect payload on Android devices (for comparison, it works just fine on desktop & iOS)
For a direct (one-on-one) chat, we would expect "chats" data to be contained in the response. However, the response instead contains "channel" data on Android. And in this data, the `team.internalId` equals the`channel.id`, with no other IDs present related to the channel or team. When querying the MS graph endpoint `/teams/{id}/channels/{channel_id}` using these IDs, we get the error "teamId needs to be a valid GUID" which makes sense because this isn't actually in a team.
Without the "chats" data it is impossible to get info on this chat at the regular "/chats/{id}" endpoint.
Snippet of missing data in working context on other platforms:
"page": { "id": [redacted], "frameContext": "content", "subPageId": [redacted], "isFullScreen": false, "isMultiWindow": false, "sourceOrigin": null }, "chat": { "id": "[redacted]@unq.gbl.spaces" }
Sample from Android context:
"app": { "locale": "en-gb", "sessionId": "<hidden>", "theme": "dark", "parentMessageId": "", "userClickTime": 1698063884300, "host": { "name": "Teams", "clientType": "android", "sessionId": "<hidden>", "ringId": "general" }, }, "page": { "id": "", "frameContext": "settings", "subPageId": "", "isFullScreen": false, "sourceOrigin": "TEAMS-ANDROID..settings" }, "user": [redacted], "channel": { "id": "[redacted]@unq.gbl.spaces", "displayName": "General", "relativeUrl": "", "membershipType": "", "ownerGroupId": "", "ownerTenantId": "" }, "meeting": { "id": [redacted] }, "team": { "internalId": "[redacted]@unq.gbl.spaces", "displayName": "", "type": 0, "groupId": "", "isArchived": false, "userRole": 0 }
- Sayali-MSFTMicrosoft
seanmc86- Thanks for reporting your issue.
Please Track this issue from here-Teams app context returning channel instead of chat info for direct chats on Android · Issue #2003 · OfficeDev/microsoft-teams-library-js (github.com)