How to kick off Facebook Messenger conversation with user - facebook-graph-api

I've seen this use case a few times.
A user goes to a company's web site and places an order with the company.
User logs into Facebook.
Messenger window shows up that says order confirmation # and now there's a chat between you and the business.
I'm trying to figure out how this is done.
Of course, if the user has given the app permissions or there was some Facebook integration on check out, then presumably the company has captured the user id and can send messages.
Is there any possible way that a company can send a message to a user by simply knowing their e-mail address? I think FB ids are scoped to Apps so even if you knew the user's FB Id, the ID on your app would be different. Any ideas?

I did it with ruby on rails.Let me give my articles about messenger bot.
This link show from scratch. and it uses this gem to make it happen. These are so useful articles. if you have additional questions, please let me know.

Related

How to set privacy policy url for a fb app when working on localhost?

I am working on a local application that needs to retrieve data from user's Facebook profile. As long as I can see, by default I can only get name, picture and age range, but I need many others information like education, location, likes and so on. I tried to submit approval for these items, but Facebook won't set my submission because I don't have a Privacy Policy URL added. I don't know what Privacy Policy URL to add because I'm working on localhost.
Please help me figure it out and excuse me if my question is wrong, it's the first time when I work with fb api. Also, if there is another way to retrieve this items, I would be more than happy to hear about it.
Have a look at
https://developers.facebook.com/docs/apps/review/login#do-you-need-review
It's saying that
in order to help you craft your Facebook Login experience, your app's developers will be able to see, and grant, any permission without requiring review by Facebook.
and
Also, if you're the developer of an app and are the only person using it, then your app doesn't need to go through review. Since you're the developer, all app capabilities should be available. You will still need to take your app out of developer mode, but you should be able to do that without going through review.
So, to be able to develop your app and request extended permissions, you don't need to pass your app to review, as long as you test with an app admin/developer/tester.

How to post to a users wall as the App

I have build a Facebook-app that needs to post to the users wall in certain situations. I've come a long way in doing this: it works perfectly, even when the user is not logged in. However, I need to post to the user's wall on behalf of the app, not the user himself. The reason is that posting as the user will not trigger a notification.
Does anybody know how to do this?
This is not possible; apps cannot post to the profiles of users - if you want someone to come back to your app, you could use a Request which will increment the counter on the user's bookmark for your app, but it's not possible to post to a user's profile 'from' a page or application

email id of user from new facebook API

I have worked earlier on facebook API. I successfully used it and fetched all friend lists with their email ids. I was also able to get user email id who logged in through facebook API.
Now in gap of 7-8 months I found that faceAPI development section has been changed . New one is something different.
And now I am facing problem to get email id after user login at facebook.Yet all other details are coming like user name .user id and location except email id.
Old script is also not working with me. Could you help me to get email id of user who get login by facebook at my website.
Thanks for your cooperation.
No one will do your homework (upgrade the code for you)
Read the most current documentation
Accessing users e-mails require a special permission email
Users may choose not sharing their direct e-mail with you
You didn't say what technology you are using, but you can check the PHP-SDK example page to get started.
Direct Access Method:
Log into Facebook under your name. If you need an "Access Token", Click on the Extended Permissions and click the "read_friendlist" check box to get your Access Token and then
submit your query. You may need to "Allow" access, so just follow the prompts given.
Voila! You now have the usernames for everyone on your Friends List. The "username" parameter in the query will give you the contact email "message to that person" and you append #facebook.com and send them a message. Very simple.
http://developers.facebook.com/tools/explorer?fql=SELECT%20username%20FROM%20user%20WHERE%20uid%20IN%20%28SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me%28%29%29%20ORDER%20BY%20name
I had been using the import function in Yahoo Mail but now it has been limited to the first 50 names on your friends list. Where I work, they have over 6,000 friends between the two pages. This is a very simple solution to my problem. And now I can write a very small PHP sendmail program and send EVERYONE on the friends list an email message that goes directly to their messages. No more viewing page sources or manually doing this.
I can create a special email list on IFanz that will handle all dups, even if I repeat this process on a monthly basis to acquire new emails.
-SAB

