I'm writing an app that posts tweets to Twitter. I'd like to offer the option of including location in the tweet, which is available via POST statuses/update using the lat and long parameters.
Here's my problem: if a twitter account hasn't turned on location tweeting via https://twitter.com/settings/account "Add a location to my Tweets", then I can send the tweet with the location info, but the location info won't appear. This is a GOOD THING for the user's security, but an annoyance for me because:
If the user hasn't turned on this feature, I shouldn't be offering it in my UI. It's a bad user experience to let the user THINK he can include location information, but then not have the information appear because of some setting outside my control.
So here's my question: Is there a way, through the twitter api, to know if a user has turned on this setting in his twitter settings? I've looked through GET users/show, but can't find anything there that mentions what I'm trying to find out.
Well after some more digging, it turns out that there's a "geo_enabled" key that is included in responses from several twitter endpoints. It's accessible from GET account/settings, of course, but it also often appears in responses to GET users/lookup and probably several other endpoints that return user data.
If "geo_enabled" is true, then the user has agreed to let location data get posted in his tweets. If it's false or doesn't appear, then I'm going to assume that the user hash't turned on this feature.
Related
I've been going through Apple's (awful) documentation for both MusicKit, the API and MusicKit JS, but I haven't been able to find an endpoint or method to retrieve a user's display name, email or any other information that I can use to identify the user.
Is there even a way to retrieve this?
I've been having the same issues as well. As far as I can tell, there is no way to identify the user. I'm getting around this by just giving users temporary sessions that get destroyed when they clear their cookies or unauthorize from musickit.
On the other hand, you could ask the user to log in with some other auth provider like google, github etc, and then authorize their apple music after that. Its's not the best user experience to log in to two things in a row, but I guess we have to make do
Is there an alternative to allowing the permissions of some sort rather then 'read_stream' permission in Facebook, for a user to read or an app pull their Facebook feed or home feed?
It's very hard, if at all, for Facebook to approve the 'read_stream' permission, so I'm looking for an alternative steps to still allow for our users to pull their favorite stories in our rails app. Any suggestions?
There is no alternative. You can use user_status to get the status posts of the authorized user with /me/statuses.
Btw, it´s not only "hard" to get read_stream approved, it´s nearly impossible ;) - but for very good reasons. Apps should not get access to posts of users who did not even authorize the App.
edit: There is also user_posts now, as replacement for read_stream: https://developers.facebook.com/docs/apps/changelog#v2_3_new_features
Did some investigation. And it is possible.
Instead of the feed you need to access the endpoint /me/posts
This API is accessible with either read_stream or user_posts permission.
https://developers.facebook.com/docs/facebook-login/permissions/v2.3#reference-user_posts
See here for more information:
https://developers.facebook.com/docs/graph-api/reference/v2.3/user/feed
It is quite hidden, but if you know where to look you can find the docs.
I am having a scenario within our iPhone App where people post things on their Facebook wall through our App. User's signup to our App. At a certain action, they post something on their Facebook wall and we want to track if this post will still exist after a certain time.
Once they signup to our App, they will either select as "Public" or "Friends" when they download our App. Is it possible to track from our end whether a certain post still exist or not?
Is there anything on the Facebook account settings as a user to disallow this to check?
When you post a feed, a post-id in returned in response. You can make a call using Graph API: \GET /{post-id}. If the post still exists, it'll return you all the details of the post but if not it will return the error in the response.
But, according to the documentation of /user/feed,
A user access token with read_stream permission is required.
Now this will make the things a bit complicated. Since a user token is valid for only few hours, you have to extend it (validity: 60days) and save it at your end. Also, read_stream perms is required.
To know more about extending the token and refreshing it again, see the "Expiration and Extending Tokens" section here: Access Tokens.
Would like to change the default visibility of app and posts in Facebook from "Friends" to "Public" programmatically on iOS. Is there any example code for this? Thanks a lot in advance.
You can set defaultAudience Property .
Most applications use FBSessionDefaultAudienceNone here, only specifying an audience when using reauthorize to request publish permissions.
There are other option to set is,
FBSessionDefaultAudienceNone:
No audience needed; this value is useful for cases where data will only be read from Facebook.
FBSessionDefaultAudienceOnlyMe:
Indicates that only the user is able to see posts made by the application.
FBSessionDefaultAudienceFriends:
Indicates that the user's friends are able to see posts made by the application.
FBSessionDefaultAudienceEveryone:
Indicates that all Facebook users are able to see posts made by the application.
It appears from here and here that you can setup the privacy of the post at creation time, but you cannot edit it.
Also, per facebook's developer TOS and Privacy Policy, unless what you are doing [changing the default privacy of a post] is specifically authorized each time by the user, it'd be breaking terms of service and immediately get your app shut down. Facebook takes privacy very, very seriously.
I'm building a feature in my web service to let people enter their Facebook URL into a field. Because few people know their FB user names or public profile URLs, I'd like to provide an interface to assist.
In brief: is there a way to get a list of matching users's public URLs by providing a name alone?
I have tried examining the Facebook Open Graph API; this appears to require knowing the user ID of the person, or the user ID.
I have tried using Mechanize and Nokogiri to automate the process, logging into Facebook as myself and accessing the search feature (http://facebooks.com/search/results.php?q=Person%20Name), but it's not returning any data when attempted this way. I suspect Facebook is using some kind of joojoo to keep me out that way.
Anyone have any suggestions?
With a valid access token, you should be able to query https://graph.facebook.com/me/ to get their ID, name, and public URL (Here's an example using the Graph API Explorer).
There's a search endpoint in the graph API, unfortunately it requires valid user access token.
https://graph.facebook.com/search?q=<name>&type=user&access_token=<user access token>
However it could be yours even, by getting a long living access token it would work for 60 at most, but it's probably a bad idea.
The type could be user, post, event, group, page.
Having done additional research, it appears to not be possible to get a user's public profile page without their permission. Hooray for Facebook privacy settings, I guess.
However, getting an access token is easier than I imagined it would be. Facebook offers an example on their site for getting user permission to access their account, implemented entirely on the client side. Nice and easy; the access token is returned in the URL.
The only downside here is you have to create an application on Facebook, at http://developers.facebook.com/apps. For my purposes, the "Website with Facebook Login" was the application type.
From that point, you can use that token to interrogate the Graph API with ease, as both Warpling and complex857 have suggested.