How to automatically post to Facebook - facebook

Please could you help. I have created a website that allows people to upload listings of items they are selling. I want to know how to add the feature where when someone creates a listing, it automatically posts on the user's FB page, with a link to the listing on our website. Is this possible? Would the user have to log into our website using their FB account for this to happen? Thanks everyone for your help.
Martin

You need to create a Facebook App and use Facebook Graph API with publish_actions permissions to do that. Note that the facebook rules prohibit sending fully automated messages that the user has no control, your user must have the ability to edit the message before sending

Related

Share Facebook profile after Login - user_link

We have a platform where users get logged in with Facebook. Now on customers demand, we want to provide a feature where we will request logged in users profile link at the time of login via user_link permission and user can share that link to anyone with just one tap. And on the other end, the other user who will receive this link will able to see (on facebook app or on Web) the sender's profile and if interested they can get connected.
But the issue is, I am not able to see user profile got as user_link. Its seems like I can only use this link if he or she is already my friend. If so then how can I implement this feature in my app? also if I am wrong at any point please correct me.
Its seems like I can only use this link if he or she is already my friend.
That’s exactly what the documentation says, https://developers.facebook.com/docs/graph-api/reference/user:
link: A link to the person's Timeline. The link will only resolve if the person clicking the link is logged into Facebook and is a friend of the person whose profile is being viewed.
-
If so then how can I implement this feature in my app?
You can’t; Facebook has deliberately designed this feature with this restriction, to better protect people’s privacy.

Facebook Messenger Platform: how to get user specific information?

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 ...

How Do I Share to Facebook With Custom Text

I have a task to add links to a web page to enable the user to post a short message to Facebook. There may be multiple messages on the page, each with its own link. The intent is to launch a Facebook share dialog pre-populated with the text of the message which the user can then modify, accept and/or reject.
I'm pretty new to programming anything for Facebook. I'm fairly confused and am not sure what to ask first, so I'll go with a very basic question: what's the simplest way to do this? I gather from Facebook's documentation that I probably have to use the Javascript SDK and/or the Open Graph technology. Is this correct, or is there another option I'm missing? Is there a really clear example of this kind of solution anywhere?
Thanks!
You have to create a facebook app first so you have your app_id and app_secret.
After that you need to request permissions to the user to publish_actions. If the user accepts, you'll receive a token (you need to store it in db). If you need to publish actions in a user page instead of his own page, you also need the manage_pages permission.
You need to read the facebook graph api documentation to understand how all this works.
The access token you receive expires after certain time. So, when you receive it, you can ask for a long lived token. The page tokens doesn't expire.
Facebook evaluates your app before approving it to be in production. They ask a couple of questions about how you'll use the user's token and data. You might have to put pictures of the flow too.
As far as I know, Facebook won't allow you to send pre populated messages to the user's wall. They user has to write it.
Hope it helped a bit!

Can this be done with the Facebook API?

I am thinking of starting a website that allows users to download files in exchange for them sharing the download page on Facebook.
So the general idea is the user logs into the website with their Facebook account and grants the App permissions to post for them. Whenever they download a file, it is posted to their wall.
I know forcing a user to share is against Facebook TOS but forcing a user to like isn't. I don't know the rules when it comes to Facebook Apps.
Any advice or information on this topic would be greatly appreciated!

Check whether user of non-facebook app likes/shares particular URL on FB

I'd like to know if there is a possibility to check (using Graph API or any other way) whether given user likes / shares a specific link. Probably I'll have this user's facebook ID or facebook login, but my site is non-Facebook application. Actually it's Dot Net Nuke portal (target: .NET with MS SQL Server) with part of it being avaliable as Facebook app, but certainly not greater part of it, so the solution should be out of Facebook Connect, although it's not a showstopper if it's necessary.
We'll be giving points to users who share/like most of links that we serve in our portal and such possibility would be a great help to make a ranking.
Another option we consider is making some kind of "wrapper" or proxy for FB like / share buttons which will at first save some data in our database (probably - this user clicked on like for this link) and then go on with standard FB like / share route. Did anybody of You tried such solution?
If You have any other suggestion on the subject, please, post them, we'll be really thankful.
It is possible to know if a user has LIKED a site or not. You can get all user's likes with Graph API (you need user_likes permission). Take a look at the docs: http://developers.facebook.com/docs/reference/api/user/
I'm not sure if you can know if he has shared your site, but you could try by parsing his wall with the read_stream permission and then look for your site name/URL post by post.
For just general liking of items on your site, you can use a Facebook Social Plugin. However, you won't be able to associate (or really even access) user activity with users on your site without integrating Facebook Connect and creating a Facebook application for your site. At that point you can design with greater control all the possible user activity and interleave with your facebook calls other calls that affect users' accounts on your site.