How can I allow my users, who create pages on my website, to communicate back to those people who click the Facebook "Like" button on their pages?

OK, apologies for the verbose title. Let me give the background in a bit more detail.
My website allows my registered users to create new pages, each of which has its own unique URL. Each page has a Facebook "Like" button on it. I've already implemented Facebook Open Graph API meta tags so that the pages are proper open graph objects, and when some other visiting Facebook user "likes" the registered user's page, a post appears on that Facebook user's wall saying they have liked the page. The Facebook Like widget also displays the number of "likes" that page has received as normal. So far, so good.
What I want to do is allow my registered users to be able to communicate back to the Facebook users who have liked their page. The community of "likers" for a page is a potentially valuable social media resource to the registered user, if only they could communicate back.
I am aware of the "admin page" link you get beside the Like button, which can be used to post to these people, but that is not an option for my registered users as they have no privileges in relation to the Like button.
What I want to do, if possible, is setup a form to capture the registered user's message back to the Facebook users, and then my website sends the message on their behalf, without having to ask for any extra privileges from the Facebook users.
The following Facebook documentation pages seem to say this is possible, but having followed the Open Graph API documentation, I can't get it to work as described - http://developers.facebook.com/blog/post/465/ and http://developers.facebook.com/docs/reference/api/ ("Publishing" subsection). I can get the access token correctly in the first request, and plug that into the second request to do the post, but that doesn't seem to do anything and doesn't return any error.
Since it doesn't work for me, I'm wondering if this is possible as described, or do I need to get some sort of extra permission to do this? I've seen reference to offline_access permission but as I'm new to this stuff I am not sure how it would fit in. If I have to get the Facebook users to grant permissions, this is not going to work as envisaged.
Any thoughts would be most helpful.
The short answer: No, You will never been able to post on someones wall as another user.
The long answer:
You could try to ask for offline access but then you are asking the user to hand over all their facebook data and give you access todo whatever you like their accound, so that is not likely to happend.
The next problem is that they have to be friends to be able to post on each others walls.
Thats why Pages was implemented, so that organisations could announce/talk with the people interested.
However if you have created the like button correctly and give the pages correct meta data, you are able to post to user who have liked it.
Scroll down to Publishing:
http://developers.facebook.com/docs/opengraph/
Just add a form for your user and let your system publish to the correct page, you probably will need a offline token from your own account or similar to use on the server.
Another more complex way could be to generate a facebook page for each page you have on your server.
When the user creates a page on your system a page is created on facebook but as your app as admin.
And when another user likes the page they like the facebook page, hence you have the possibility to post in that page and speak to the user who liked it. (whooa thats a mouthfull).

Facebook integration... Where to start?

I recently put a django project of mine into its beta stages and would really like to integrate more with social media, particularly facebook.
Now there are so many facebook integrations out there... I don't know where to start but, I'll tell you what I am after.
My sites publishes content with photos and also user related data (which site doesn't)
on each individual page I already have a facebook like button that basically has the absolute url of that page
so for instance:
http://my-site.com/url-1
http://my-site.com/url-345345
http://my-site.com/url-456456456
When a user likes this particular url I would like them to become a Fan on my facebook site/page as well.
I also added the FB opengraph tool which is a bit more informative once a user likes it. But it still does not publish any statistics to my page.
Can someone give me a bit of an understanding on what the best option is for this type of integration?
As a security option for the user, Facebook has never allowed third party access to "become a fan."
If you want to record locally when someone presses the "Like" button, you'll have to implement it locally (copy the presentation, and query Facebook yourself), so you can intercept the event. I've done that; it's not too hard.
I suggest you review the Connect Terms of Service to see what it is you're allowed to do: http://developers.facebook.com/policy/