FB.ui request dialogs: preselecting some friends - facebook

FB.ui Request dialogs: (With method: 'apprequests') allow you to send a request from your app.
http://developers.facebook.com/docs/reference/dialogs/requests/
This says, you can specify one friend in the two value. However I want to specify N friends which are preselected, but can be edited. Is it possible in this widget. If not, What alternate widgets can I use

This isn't possible via that Facebook javascript sdk, most likely to be less spammy and not default to sending to every single person a user is friends with. The way to get around this would be to build your own dialog using the graph api. You would retrieve all the users that a person is friends with, present them with your own dialog to let them choose users, and then send graph api requests over for each request.
Update:
Per Facebook's blog post, you can only send invitations to users through their Requests dialog. And this dialog will not let you pre-populate all users as checked. Graph api can only send to other users that have authenticated with the app.

Related

Can I transform a user-id to PSID? - Facebook API Graph

Context: I'm building a webhook with NodeJS to get events from Facebook Page with my Facebook App. These events are: feed, mention (when a user tags the page on his wall) and message. I can get all events without problem. In all events I need to identify the user who write. When the users write a post or message in the page I get an ID (PSID) but when the user write a post on his wall tagging the page I can't get PSID, this is obvious because he isn't in the page scope. The only I get from this event is user-id from post-id.
I have tried the following:
I used this endpoint GET: /<user-id>/ids_for_pages as indicated in the documentation. This doesn't work for me because I would need that the pages are in my business administrator and this isn't possible because I need this webhook to manage many pages to many companies.
I used this endpoint GET: /<psid>?fields=name,id for events of type feed and messages (from Messenger) into the page but this gives me only PSID again.
Note: In my DB I save long-lived token of my page, ASID of the site owner and Page ID when my user does the login in the UI.
My questions:
Is possible transform user-id to PSID?
Can I get user-id through the PSID?
If you have a better idea to unify IDs when is the same user, I would like to know it. If this isn't possible I would also like know it.
My Goal: Each user event goes to the same case for the same user in my API, for this reason if the user is the same when tags the page and/or write a message in the page the idea is to identify him like same user and not like new case.

How to send any actions to my API by facebook-messenger API if the person isn't available?

When a user blocks my facebook bot account I can't handle any query about this action, but I need this information on my API. I try to write to an unavailable person from Facebook Page, but I just get an error "this person isn't available right now" in front and without query to my API
How I can handle, find and check unavailables users?
I thought to handle actions from chat on application's Facebook page (Mark as Done, Delete chat, etc), but I don't know how I can to get this on my API.
Facebook actions
There is no specific event for such an action (user blocking the conversation), so your only option is to handle the person-not-avail error response and mark those users on your end.

Facebook Graph API to send message to friend

I had read the API reference, but still not sure if it's possible to send message to a friend? Suppose I had get access_token from user.
I want to use the API to display user's friends list in my Web UI, and the user can choose a friend and start to chat with the one.

Appcelerator Titanium facebook send specific content

I am trying to send some specific content from my Application to the user's status wall.
Lets assume that the user already logged in to facebook through my app - And lets say that my app displays a lot of jokes and riddles. A user finds a joke and he/she wants to publish the joke to his/hers facebook profile (Or even send it through SMS too? (Just a side question, not important))!
How is this possible?
Thanks!
Construct a JSON object with the appropriate Graph API fields corresponding to your joke, and send it to the Graph API using an XHR requestWithGraphPath. For text messages, you might take a look at Twilio.

How can i send app request to both FB friends and application users?

I've a situation in my application where I need to send apprequests (or any way of sending any request to my users) for both my facebook friends as well as the same application users.
The problem with this is ,
when we are sending apprequests using application itself(using app_access_token) we can't send app requests to my facebook friends who are not yet part of my application ("oAuthException : User must accept TOS" will be thrown).
So when i use the 'Request dialog' (FB.UI app request method) its possible to list/send requests to only FB friends .
So i need a solution for having a method where i can list all my user's FB friends and application users and send apprequest at once to all..
Anybody has tried something like this before?
And also i tried FB.UI (send method) and searched for graph API and also considered option of posting wall message and everything doesn't work both types..
Any help on this?
May I draw your attention to the following Facebook Documentation for AppRequests:
http://developers.facebook.com/docs/reference/dialogs/requests/
You need to have a look at the section headered "Frictionless requests".
From what I understand from this sentence:
Upon first sending a request to a friend from within an app, a user may authorize the app to send subsequent requests to the same friend without prompting for his permission.
It sounds like there is no way to "bulk" send to all of a user's friends, it is on a friend-by-friend basis. It sounds sensible to me, I wouldn't want my all of my Facebook friends to be flooded with invitations either.
You could however opt for prompting the user with the Friend Request interface which is much friendlier to your users... this is available using the Javascript SDK.