How can I enable Chat communication between external users and Microsoft Teams users through the Teams desktop app ?

Satish Bellare 20 Reputation points
2024-04-12T17:21:52.6666667+00:00

Hello Microsoft team,

I've successfully integrated Microsoft Teams calling into my web application using Azure Communication Services and Microsoft Graph. However, I'm encountering difficulties enabling chat communication between external users accessing my web application and internal users(Team user) who primarily use the Teams desktop app.

Currently, when an external user initiates a chat, a thread ID is generated, allowing them to communicate through the web application's Teams chat interface. However, internal users(Team user) within the organization cannot seamlessly reply or initiate messages through their Teams desktop app to the external users.

Is there a way to bridge this communication gap, allowing internal Teams users to message external users through their desktop app, while the external users continue to utilize the web application's chat interface?

Any guidance or insights on achieving this integration would be greatly appreciated. Thank you!

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
705 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,914 questions
{count} votes

Accepted answer
  1. ajkuma 22,841 Reputation points Microsoft Employee
    2024-05-09T12:45:56.94+00:00

    to update: Summarizing the answer from the comments section, to benefit the community to find the answers quickly.

    As @Ruslan Zdor mentioned, currently the only scenario where chats are officially supported for Teams Interop are in Meetings, and only for ACS Identities.

    Interop scenarios between ACS and teams users are deprecated for now and not supported.

    @Satish Bellare , We appreciate your follow-up and feedback. Thank you!

    --
    Please accept as "Yes" if the answer provided is useful , so that you can help others in the community looking for remediation for similar issues.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Ruslan Zdor 5 Reputation points Microsoft Employee
    2024-04-15T21:54:52.36+00:00

    Hi, Sathish

    To communication using chat between Azure Communication user and Teams user they both has to be connected to the same threadId.

    You can use options:

    1. Create a teams meeting using graph and then join it by Teams user and ACS user. In this case your web application can looks like: create meeting in graphAPI https://learn.microsoft.com/en-us/graph/api/onlinemeeting-get?view=graph-rest-1.0&tabs=http join meeting by link or meeting id https://learn.microsoft.com/en-us/azure/communication-services/how-tos/calling-sdk/teams-interoperability
         const callAgent = callClient.createTeamsCallAgent(tokenCredential)
         callAgent.join(meetingLocator: {meetingLink: "URL"})
         
         
      
    2. Create a threadid using chatClient https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/chat/get-started?tabs=windows&pivots=programming-language-javascript make a call and provide threadId to Teams client (currently this method required to use BETA version of SDK because "threadId" parameter is available in BETA)
                 const call = callAgent.startCall( [ { microsoftTeamsUserId: callQueueId.value.trim() }], 
                 { videoOptions: videoOptions, threadId: thatThreadId.chatThread.id });
         
      

  2. Ruslan Zdor 5 Reputation points Microsoft Employee
    2024-04-29T20:42:41.6466667+00:00

    Hello @Satish Bellare

    I've tested your idea and here is what i've got:

    First step you need to create a thread using ACS chat client and need to add Teams user to this thread:

    it can be done at create step or latter (see two examples below)

    Take a look on how Teams users are defined - they have there own type of Identifier - MicrosoftTeamsUserIdentifier https://learn.microsoft.com/en-us/javascript/api/@azure/communication-common/microsoftteamsuseridentifier?view=azure-node-latest

    You can find UUID for user in GraphAPI or in azure portal

      chatClient.createChatThread({ topic: "Test Chat", options: {
        participants: [
          { microsoftTeamsUserId : "USER OBJECT UUID"
        }
        ]
      }
    
          await this.chatThreadClient.addParticipants({
            participants: [
              {
                id: {
                  microsoftTeamsUserId: 'USER OBJECT UUID'
                }
              }
            ]
          });
    

    After that new thread will NOT show up in Teams, but it will appear when first message will come to Teams user - this is generic Teams logic - new threads will show up in list only after first message is received.

    Be careful will lifetime of ACS token - it is 24 hours and need to be refreshed if you want to reuse it later.