I am developing a web site which uses facebook php sdk to login user and i want to send an invitation to join the site to a facebook friend he interacts with in my site. I know the fb user id he interacts so i want to send an invitations to him via facebook php sdk.
Any ideas or sample code? I don't want the user to select the user he invites i already know who is the user i should dend the request.
Thank you a lot!
For notifying the friend of the user to ask him to interact with your website you can utilize the apprequest.
Related
I have question about FB messenger bot, any help would be apriciated!
I have a web application where we have FB login which gives us information about user and FB ID.
FB messenger also gives us an ID, but it's different from FB ID and I cannot find any connection between those 2.
Do we have a way to identify FB user by Messenger ID?
Thanks!
Yes there's a way actually,
it's not official but I've been using it for a while now.
Just retrieve the profile picture of the user in both Messenger and FB app.
Facebook provides profile pictures as URLs, and it's the same whether it's retrieved from Messenger or app.
So what you have to do is to store these URLs, and whenever you want to match profiles with Messengers, just compare the profile pictures links, and you'll be able to link your users profiles to their Messenger.
FB messenger also gives us an ID, but it's different from FB ID
Yes, it is called a page-scoped id (meaning it will be different for every page your bot runs on.)
https://developers.facebook.com/docs/messenger-platform/implementation#send_api:
These ids are page-scoped. These ids differ from those returned from Facebook Login apps which are app-scoped. You must use ids retrieved from a Messenger integration for this page in order to function properly.
and I cannot find any connection between those 2.
That’s because you are not supposed to.
I'm trying the recent released Facebook Messenger Platform and so far so good. Everything worked well and I was able to create a echo bot.
But I'm wondering how I could identify this user that started chatting in my page. For example, when a user started chatting I get a PID user (page specific user id).
Making the follow request to Facebook Graph API:
GET https://graph.facebook.com/v2.6/{PAGE_SPECIFIC_USER_ID}
I discovered that I can just ask for the following fields: first_name,last_name and profile_pic.
So my question is, how could I discover if this user is a current customer of my business page? Is there another way of querying more information (like e-mail and real facebook user id)?
Facebook has updated the messenger platform API (2016-07-01) and introduced a new feature called Account Linking. This can be used to identify a user who has created an account on your website via Facebook Login and you can link the two accounts. Facebook login has its own set of permissions which can be used to get a lot more information via Facebook graph API. You can find the complete list here.
Currently, there's no way to do this. The best way would be to prompt the user to enter their information in chat or give them a link to a mobile login page or some other way of linking their account to the chat.
Messenger Platform 2.0 introduce "ID Matching API" ,that will solve the problem.
https://developers.facebook.com/docs/messenger-platform/connecting-accounts
you can retreive a user information like below using fbmq library https://github.com/conbus/fbmq
# this method will occur when a message received from user
#page.handle_message
def message_handler(event):
user_profile = page.get_user_profile(event.sender_id)
print(user_profile) #first_name, last_name, profile_pic, gender ...
i am creating an app for iphone in which a user can loging using facebook and when he click invite an event must be created in facebook and it should be sent to facebook friends. can anyone please help me?
kindly refer to the facebook developer documentation for references related to creating event :
https://developers.facebook.com/docs/reference/api/event/
You can user FBFriendPickerDelegate for selecting friends and then using their ids for inviting to event
Is it possible for a website to have facebook chat integrated into it, but only show the friends which are on the same site/page?
Yes
use facebook graph protocol to get friend of the user
and the user who in the page in already in your databse
and joining between the two by the uid
im sorry fvor my poor english
On sign-up (i.e. when accessing the app), we need to get user's permission to invite their friends to use the app. When a user has finished using the app and the picture displays on their wall, we need to share the post with all of their friends automatically
Can this be done in FB application running from iframe? What would be the easiest approach to do this.
You can't automatically send out invites. You can present the user with a form to pick friends to invite, but your app can't do it on their behalf.