URL to room icon in Google Chat (hangouts) - hangouts-chat

Is there any way to find an URL for room icon (or emoji choosed in room settings) from API? Our bot wants to show room list in other apps and it would be great to have also icons/emojis for them.
Regards,
Piotr

As far as I know, not possible!
Looks like someone has filed a feature request for this same issue and it has been acknowledged by Google. I would suggest going and starring that issue to let Google Developers know that this affects you.
As can be seen from the spaces object referenced in the docs here:
{
"name": string,
"type": enum (Type),
"singleUserBotDm": boolean,
"threaded": boolean,
"displayName": string
}
That's it! It's a very light-weight API! There is no "imageURL" key to call from. A URL does exist (maybe someone else can find a workaround), but its not exposed by the API.
Ideas for workarounds
Get the bot to ask for the icon from the users ¯\_(ツ)_/¯ - you don't have to say "we can't get it from the API", you could say "how would you like it to appear in other apps"?
Create your own default icon in the same way Google does by using the first letter of the "space". So if the space is called "StackOverflow" the icon would be a large "S" on a randomly colored background.

Related

Creating a Playlist for an Apple Music User

I've created an app in React Native which allows a user to search for songs, which uses the Apple Music API. So far, so good.
For the next step. What I want to do is use the songs the user has searched for, and let them save them as a playlist in their Apple Music account (assuming they are a subscriber, etc.).
However, there seems to be a lack of documentation and examples on how to do this (at least compared to Spotify - I'm recreating a Spotify App I made in the past).
I'll need to get authorisation from the user, and then use this endpoint: https://developer.apple.com/documentation/applemusicapi/create_a_new_library_playlist, but I can't find out how exactly to do this. Other parts of the API documentation seem to simply state "With proper authorization from the user, you can also create or modify playlists and apply ratings to the user's content." but never actually explain or link to how to get this authorization.
Can anyone point me in the right direction? And let me know if what I'm trying to do is actually possible with Apple Music - it seems like it is, but the way I'm going around in circles, I'm not so sure anymore. Thank you
I don't know if this will help or not (I'm an iOS dev, not a React dev), but here's the call to save a playlist to a user's Music library, in Swift. Maybe it'll help point you in the right direction(?)
If you'd rather not have Swift code polluting your thread, let me know and I'll remove it.
import StoreKit
// ...
// request user token
if let devToken = UserDefaults.standard.string(forKey: "devToken") {
SKCloudServiceController().requestUserToken(forDeveloperToken: devToken, completionHandler: { userToken, _ in
guard let _ = userToken else { return }
self.addPlaylist()
})
}
// add playlist
func addPlaylist() {
MPMediaLibrary.default().addItem(withProductID: "pl.u-065LACYzL34", completionHandler: { _, error in
guard error == nil else {
print("add playlist sad")
return
}
// success
})
}
I've been looking at trying to do this for a while now.
MusicKit JS works in the browser, but since there is no browser in iOS, that's a no-go: there is no Window.musicKit.getInstance(). And I've yet to find any other way to authorize MusicKit, using JavaScript, except for MusicKit JS.
You can access the Apple music Catalog via the API with only a developer token. You can even access (read only) a user's playlist, if it's public and you know the global id, but that's not what we're after here. We want access to a user's Library so that we can do stuff (except delete, because you can't delete stuff through the Apple Music API).
To authorize access to a user's Library in iOS, you need to use StoreKit, per this, and in order to do that with React Native, you need to use Native Modules per this.
The problem about that second bit, is that I got no idea how to do this. I've read a few things, but I'm not connecting the dot's yet.
If you (or anyone) has figured this out, dropping a note with a how-to here would be awesome. If I do figure it out, I'll come back here and post.
Update: I found this article, which comes close to explaining it really well.
The issues I'm having here are that in the Add a React Native iOS Project section, there's an unfinished sentence ("Here we create..."), and I can't seem to find React.xcodeproj when I run through the steps the author has provided.
Additional remarks: you can run Javascript on a Page in Shortcuts but only when you run shortcuts from sharesheet from Safari.
Also, contrary to what you may seen in many tutorials keep in mind that for POST requests a header Music-User-Token has a value without word "Bearer". In GET request using "Bearer" word will also work. I've built webpage to get music-user-token to clipboard and save it to use it in Shortcuts.

How can my app appear in mobile safari URL bar as a app store suggestion (like slack)?

