Stream.publish won't translate {*actor*} using Facebook Connect for iPhone - iphone

I am able to successfully publish a stream to my account using Stream.publish via Facebook Connect for iPhone. However, the {*actor*} token does not appear to get translated. I though this was a token that Facebook automatically translates to the user. Is this not the case? Here is my attachment JSON array.
attachment = "{"name":"Join {*actor*} PocketBracket Pool - The Pool Name
pool","href":"http://www.pocketbracket.com/pools/1741",
"media":[{"type":"image",
"src":"http://www.pocketbracket.com/library/images/icon_facebook_post.png","href":"http://www.pocketbracket.com"}],"description":"Get
ready for the 2010 Men's College Basketball Tournament! Fill out your own
bracket and challenge your friends with PocketBracket."}";
Otherwise, I am only setting message and action_links. Do I need to set uid? Again everything shows up correctly, but {*actor*} is still literally within my stream.
Thanks,
Jason

RTFM, Looks like actor can only go in the caption:
caption: A subtitle for the post that should describe why the user posted the item or the action the user took. This field can contain plain text only, as well as the {actor} token, which gets replaced by a link to the profile of the session user. The caption should fit on one line in a user's stream; make sure you account for the width of any thumbnail.
Please let me know if this is not correct.

You can use the tag {actor} only in caption, tested :)

Related

How to set AppClip invocation for URL with QueryParam?

I am trying to set the AppClip invocation for my App which is already released on app store.
I need an url such that it provides me a jobId e.g.: https://example.com/task?jobId=00001.
My use case is that I send the sms with the url https://example.com/task?jobId=00001 to the user, the user clicks on the url and the app gets started. Then for the other user I send the next url with corresponding jobId.
I did setup the AASA file for my domain (contains the JSON with "applinks" and "appclip" objects) which is valid, also the Domain status is valid on App Store Connect. There is a default experience set with title, subtitle, image and action. I also configured an advance experience for the url https://example.com/task.
However, my app clip doesn't get invoked if I access the url from either sms text or safari. :(
I do not have a web page for https://example.com/task therefore I haven't set up the meta data for this.
Is it possible to invoke the AppClip this way? It is really important for me that the URL is dynamic and I pass that jobId every time for each individual booking.
There s no much documentation and I already read at least twice Apple documentation about AppClip.
Because of this:
I do not have a web page for https://example.com/task therefore I haven't set up the meta data for this.
The answer to this:
Is it possible to invoke the AppClip this way?
Is no. Sorry, you need to own the domain you're working with, or at the very least have means to access its CNAME config (thus, be able to induce the owner of that domain to change the CNAME configs to what you want it to be, similar to what branch.io and AppsFlyer does with its users/clients).

Get user that made the comment in facebooks instagram graph api

