Microsoft Teams Redirect URL to a Thread or Group Conversation - botframework

I've been using the next URL to redirect any user to their private chat with our MS Teams App:
https://teams.microsoft.com/l/chat/0/0?users=28:b9cc7986-dd56-4b57-ab7d-9c4e5288b775
with b9cc7986-dd56-4b57-ab7d-9c4e5288b775 being the App Id of out bot (sample App Id in this case).
This URL will open the private MS Teams Chat with the user clicking the URL and our App on any client (Mobile, Desktop, Browser) without opening any web pages if not needed. The clients can handle the URL themselves. You can try it with this provided sample URL.
What would be a proper way to be able to redirect to a group conversation or thread?
I've thought about using the Conversation Id (or other Ids available in our MS Teams App) or something but couldn't find any good documentation or examples online.

You can use Deep Links to accomplish that, specifically deep linking to a chat. As shown in that link, you can link to specific users, but also set a conversation topic as well as an initial message. One thing that's often overlooked, just fyi, is this sentence:
New chats are created in draft state until the user sends the first message

Related

Format of Teams Chat URL

I have an app that runs within Teams that shows a list of employees, name, email, presence, title and phone.
For the name column I would like to present it as a link that when clicked will open up a chat within the Teams desktop or mobile app with that employee. If there is an existing chat session, it should go to that, else create a new chat. It should not open the web client and go through the hassle of choosing to then open in the desktop app.
I was previously using this format:
https://teams.microsoft.com/l/chat/0/0?users=user#user.com
This caused the whole web client flow, so after some digging around I changed it to:
MSTeams:/l/chat/0/0?users=user#user.com
This seems to work for an existing chat but does not work for a new chat. The To: field at the top of the page is not completed.
Any ideas?
Thanks
Mar

Time out, Image send, Email track adding to bot framework composer

I have developed a chatbot for IT Support team in our company, running on MS Teams using Bot Framework Composer. I have integrated it with Azure logic apps to send emails to IT Support team.
I want to know how to;
Get user's email address in MS Teams (We can get user's name using ${turn.activity.from.name} telemetry track event)
Set a timeout period
Send a Image to using HTTP request in JSON format (Then users can upload the screenshot of their issue)
Yes, you can get the user's email address in MS teams by making fetching the roster or user profile or make use of get single member detail from this documentation.
Not sure if you want to restart a conversation or track the last time a message was received from a user, but you can refer to Expire a conversation documentation to get started with.
MS Teams makes use of webhooks to integrate with external apps and makes use of Standard HTTP message exchange feature where responses appear in the same chain as the original request message and can include any bot framework message content, for example, rich text, images, cards, and emojis.

Microsoft Teams go to a conversation using a deeplink

we have an app for MS Teams which users can start a conversation and send messages to. The app does some processing and returns the response back. I am looking for the ability to open an precreated conversation using a link. I have needed information like conversation id etc. How do i create a link that can be used for this navigation?
To be more specific this doc is not helpful https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links#deep-linking-to-a-chat
The link i need is for the conversation. Currently it is possible to manually copy that link by right clicking on any conversation and use "Copy link". Is there a way to get it or generate it when user creates the conversation. A sample link copied from looks like below
https://teams.microsoft.com/l/message/19:a0a0088174a644cb91409f4d8f79d888#thread.tacv2/1612324568748?tenantId=04e930f3-0866-4a6d-b07c-a4737e8f9865&groupId=087bf290-deb5-4790-b159-bf86914765b4&parentMessageId=1612324568748&teamName=Sales%20Team&channelName=FlashCX%20Sales&createdTime=1612324568748
So trying to see if i can either get this the URL using apis or can generate with the parts involved
#Moblize - Currently you can create Deep-link to chat for particular conversation. You cannot create a link which will redirect to a particular message in channel. Please check this docs for info.

External link to existing Microsoft Teams chat