What technical requirements or methods do I need to implement to make my app appear in the URL browser under "app Store" suggestions in safari? This is what happens if I am typing in "slack" straight into the url bar of safari. It also appears if I haven't installed slack at all --> that's what I would like to implement as well.
Is that a auto suggestion-tool by safari which we can not influence at all?
Any hints to make that happen? Here's an image of Slack on Safari:
Thanks a lot!
These suggestions are known as Safari or Siri Suggestions, and appear to be controlled solely by Apple/Safari itself.
One source on Quora says,
“Siri Suggested Websites” are search results that come directly from Apple’s own search engine, based on websites they’ve crawled and indexed. It’s not based on your search history (or even anything you’ve done with Siri).
I wonder if your app would show up as a Suggestion if it was unique or popular enough in Apple's search indices...

Facebook messenger API bot : "Typing bubble" " indicator bubble"

I've created a messenger bot, and some action that I perform can take some time. So in order to make the user wait I would like to display the "Indicator Bubble" (the one you see when the people you talk with are typing):
Typing bubble
It is not defined in the Messenger API documentation how to do it, but it seems possible has they perform it when you hit "callBack" on their card.
How can I simulate this?
It's now available into the messenger bot API via the Sender Action. You can find the documentation here.
It's just a post with an on or off value to display / hide the bubble indicator.
{
"recipient":{
"id":"USER_ID"
},
"sender_action":"typing_on" // typing_off
}
The official messenger API does not support this feature for now. Even if #hiponcho – one of the featured by Facebook chatbot is actually using it.
A workaround would be to use the unofficial messenger API, which has a method called sendTypingIndicator that does exactly what you want. But be careful, you can be banned for using of non-official API.
api.sendTypingIndicator(threadID, [callback])
Yes, it is the only way.
When you have the Button Template and someone clicks on "button" for "postback" (documentation in section "button template").
Then during your parsing of the message and sending answer, it is shown like "writing".
I know it is a hack, but currently I send the "Typing Bubble Indicator" as a animated gif as my first reply, if I anticipate a waiting time (like an API call). At the user end, you can't tell the difference.

how do i acquire a google fonts api key

I have followed a several bewildering sets of instruction, but have so far not been able to acquire the google fonts api key. I have navigated to the Developers Console, selected a Project, then to - APIs & auth - APIs. There are dozens upon dozens of API's to choose from, but NOT ONE that is either 'Google Fonts API' or 'Web Fonts Developer API' or indeed anything that contains the words 'Font' & 'API.' Truly frustrating. Can anyone help?
Thanks
Google Fonts are available free without an API key, at the link below:
https://www.google.com/fonts
Simply select the fonts you need, and add it to collection. A little panel should show up at the bottom of your screen. On the upper-right corner of the panel, click on "Use", and about halfway down the page you'll find the code snippet for you to use. Again, no API key is needed.

Show a single thumbnail when posting on facebook

A little background info is that my team and I developed a website for a Real Estate Agency and I've been assigned the task of setting the image of the currently selected property into facebook's sharing feature.
The webpage for the property is dynamic as there are several listings, so what I've done is select the first image that is loaded on the page and set it to the og:image meta tag.
Now let's say I copy the URL and post it on Facebook, it'll show the correct thumbnail, HOWEVER, it'll also show multiple thumbnails from other listings.
All images on the website are over 200 x 200px and are within an aspect ratio of 3:1.
My question is, how do I tell Facebook to only take my initial image and not grab others while it's as it.
Is there perhaps a SelectSingleImage property that I can apply?
I've already spent more time searching for the answer to this issue than I would have liked, so thanks for any help provided, it's much appreciated.
One method I use sometimes is to recognize Facebook's server and simply provide it with different data. This way you can actually only have one image on the page (as far as Facebook knows).
I don't know anything about vb.net, but here is a simple code sample in PHP. All it does is perform a regular expression on the user agent of the request to match it against the string "facebook".
$isFacebook = false;
if(preg_match("/facebook/",strtolower($_SERVER["HTTP_USER_AGENT"]))) {
$isFacebook = true;
}
Facebook may very well change their user agent signature one day, but for now, I'm pretty sure you'll be safe but keep synced with the Developers Blog and the Roadmap.
It seems that Facebook saved those images in cache for some bizarre reason, but to resolve this issue all I had to do was enter the URL into Facebook's Linter tool which in turn cleared the cache on their server.