Im building an application that manages comments for instagram business profiles, and i'm a little surprised that there doesn't seem to be a way to get info of the user who made the comment.
The docs seem to point this way too:
Reading a Comment
To read an individual comment's metadata, send a GET request to the /{instagram_comment_id} node and include any of the following fields:
...
user (only returned if the user making the query also made the comment)
So, am i to understand that there is no way to get the info of a user which made a comment on a media of the profile i manage or is there something i am missing? any help would be appreciated.
Thanks in advance
This url worked for me:
v3.0/{comment_id}?fields=id,timestamp,username,text
somehow I was able to get the username from graph API, but I'm not getting the fields name, profile_picture_url, etc. this is my URL for getting the username.
GET https://graph.facebook.com/v2.11
/123?fields=mentioned_comment.comment_id(456){user{id, username}, text}
123 - instagram_business_account id
456 - comment id
You can get full user details from username by Calling Instagram API(Maybe it's against there privacy policy). suppose stackoverflow is the username, by calling this API you will get full data.
https://www.instagram.com/stackoverflow/?__a=1

Get username field in Facebook Graph API 2.0

The "old" Facebook Graph API had a "username" field which could be used to create a human-readable profile URL. My username for example is "sebastian.trug" which results in a Facebook profile URL http://www.facebook.com/sebastian.trug.
With Graph API 2.0 Facebook has removed the "username" field from the user data as retrieved from "/me".
Is there any way to get this data via the 2.0 API or is the "username" now being treated as a deprecated field?
Facebook got rid of the username because the username is one way of sending emails via Facebook.
For example, given the url http://www.facebook.com/sebastian.trug
the corresponding Facebook email would be sebastian.trug#facebook.com
which, if emailed, would be received to messages directly (if the message setting is set to public), otherwise to the other inbox.
The username field of the User object has been removed, and does not exist in Graph API v2.0. In v2.0 of the API is there is no way to get the FB username of a user.
Source: https://developers.facebook.com/docs/apps/changelog#v2_0_graph_api
"/me/username is no longer available."
#Simon Cross - It being deprecated is documented, yes. That is not the question, the question is how to get it and -furthermore- I wonder why Facebook has made such a terrible choice and removed the username. Hundreds of applications that rely on the username to create accounts on their service will be broken.
#user3596238 - You can stick with the V.1 API which will be around until the end of April 2015, by far not the best solution but Facebook might be irrelevant by then anyway.
https://developers.facebook.com/docs/apps/changelog
Solution: ask the user for a username besides the actual Facebook login? - In my opinion, that makes the Facebook login completely pointless anyway.
While the 2.0 SDK will not provide the username field any longer, it is quite easily scraped if you have the user id number (which you will likely be using to access the graph anyway).
The url facebook.com/<user id> will redirect to facebook.com/<username>, which can then be extracted however you like.
my approach is scrapping the username using nokogiri through the user profile.
kinda like this (in ruby):
html = RestClient.get("http://facebook.com/123123xxx)
doc = Nokogiri::HTML(html)
username = doc.css('head meta')[1].attributes["content"].value
One of the ways could be to access facebook.com/{userid} using cURL and then follow the redirect.
The page rediects to facebook.com/{username}
Inspired from #RifkiFauzi 's answer, here is my solution in pure Python
#get html of a page via pure python ref. https://stackoverflow.com/a/23565355/248616
import requests
r = requests.get('http://fb.com/%s' % FB_USER_ID) #open profile page of the facebook user
r.raise_for_status()
html = r.content
#search string with regex ref. https://stackoverflow.com/a/4667014/248616
import re
# m = re.search('meta http-equiv="refresh" content="0; URL=/([^?]+)\?', html)
m = re.search('a class="profileLink" href="([^"]+)"', html)
href = m.group(1) #will be https://www.facebook.com/$FB_USER_NAME on 201705.24
username = href.split('/')[-1]
print(href)
print(username)
https://graph.facebook.com/?id=100005908663675
Simply change id to whatever.

How to get name of Facebook user that left comment using FB.Event.subscribe

I'm trying to figure out how to get the name of the Facebook user that left a comment in the Comment Social plugin using FB.Event.subscribe and the comment.create event.
I only see 2 properties on the response object:
response.href: URL of the page that the comment was left on
response.commentID: ID of the comment thread
Is it possible to implement client side code to get the name of the facebook user that left the comment? I'm trying to save an extra roundtrip for my server to make a call the graph API to get all the comments then try to figure out who the user was that left the most recent one. I thought that there might be a way to run an FQL query, but I'm at a loss here.
I figured this would be an obvious thing for the facebook event to expose, but their documentation is so poor I haven't been able to see anything.
Update: I've tried using FB.api as suggested by another user and using /me but I can't use that since hte user leaving the comment hasn't granted me any permissions. This was confusing because they logged in to post the comment in the comment box AND the user's name is public info if you go to the user's facebook page. So I need a way to query the commenting user's name without using /me in FB.api.
This method definitely works to get a name.. but there is a race condition issue if it is a thread that is getting a ton of comments, as the request to get the comments might not get sent before another comment is made:
FB.Event.subscribe('comment.create', function(comment) {
FB.api('comments', {'ids': comment.href}, function(res) {
var data = res[comment.href].data;
console.log(data.pop().from.name);
});
});
This works without the user authenticating your app as well.
After reading TMC's comment below I realized that it is not possible without permissions. If you want to this then you will have to ask every commenter to grant you basic permissions.
ORIGINAL ANSWER
You can use Facebook Javascript SDK function FB.api which works the same way as PHP SDK's api function but returns a JSON string. Have a look at this page for documentation. You might also like to have a look at Comment Object Documentation.
Comment has a property from which gives the id and name of the user.

Tagging a user in a wall post/update using Facebook API

I'm using stream.publish to write to the user's wall and attempted to get "# tagging" to work but with no avail.
If the user's name is Fred and his uid is 1234, I tried sending over "#Fred", "#1234", "#[1234]", "#[Fred]", etc. and couldn't get it to work. The raw string would display every time.
Can someone confirm if this is possible with the API or not? Thanks!
the correct syntax is
#[user_id:1:name]
it shows as a tag, but it doesn't trigger a notification. Anyone knows why?
Maybe you need follow this: NOTE: You cannot specify this field without also specifying a place.
You need to specify a place with the fan page ID of the location associated with the post.
moreā€¦ https://developers.facebook.com/docs/reference/api/user/#posts
reese:
#[user_id:1:name] - It will replace it with the 'name' which you have given
#[user_id:0] - This will notify the user BUT it will happen when you MANUALLY typing it in wall or comment section NOT through graph api, say for eg., if you want to notify this user #[user_id:0] so you are appending this text in message parameter of https://graph.facebook.com/feed api it won't work, I hope you understand :)