I have developed a Microsoft Teams app, and I'm using 'deep linking' to create named chats (chats with topic names) with selected users, as per the docs:
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links#deep-linking-to-a-chat
An example of a 'deep link' to create a chat would be:
https://teams.microsoft.com/l/chat/0/0?users=joe#contoso.com,bob#contoso.com,dave#contoso.com&topicName=Prep%20For%20Meeting%20Tomorrow&message=Hi%20folks%2C%20kicking%20off%20a%20chat%20about%20our%20meeting%20tomorrow
This works fine - and if I save the portion of the link minus the 'message' portion, this again works fine, and links the user to the existing chat:
https://teams.microsoft.com/l/chat/0/0?users=joe#contoso.com,bob#contoso.com,dave#contoso.com&topicName=Prep%20For%20Meeting%20Tomorrow
However, if another user is added to the chat from inside Teams itself, the link above will not link to the existing chat any more, rather create a brand new chat instance with the same topicName and originally specified users.
Is there a way of 'deep linking' to a chat by it's topicName or some kind of ID only? Without having to get clever with the Microsoft Graph API?
https://teams.microsoft.com/l/chat/0/0?Prep%20For%20Meeting%20Tomorrow
just links to the chat 'home screen', where a user can start a new chat through Teams
I might be wrong, but I'm pretty sure you can't achieve this directly. As soon as you add a new person, it's no longer the "same" chat, so to speak (e.g. a chat with "Joe, Bob and Dave" is NOT the same as a chat with "Joe, Bob, Dave and Sue". The two ways I can think of that you can achieve what you're looking for though, are:
create a Meeting with that subject - the "meeting" chat seems to hang around forever, it has a title, and you can modify participants, even after the "meeting" is over.
Alternative to the above, if there's an ongoing initiative, maybe it's just better as an actual Team or Channel anyway...?
I came here looking a solution to this same requirement.. a link that others can click on to dial into a normal MS Teams (multi-person) chat. I want to include this in my meeting invites in the case where I initially created the chat group manually within MS Teams (not originally via meeting invite).
I opened the chat in MS Teams Web (in my browser) to get the unique conversation identifier and then replaced that portion in a sample link that I would typically find in meeting invites. I also removed the context parameter. When I followed the resulting link in my browser it launched my MS Teams desktop application and joined the chat group meeting. An illustrative sample link is below:
https://teams.microsoft.com/l/meetup-join/*19:1235774810bf4d7086ada8e13c7c6c8a#thread.v2/0*
The portion "19:1235774810bf4d7086ada8e13c7c6c8a#thread.v2/0" is what I replaced.
And there is no need for something like "?context=%7b%22Tid%22%3a%22c9b9cb50-3544-4db4-a267-fa84df2f4ceb%22%2c%22Oid%22%3a%22663db54f-657a-407d-8a0b-45c76d8cdffd%22%7d" at the end either. I'm not sure what will happen if someone uses this link who has not been added to the chat by me though. You'll have to test that if that is a requirement.

Questions about saving bot state

I read through this https://learn.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-state about saving state data. I have some questions regarding the same:-
Lets take a bot exposed through the browser channel as an example here:-
What is the lifetime of the data stored? For instance when the bot saves data using context.ConversationData.SetValue(..) Is the data purged when the session is over(when the user refreshes the page)?
The From object from Activity has Id and Name. Are these generated by the channel each time a chat session begins? For instance, if I was chatting with bot then refresh the web page, now will my Id and Name have changed?
Same question about conversation. If I refresh the page and begin the conversation again, do I get a new conversation ID?
I read in some blog that if you use dialogs, the dialog stack state is automatically saved in whichever storage you have configured. Is this correct? If so, why? Say I refresh the page, will I be able to retrieve the state of the dialog stack and resume the conversation from there?
If you are giving code samples, request you to give C# samples if possible
Thanks very much in advance!
Hi, I hope below answer will find useful to you :
1.
What is the lifetime of the data stored? For instance when the bot saves data using context.ConversationData.SetValue(..) Is the data
purged when the session is over(when the user refreshes the page)?
ANS:->
As per the guidelines by Bot Framework, State API is in the state of depreciation. you will have to use your own state management service to maintain the state of your Bot. Ref: https://learn.microsoft.com/en-us/azure/bot-service/dotnet/bot-builder-dotnet-state
So assuming you are using Table Storage or SQL Database for storing your bot in this case the data will persist as long as your storage account and database available.
2.
The From object from Activity has Id and Name. Are these generated
by the channel each time a chat session begins? For instance, if I
was chatting with bot then refresh the web page, now will my Id and
Name have changed?
ANS:->
This depends on how you initialize the chat. for instance, if you are using
Web chat : It will be empty id.
Skype : It will be skype id and user name
DirectLine : you can define your own id and name as per your need.
3.
Same question about the conversation. If I refresh the page and begin the conversation again, do I get a new conversation ID?
ANS:->
Yes. Every time you refresh your webpage you will be assigned new conversationId but in case of DirectLine you can use the previous conversation id to maintain the history of your conversation. you can store the conversation id in local storage or in browser's cookies and read whenever you feel to load the chat history. If you don't need history to be preserved then I suggest let webchannel handle its own ids.
4.
I read in some blog that if you use dialogs, the dialog stack state is automatically saved in whichever storage you have configured. Is this correct?
ANS:->
Yes.
5.
If so, why? Say I refresh the page, will I be able to retrieve the state of the dialog stack and resume the conversation from there?
ANS:->
As hinted earlier, you will need to migrate your bot to use DirectLine API instead of webchat channel. As webchat doesn't support history so DirectLine.
Please refer the guidelines provided by Microsoft and Samples provided on GitHub.
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-concepts
Quick answers:
As far as I know, there is no purge. And you can check the implementations of Azure DocumentDbBotDataStore or TableBotDataStore here. Based on my implementations, I saw there is a Timestamp column in the stored data so you could do cleanup based in that.
Generation of Id and Name fields (for From, but also for Recipient given the message origin / destination): yes they depend on the channel. I made a detailed answer about on SO: Bot Framework User Identification
Yes in the webchat's case
Yes, the dialog stack state is saved so that you can continue your conversation. "Say I refresh the page, will I be able to retrieve the state of the dialog stack and resume the conversation from there?": if you have the same details (channelId + conversationId, userId) you should yes. The exception is the webchat / directLine where you have to implement the fact that you keep the same IDs. For other channels like Slack, Facebook Messenger etc, these items remains the same and the dialog can continue where it stops on the previous messages exchange

Resources