How to get the old username field with Youtube Data API V3 - ruby

As noted in a similar question (How to get current user's profile information in YouTube Data API v3) there can be a difference between a youtube user's username (found at youtube.com/user/{the username}) and their channel title. The channel title can be retrieved through the channel/list resource, however that channel title may not be equal to the username that owns that channel. The problem here is that where the username is unique, the channel title may not be and this causes great confusion inside our app (as we have no way of differentiating between user accounts).
Is there any way in the V3 Data API to get the username?

There's a human-readable display name under channel.snippet.title

Related

How can I add a middleware logger to my bot?

I tried to add telemetry services following this tutorial, but I looked at my logs in azure and I didn't see user messages. How can I add a middleware that can save user's conversations?
What I'm trying to do is to capture the messages that LUIS and QnA could not find an answer for. So we want to log these so we can improve our bot in the future.
I know LUIS has this feature already in luis.ai, but we want to add more information than what LUIS captures.
You have to do a custom implementation for storing user conversations. I have used Azure Table in one of my implementations to store the conversation. The table structure will have the conversation id + user id as the unique key and then storing the conversation in json format in the table. The conversation data is updated by intercepting every message sent to and from the bot. You can refer this MSDN article for a reference implementation.

Launch Teams chat with particular contact using msteams URI scheme

I'm able to open Teams chat with a specified contact using 'sip:example#emailaddress.com' but 'msteams:example#emailaddress.com' only opens the application; it does not open chat with the specified individual.
Is there, or will there be, a scheme which allows for opening chat with an individual using the 'msteams:' uri similar to 'skype:example#emailaddress.com'?
Updated answer
try this Teams Chat
This will open a private conversation with the user in ms teams
Currently this is not supported for Microsoft Teams but it's on our roadmap.
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links
Find the Chat deeplink, and embed elsewhere.
Example: With one or more users can be specified.
Example: https://teams.microsoft.com/l/chat/0/0?users=joe#contoso.com,bob#contoso.com&topicName=Prep%20For%20Meeting%20Tomorrow&message=Hi%20folks%2C%20kicking%20off%20a%20chat%20about%20our%20meeting%20tomorrow
The query parameters are:
users The comma-separated list of user IDs representing the participants of the chat. The user performing the action is always included as a participant. The User ID field currently only supports the Azure AD UserPrincipalName (typically an email address).
topicName An optional field for chat's display name, in the case of a chat with 3 or more users. If this field is not specified, the chat's display name will be based on the names of the participants.
message An optional field for the message text that you want to insert into the current user's compose box while the chat is in a draft state.
Note that the link will only open a chat if the users are in your tenant. For federated users it will only open if you previously had a chat window with them.

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

How do I correlate user between channels?

From what I see, Bot Framework is providing an abstraction over users in different channels by providing a ChannelAccount class that has ChannelId/Address pair to identify user via its account and Id property, which is... okay, here's the question.
I suppose that the idea behind Id is to provide a unique and persistent identifier that can be used to cross-correlate users between account (i.e., I can say that Slack user #alpha is also email user alpha#company.con). This idea is supported by the fact that ChannelAccount for my bot always has same Id regardless of the channel (and Address is different between channels, obviously).
If this is right, and I hope it is, is there any way to provide BotConnector with the correlation information? I.e., I want BotConnector to give me ChannelId/Address, and I'd give back user Id which I'd the get back in incoming message.
The purpose of this is quite simple: I want the code inside my bot to use the Id as already correlated identifier so that I can log it, build logic from it and so on.
BotFramework does not yet support linking of accounts. In the interim, take a look at this post for one way you might implement a solution:
Why isn't BotUserData persisting and retrievable in my Bot Framework bot?

How to get the Google Chat (Hangout) ID of a google authenticated user (oauth2)?

I am working on xmpp client for google chat. I need the Google Talk ID which looks something like "xxxxx#public.talk.google.com" of a user. Using oauth2, I am able to get the email id(gmail) and other profile information but I can't figure out how to get the Google Chat ID.
I know that I can use the email id in place of the Google Chat ID for all purposes. I need the Google Chat ID because I am using email ID as an identifier in my user table. Whenever a user receives a message in Google Chat (Hangouts), I am getting the from id as "xxxxx#public.talk.google.com" . There's no way for me to check if I have a record of the sender in my user table. If I can retrieve the Google Chat ID when people authenticate with my client, I can store it in the user table and use it to match when a user receives messages.
Sending messages works fine because I have the email id of the target user and I can use that to send message.
Please suggest if it's possible to get the Google Chat ID
There is even other problem: you can send or receive messages from users you don't even know the email ID. Maybe rely on using Google Talk ID always instead of email ID for your user table can be a better option.
BTW I heard something about that Google is discontinuing Google Chat...

Resources