microsoft-graph-comms-samples icon indicating copy to clipboard operation
microsoft-graph-comms-samples copied to clipboard

How to parse new Teams Short URL

Open ibirman opened this issue 6 months ago • 4 comments

MS Teams has a new short URL, for example: https://teams.microsoft.com/meet/2414128301281?p=NzhDLMLT8b07DrkwkE

Is there some way to get the information necessary to get a teams bot to connect to the call with this URL?

ibirman avatar Jun 11 '25 16:06 ibirman

Bump

Soapsy avatar Aug 18 '25 16:08 Soapsy

+1 The new url is breaking the PSIBot example

sharon8811 avatar Aug 20 '25 10:08 sharon8811

It is actually easier with this format

Previously we needed to provide the chatInfo object with threadId and messageId, and a meetingInfo with tenantId and Organizer ID.

With this format the ChatInfo Object can just be empty and instead of using OrganizerMeetingInfo, use JoinMeetingIdMeetingInfo, which accepts the number and pwd from the meeting link.

We use this regex to parse it:

[GeneratedRegex("https://teams\\.microsoft\\.com/meet/(?<meetingId>.+?)\\?p=(?<passcode>.+)")]
        private static partial Regex TeamsUrlRegex();

and the high level idea of this is:

// Fetch m_id and pwd
var (meetingId, passcode) = Utils.ParseJoinUrl(joinUrl);
var meetingInfo = new JoinMeetingIdMeetingInfo {
    JoinMeetingId = meetingId,
    Passcode = passcode,
};

// Local media session
var mediaSession = CreateLocalMediaSession();

// The join params object
var joinParams = new JoinMeetingParameters(new ChatInfo(), meetingInfo, mediaSession) {
    TenantId = tenantId,
}; 

[...]

var statefulCall = await Client.Calls().AddAsync(joinParams, new Guid());

One note though, you will need to get the (Azure) tenantId somehow along the meeting link. If you have a flow coded to join meetings set up, like adaptive cards, side/chat panel... You can easily extract it from the messages the bot receives, otherwise, you'll need to provide it manually somehow. This is the only parameter you can't infer directly.

ADelYerro avatar Aug 22 '25 05:08 ADelYerro

@ADelYerro Do you know anything about Azure Communication Services replacing the Microsoft.Skype.Bots.Media ? Is it okay to use Skype.Bots.Media or we have to change

Butcher-vj avatar Sep 02 '25 05:09 Butcher-vj