I'm already able to play music with #assistant/conversation by using this:
conv.add(new Media({
mediaObjects: [{
name: 'Trance Track 1',
description: 'Media description',
url: 'https://my-url.de/Trance1.mp3',
image: {
large: new Image({
url: 'https://somewhere/whateverimage.jpg',
alt: 'my image here'
})
}
}],
mediaType: MediaType.Audio,
optionalMediaControls: [OptionalMediaControl.Paused, OptionalMediaControl.Stopped],
startOffset: '0s'
}));
But the user is able to seek forward/backward. How can I disable this?
TuneIn already has this. I could not find anything in the docs: https://developers.google.com/assistant/conversational/prompts-media
The answer for this issue can be found on the corresponding GitHub issue: https://github.com/actions-on-google/assistant-conversation-nodejs/issues/17
In summary:
Unfortunately, the Media response API does not support the features requested (i.e. disable seeking, prevent skip track, skip track w/ complex rule set, etc.).
To get a full overview on what features Media response provides, as well as it's limitations, please refer to our documentation:
https://developers.google.com/assistant/conversational/prompts-media
Feature request tickets have been filed internally for [these features].
Related
I've created a Whatsapp chat bot that collects various user information but I am unable to collect an image that a user sends. How can I do this? Is it a matter of using the right Field type, which I've tried doing but none of the default field's apply to images? Please help if anyone knows of a solution.
Heyooo. 👋 Twilio Developer Evangelist here.
If a User sends an image via Whatsapp the image URL will be available in the sent webhook. You can have a look at the payload the webhook includes:
body: {
MediaContentType0: 'image/jpeg',
SmsMessageSid: 'MM9...',
NumMedia: '1',
SmsSid: 'MM9...',
SmsStatus: 'received',
Body: '',
To: 'whatsapp:+141...',
NumSegments: '1',
MessageSid: 'MM9bc...',
AccountSid: 'ACa34...',
From: 'whatsapp:+49176...',
MediaUrl0: 'https://api.twilio.com/2010-04-01/Accounts/ACa34bb5d3c305d08ae1308786f4d79b72/Messages/MM9bc3...',
ApiVersion: '2010-04-01'
}
You'll find the NumMedia and MediaUrl0 property which includes the URL of the sent image. You can then download these images and do whatever you like with them.
To retrieve the image after the message and webhook were sent you can have a look at the MediaResource Docs. You can fetch media also programmatically with something along the following lines:
client.messages('MM...')
.media('ME...')
.fetch()
.then(media => console.log(media.contentType));
In case you're using Studio you can have a look at this tutorial which handles Whatsapp Media with a fun use case.
Let me know if that helps. 😊
(It's hard to give more advice because I'm not sure what you're trying to do.)
I am using v3 api and videoEmbeddable="true" in my search request.
However, when I try to play the video(s) on my webpage, it says the content is blocked to be displayed on this site. Watch it on Youtube.
Is there a parameter that I can use which will not return non-embeddable videos?
*EDIT *
Video Response:
{u'items': [{u'snippet': {u'title': u'Jerez - Yamaha Preview'}, u'contentDetails': {u'definition': u'hd', u'contentRating': {u'ytRating': u'ytAllAudiences'}, u'caption': u'false', u'duration': u'PT1M21S', u'licensedContent': True, u'dimension': u'2d'}, u'status': {u'publicStatsViewable': True, u'privacyStatus': u'public', u'uploadStatus': u'processed', u'license': u'youtube', u'embeddable': True}, u'id': u'aaR72Xf_4wc'}]}
Query:
return yt_service_v3.videos().list(
id='aaR72Xf_4wc',
part="id,snippet,contentDetails,status",
fields="items(id,snippet(title),contentDetails,status)",
).execute()
This video is not embeddable on my webpage and in the response there is nothing to suggest that this video is not embeddable.
I request both contentDetails and status. I am not requesting via mobile device
Please provide pointers.
A small subset of videos have domain-level whitelists or blacklists applied to them by their content owners. Those restrictions are not reflected in API responses.
This is what you're seeing with aaR72Xf_4wc and the relevant portion of the blog post about playback restrictions is
There are even more subtle restrictions that occasionally come into
play. Not all of these are currently queryable via the API. For
instance, some videos are only playable on a certain set of domains.
I assume it wasn't there 2.5 years ago, but the current API does have indication for regional block, when requesting contentDetails. here's a response for such request for 2 videos, the first one is blocked and the second one is not. Note the regionRestriction key:
{u'etag': u'"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/ZqEbAZJ-JFnYX3v37ZRuhK8FFN8"',
u'items': [{u'contentDetails': {u'caption': u'false',
u'definition': u'sd',
u'dimension': u'2d',
u'duration': u'PT2M5S',
u'licensedContent': False,
u'regionRestriction': {u'blocked': [u'NU',
u'BY',
u'NP',
u'NR',
u'WS',
u'TD',
u'SY',
u'NZ',
u'NE',
.
.
.
u'TG']}},
u'etag': u'"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/hM4srkgNUiZj2GtAhLDFoFrHnlk"',
u'id': u'WGf4mSBoCzQ',
u'kind': u'youtube#video'},
{u'contentDetails': {u'caption': u'false',
u'definition': u'sd',
u'dimension': u'2d',
u'duration': u'PT17M2S',
u'licensedContent': False},
u'etag': u'"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/JNjXh3lMwcaC9gtbzM-KmOQLh44"',
u'id': u'Tw75Dt8fBBs',
u'kind': u'youtube#video'}],
u'kind': u'youtube#videoListResponse',
u'pageInfo': {u'resultsPerPage': 2, u'totalResults': 2}}
You can also filter by syndication if you are accessing from a mobile device. Last but not the least there are region specific blockages.
Maybe you need to also include the filter for videoSyndicated. I don't know for sure though; it's a little confusing to me.
I am running a Slack team for a gaming community. My users all have avatars in the game and I am already using the Slack API to automatically set their Slack user name to their in-game name, so its easier for people to be recognized.
In addition I would also like to automatically set their profile picture in Slack with their avatar picture from the game. However I could not figure out a way to do it, so my question is can it be done and if yes, how?
My current starting point is the undocumented API method users.profile.set which allows me to set the profile of a user (see below for an example of a user profile). So far I've been able to modify:
first_name
last_name
title
phone
skype
The user profile also contains the URL to the profile picture, but I was so far not able to change it. I tried external URLs, and URLs of images already uploaded on Slack.
Here is a link to my documentation of the "undocumented" Slack API method users.profile.set with all options that I could figure out so far.
Any help would be hugely appreciated.
Update November 2017
In the meantime Slack has added a new API method called users.setPhoto for setting profile photos. However, this new method does not solve this question, because it only works for your own user (or more precisely the user you have an access token for, e.g. you not specify another user ID).
I am looking for a way to change the profile pictures of all users on my Slack team by a Slack app / bot.
Example of a user profile:
{
id: "U12345678",
team_id: "T12345678",
name: "erik.kalkoken",
deleted: false,
status: null,
color: "9f69e7",
real_name: "Erik Kalkoken",
tz: "America/Chicago",
tz_label: "Central Daylight Time",
tz_offset: 3600,
profile: {
avatar_hash: "XXX",
first_name: "Erik",
last_name: "Kalkoken",
title: "",
phone: "",
skype: "",
image_24: "https://avatars.slack-edge.com/2016-03-19/XXX_24.jpg",
image_32: "https://avatars.slack-edge.com/2016-03-19/XXX_32.jpg",
image_48: "https://avatars.slack-edge.com/2016-03-19/XXX_48.jpg",
image_72: "https://avatars.slack-edge.com/2016-03-19/XXX_72.jpg",
image_192: "https://avatars.slack-edge.com/2016-03-19/XXX_192.jpg",
image_512: "https://avatars.slack-edge.com/2016-03-19/XXX_512.jpg",
image_1024: "https://avatars.slack-edge.com/2016-03-19/XXX_512.jpg",
image_original: "https://avatars.slack-edge.com/2016-03-19/XXX_original.jpg",
real_name: "Erik Kalkoken",
real_name_normalized: "Erik Kalkoken",
email: "test#email.com"
},
is_admin: false,
is_owner: false,
is_primary_owner: false,
is_restricted: false,
is_ultra_restricted: false,
is_bot: false,
has_2fa: false
}
After messing around with it for a little, it's possible to use the undocumented users.setPhoto endpoint:
curl https://slack.com/api/users.setPhoto \
-F "token=<removed>" \
-F "image=#/path/to/image.jpg"
Unfortunately it will resize your avatar which removes the ability to upload animated gifs.
I don't think the profile picture API is available yet. I read a while back that it was on their TODO list.
I was able to get it to work using Jay Querie's method.
The two difference was I gave the full path and I put the image first.
So in my case:
curl https://slack.com/api/users.setPhoto -F "image=#C:\Users\name\Pictures\dojocat.jpg" -F "token=xxxx-123-123-123-123"
Originally when I was using gitbash to run the curl and it was searching for the image in the directory where my gitbash was installed / being executed. So if I put the dojocat.jpg next to my gitbash executable it would would have found it.
I am using v3 api and videoEmbeddable="true" in my search request.
However, when I try to play the video(s) on my webpage, it says the content is blocked to be displayed on this site. Watch it on Youtube.
Is there a parameter that I can use which will not return non-embeddable videos?
*EDIT *
Video Response:
{u'items': [{u'snippet': {u'title': u'Jerez - Yamaha Preview'}, u'contentDetails': {u'definition': u'hd', u'contentRating': {u'ytRating': u'ytAllAudiences'}, u'caption': u'false', u'duration': u'PT1M21S', u'licensedContent': True, u'dimension': u'2d'}, u'status': {u'publicStatsViewable': True, u'privacyStatus': u'public', u'uploadStatus': u'processed', u'license': u'youtube', u'embeddable': True}, u'id': u'aaR72Xf_4wc'}]}
Query:
return yt_service_v3.videos().list(
id='aaR72Xf_4wc',
part="id,snippet,contentDetails,status",
fields="items(id,snippet(title),contentDetails,status)",
).execute()
This video is not embeddable on my webpage and in the response there is nothing to suggest that this video is not embeddable.
I request both contentDetails and status. I am not requesting via mobile device
Please provide pointers.
A small subset of videos have domain-level whitelists or blacklists applied to them by their content owners. Those restrictions are not reflected in API responses.
This is what you're seeing with aaR72Xf_4wc and the relevant portion of the blog post about playback restrictions is
There are even more subtle restrictions that occasionally come into
play. Not all of these are currently queryable via the API. For
instance, some videos are only playable on a certain set of domains.
I assume it wasn't there 2.5 years ago, but the current API does have indication for regional block, when requesting contentDetails. here's a response for such request for 2 videos, the first one is blocked and the second one is not. Note the regionRestriction key:
{u'etag': u'"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/ZqEbAZJ-JFnYX3v37ZRuhK8FFN8"',
u'items': [{u'contentDetails': {u'caption': u'false',
u'definition': u'sd',
u'dimension': u'2d',
u'duration': u'PT2M5S',
u'licensedContent': False,
u'regionRestriction': {u'blocked': [u'NU',
u'BY',
u'NP',
u'NR',
u'WS',
u'TD',
u'SY',
u'NZ',
u'NE',
.
.
.
u'TG']}},
u'etag': u'"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/hM4srkgNUiZj2GtAhLDFoFrHnlk"',
u'id': u'WGf4mSBoCzQ',
u'kind': u'youtube#video'},
{u'contentDetails': {u'caption': u'false',
u'definition': u'sd',
u'dimension': u'2d',
u'duration': u'PT17M2S',
u'licensedContent': False},
u'etag': u'"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/JNjXh3lMwcaC9gtbzM-KmOQLh44"',
u'id': u'Tw75Dt8fBBs',
u'kind': u'youtube#video'}],
u'kind': u'youtube#videoListResponse',
u'pageInfo': {u'resultsPerPage': 2, u'totalResults': 2}}
You can also filter by syndication if you are accessing from a mobile device. Last but not the least there are region specific blockages.
Maybe you need to also include the filter for videoSyndicated. I don't know for sure though; it's a little confusing to me.
Does anyone know why the picture attribute is not working in following Facebook UI call?
function postToWallUsingFBUi()
{
var data=
{
method: 'stream.publish',
message: "Posted using FB.ui and picture.",
display: 'iframe',
caption: "Caption",
name: "Name",
//ver 1 picture: 'http://www.somedomain.com/albums/s339/rockaja/fb-520.png',
//ver 2 picture: '#Url.Action("Action", "Controller", new { PageId = Model.PageTabId }, Request.Url.Scheme)',
picture: 'https://localhost/MyVirtualDirectory/Controller/Action/283659015078395',
link: "http://www.mydomain.com/", // Go here if user click the picture
description: "Description field",
actions: [{ name: 'action_links text!', link: 'http://www.mydomain.com' }]
}
FB.ui(data, onPostToWallCompleted);
}
As you can see the picture attribute uses a picture from localhost. If i paste this URL into the browsers's Address field, i get the picture as expected.
I also commented out other two versions:
version 1 is working properly as expected, but
version 2 is not working (this is an ASP.NET MVC call, but that fact does not affect the result).
May be it is due to the fact that i request a localhost-ed picture?!
I have never worked on FB API so take my suggestion with a pinch of salt.
Based on my understanding of how Facebook works, whatever pictures you share on user's wall go into FB's data store first and are always pulled from that store.
Here, The Facebook API may be downloading the picture from the URL you have provided and push it into it's own store before publishing it on user's walls. When you use a localhost url, then the call to download the picture would obviously fail.
There must be another version of the API where you should be able to send the picture content as byte array. If there is, then you can load the picture from disk yourself and send the byte array in the API