Youtube API - Get chat messages of archived livestreams? - youtube-data-api

How do I get chat messages from livestreams after they are completed (using the Youtube data API)? These chat messages normally appear next to the livestream or video of completed livestream.
I can use the LiveChatMessages: list to get the chats of live livestreams, but it gives an error when the livestream is completed.
{
"error": {
"code": 403,
"message": "The live chat is no longer live.",
"errors": [
{
"message": "The live chat is no longer live.",
"domain": "youtube.liveChat",
"reason": "liveChatEnded"
}
]
}
}
Here is a similar question, but there are no answers.

Related

How to send a proactive message from a bot to a user

I am trying to send a message from a bot to a teams user who hasn't already installed the bot and doesn't need to install the bot via REST API.
I have tried following this document.
It clearly states:
"Sending a message to start a new conversation thread is different than sending a message in response to an existing conversation: when your bot starts a new a conversation, there is no pre-existing conversation to post the message to. In order to send a proactive message you need to:"
As far as I understand, this means that what I am trying to do is possible. I have tried to run this sample.
However, as far as I can tell it needs a conversation id. Without a conversation id it doesn't work.
I have tried to send a request like this with a bot network token ( which is normally used to respond to an activity request by the user):
POST /v3/conversations
{
"bot": {
"id": "28:10j12ou0d812-2o1098-c1mjojzldxcj-1098028n ",
"name": "The Bot"
},
"members": [
{
"id": "29:012d20j1cjo20211"
}
],
"channelData": {
"tenant": {
"id": "197231joe-1209j01821-012kdjoj"
}
}
}
However, it fails with the following message:
Send Message to https://graph.microsoft.com/v3/conversations failed: (401) {
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure. Invalid audience.",
"innerError": {
"request-id": "92922235-8c87-47ed-92bc-4ba17469611a",
"date": "2019-09-24T14:43:59"
}
}
}
I am guessing that this maybe because I didn't send MicrosoftAppCredentials.TrustServiceUrl first. But this is a c# call. How do I make the same call in REST API?
Please take a look at Bot Framework REST APIs documentation.
Here are steps to generate the access token which you could use to call Create Conversation APIs.
POST https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=MICROSOFT-APP-ID&client_secret=MICROSOFT-APP-PASSWORD&scope=https%3A%2F%2Fapi.botframework.com%2F.default

Can't subscribe a GMB business to pub/sub push notifications

I spent several hours trying to solve this stuff.
I need to subscribe a gmb business to pub/sub push notifications. I was able to send/receive messages via gcloud console. Successfully created a topic and a subscription. The problem is that i need to subscribe gmb accounts , but I'm getting this error:
(had to edit this question, the code is better than images)
The request:
PUT https://mybusiness.googleapis.com/v4/accounts/102834134483270918765/notifications
{
"topicName": "projects/probable-pager-194417/topics/fetchReviews",
"notificationTypes": [
"NEW_REVIEW", "UPDATED_REVIEW", "GOOGLE_UPDATE"
]
}
The Response:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
"errorDetails": [
{
"code": 3,
"message": "Invalid topic name provided for subscription. Ensure that the topic exists and is shared with the GMB API service account.",
"value": "projects/probable-pager-194417/topics/fetchReviews"
}
]
}
]
}
}
Finally i found the solution. You need to give Pub/Sub Publisher permission in your topic to this account: 'mybusiness-api-pubsub#system.gserviceaccount.com. Have no idea why.
**Exactly that string

Youtube API v3 Get Video using PlaylistItems.list

I developed an integration with Youtube two years ago to retrieve video url's. But last month it started to fail.
My process is:
Using Channels.list and passing UserId we obtain a list of Uploads from: channel.ContentDetails.RelatedPlaylists.Uploads
With this id we use the method: PlayListItems.List passing uploads id in playlistRequest.PlaylistId. We receive a list of playlistItems.
This two calls are working fine. We are obtaining a list of videos.
But when we try to retrieve a video to get the URL we are receiving a 500 error.
PlayListItems.List
Id: VVV0MUNhMG5rWDdVa3J0REFNVk5jTEhRLnFJMURfb0dhYXBj
Part: Snippet
Response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 500,
"message": "Backend Error"
}
}
Example Calls:
Channels.list:
id: UCt1Ca0nkX7UkrtDAMVNcLHQ
Part: ContentDetails
PlayListItems.List:
Part = snippet
PlayListId: UUt1Ca0nkX7UkrtDAMVNcLHQ
PlayListItems.List:
Part: Snippet
Id: VVV0MUNhMG5rWDdVa3J0REFNVk5jTEhRLnFJMURfb0dhYXBj
any idea why is now failing?

youtube.liveChatMessages.list API Explorer

I try list messages from LiveChat of YouTube. Request:
GET https://www.googleapis.com/youtube/v3/liveChat/messages?liveChatId=Qfad59EnhUA&part=snippet&key={YOUR_API_KEY}
Response:
404 Not Found
{
"error": {
"errors": [
{
"domain": "youtube.liveChat",
"reason": "liveChatNotFound",
"message": "The live chat that you are trying to retrieve cannot be found. Check the value of the requests <code>liveChatId</code> parameter to ensure that it is correct."
}
],
"code": 404,
"message": "The live chat that you are trying to retrieve cannot be found. Check the value of the requests <code>liveChatId</code> parameter to ensure that it is correct."
}
}
Pages https://www.youtube.com/live_chat?is_popout=1&v=Qfad59EnhUA and
https://www.youtube.com/watch?v=Qfad59EnhUA exist.
What's wrong?
i decide this problem. liveChatId can be get from broadcast for python:
print '%s' % (broadcast['snippet']['liveChatId'])

Google Play Games Services(Web): Retrieves the Player resource error

I used APIs Explorer with request parameters:
playerId => me
Then I got response:
{ "error": { "code": 500, "message": null } }
Url: https://developers.google.com/games/services/web/api/players/get?hl=zh-TW
API Url: https://www.googleapis.com/games/v1/players/playerId
Now our website can't get player id by this API. A user who logged in our website can't shop. What happened?

Resources