Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teams app context returning channel instead of chat info for direct chats on Android #2003

Open
seanmc86 opened this issue Oct 23, 2023 · 5 comments

Comments

@seanmc86
Copy link

Using the latest versions of microsoft/teams-js SDK (2.16.0), microsoft-graph-client (3.0.7) and the Teams app (1416/1.0.0.2023183501/1009), 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. (this does not work when using the channel.id in its place, obviously)

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
}

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"
  }
@nwojod-MSFT
Copy link
Contributor

Hi @seanmc86 thank you for reporting this issue, and apologies for any inconvenience this may have caused. We will investigate this on our end and get back to you. Thanks

@Nivedipa-MSFT
Copy link

Nivedipa-MSFT commented Oct 26, 2023

@seanmc86 - Thanks for reporting your issue. We have tested this using TeamsJS version 2.16.0, Android Teams version 1416/1.0.0.2023183501/1009, and Android version 12. We were able to obtain the chat ID for direct chats on Android.

image

Could you please test this again and confirm once?

@seanmc86
Copy link
Author

seanmc86 commented Oct 27, 2023

I can still reproduce the error for all direct and group chats. Note that the issue occurs when installing this tab for the first time in these chats. It's the same every time:

  • page.id is empty
  • page.subPageId is empty
  • channel and team objects are provided, whilst the chat object is missing

Teams 1416/1.0.0.2023183501/1009, teams-js 2.16.0

@seanmc86
Copy link
Author

seanmc86 commented Nov 3, 2023

Please see my latest feedback @Nivedipa-MSFT

@ChetanSharma-msft
Copy link

ChetanSharma-msft commented Nov 10, 2023

@seanmc86 - We are able to repro that issue, we have raised bug for the same. We will inform you once we get any update.

Teams 1416/1.0.0.2023183501/1009
teams-js 2.16.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants