Skip to content

Conversation

amittman
Copy link

Description

This PR is a simple swap of the arguments passed to the connectorClient.getConversationMember call within the TeamsInfo.getMemberInternal function so that the correct url is formed.

Problem

When calling TeamsInfo.getMember(context, userId), I was getting a 400 error from the API call. Upon inspecting the url, we found that the url path being used took on the form:

/v3/conversations/${userId}/members/${conversationId}

But it should take the form:

/v3/conversations/${conversationId}/members/${userId}

Solution

We found that the arguments being passed into connectorClient.getConversationMember were swapped when called within TeamsInfo.getMemberInternal. With a simple swap inside TeamsInfo.getMemberInternal, the api call takes on the correct form.

The other solution would be switching the arguments at the ConnectorClient.getConversationMember implementation level like so:

- public async getConversationMember (userId: string, conversationId: string): Promise<ChannelAccount> {
+ public async getConversationMember (conversationId: string, userId: string): Promise<ChannelAccount> {
  if (!userId || !conversationId) {
    throw new Error('userId and conversationId are required')
  }
  const config: AxiosRequestConfig = {
    method: 'get',
    url: `v3/conversations/${conversationId}/members/${userId}`,
    headers: {
      'Content-Type': 'application/json'
    }
  }
  const response = await this._axiosInstance(config)
  return response.data
}

Since this would require anyone currently using a direct call to ConnectorClient.getConversationMember to swap them around, I figured the solution I chose was less disruptive.

However, the TeamsConnectorClient.getConversationMember function uses what looks to be the preferred (conversationId: string, userId: string) argument structure so it can be confusing. Feel free to change the implementation if that solution isn't as disruptive as I first thought.

@Copilot Copilot AI review requested due to automatic review settings September 17, 2025 20:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an argument order bug in the TeamsInfo.getMemberInternal method that was causing 400 errors from the Teams API. The method was incorrectly passing conversationId and userId in the wrong order to ConnectorClient.getConversationMember, resulting in malformed API URLs.

  • Fixed argument order when calling ConnectorClient.getConversationMember to match expected parameter sequence
  • Ensures API calls generate correct URL format: /v3/conversations/${conversationId}/members/${userId}

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MattB-msft
Copy link
Member

@ceciliaavila and @sw-joelmut please review.

@tracyboehrer tracyboehrer enabled auto-merge (squash) October 10, 2025 16:29
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.

5 participants