Facebook API post in event - external website - facebook

So, I've created a wedding event on my FB account. Now on my website (static) I would like to have a form (maybe embedded or something from FB) that a visitor could leave a message on it for greetings. That message would instantly post on the event I have created.
I hope you understand what I would like to achieve.
Is it now possible to do that? Or Is there an API for this? comment mirroring seems not applicable for events.
If it's not possible to achieve, is there an alternative that is easy to integrate on my site and of course the message will post on FB.

There are tons of APIs for Facebook, all listed on the Facebook developers documentation page: https://developers.facebook.com/docs/
But I think what you're looking for is something like this:
https://developers.facebook.com/docs/javascript/examples
Trigger a Share dialog
The Share Dialog allows someone using a page to post a link to their timeline, or create an Open Graph story. Dialogs displayed using the JavaScript SDK are automatically formatted for the context in which they are loaded - mobile web, or desktop web.
Let's make an API call to publish a message. Add the code into the response function of the FB.login call you added above:
FB.login(function(){
// Note: The call will only work if you accept the permission request
FB.api('/me/feed', 'post', {message: 'Hello, world!'});
}, {scope: 'publish_actions'});
Try the script. A status message will be posted to your timeline: Hello, world!

Related

How to send multiple link to facebook debugger

I have a website with some dynamic urls (for example a page who show event details thanks to event id in get variable), but during the share with facebook, at the first attempt the thumbnail image doesn't appear due the page isn't already fetched by facebook.
Then I must go to the debugger https://developers.facebook.com/tools/debug/og/object/ and submit every pages to get a valid thumbnail to the users.
There's a script or a way to send multiple links to this debugger, or there's another way to achieve the indexing of new pages by facebook?
You can refresh the Open Graph tags with a POST request to the Graph API, i think it´s not in the Facebook docs (at least i could not find it) - but it definitely works:
$.post('https://graph.facebook.com', {
id: 'http://www.yourdomain.com/somefile.html',
scrape: true
}, function(response) {
console.log(response);
});
Just an example with jQuery, of course you can just use CURL on the server too.

how to get notification when people post a comment using facebook comment plugin

I have created a static webpage and have included facebook comment plugin.
A person commented but i did not receive any notification in facebook or in my email.
What should i do to get notifications to my email when people post using facebook comment?
do i have to do something like this
FB.subscribe('comment.create', function(response){
//make an ajax request to a server side script
// and in that i can send a mail to my email... isn't it?
}
});
since that page is totally html i dont want to use any more javascripts yet if needed then i will have to use.
so is that the way to notify myself when an user posts a comment using the facebook comment plugin...
in the official documentation (http://developers.facebook.com/docs/reference/plugins/comments/) it says in the FAQ part:
How do I know when someone comments on my site?
You can subscribe to the 'comment.create' and 'comment.remove' events
through FB.Event.subscribe.
so yes, you will need to use this method to be notified on comments.

Unable to post links to an FB Event page using the Graph API

We are trying to publish to the feed resource of an event using the Graph API. What happens is it seems to ignore any link that we post. It also does not seem the Graph API supports any option for posting a photo to the wall of an event.
We make the call to the event feed using the following parameters:
link='http://rfid-social-media.odinrfid.com/photo?photoId=000000000000000000102107'
name='John at Facebook Party'
message='Test Message 2'
caption='What a great time'
And we publish against the url:
https://graph.facebook.com/EVENT_ID/feed
The request response does go through successfully, but the link does not show up in the UI.
We can post a link to a regular page using the Graph API without issue. It does show in the UI with the link, thumbnail, caption, etc, all as it should.
Thanks..
This is a Bug and its reported and marked as confidential
With the below text and its also contain security hole
bug report link
Below is my bug report text.
Other details on this report are shown to Facebook employees only
I recently attempted to post on an event's wall using the Graph API, but only the message is posted; Everything else is not showing. e.g.
Link
Picture
etc
There is one more big thing that the post doesn't show; That this post is post "via a Facebook app"
Note: posting on a page or user wall worked and also normal messages posted on an event 's wall.
The most important thing is when the post is shown on the event's wall "it does not show that its posted by a Facebook Application".
This is very dangerous; For example I can make an application and post nonsense on a user's wall. People will think that this is posted by the user.
Thank you so much for creating this question
For posting a photo to an event it seems to be a FB bug, subscribe and up the repo count so it gets attention
https://developers.facebook.com/bugs/225316074217855?browse=search_4f2f7576c5bc32d87041759

'Like' a page using Facebook Graph API

Using the Graph API I'd like to be able to have an authorized user "like" a page.
I tried posting the following
https://graph.facebook.com/${PAGE_ID}/likes?access_token=${ACCESS_TOKEN}
And I get an HTTP error 500 accompanied by "Invalid post_id parameter" in the JSON response body. Looks like the /likes resource is suited to liking a wall post and not a page. How do I get this to work with a page?
Facebook has announced support for liking URL's outside of Facebook by using the official built-in Like action. You need to have publish_actions permissions. The graph url for this is:
https://graph.facebook.com/[User FB ID]/og.likes?object=OG_OBJECT_URL&access_token=USER_ACCESS_TOKEN
However, you cannot use this to like a page on Facebook currently, as the documentation states:
For Facebook Pages or websites that do not integrate with Facebook
Authentication, developers should continue to use the Like button
social plugin.
Update June 2016
It's still not possible to like a page using Facebook API, as stated in the /{user_id}/likes documentation page about Creating/Updating/Deleting:
You can't perform this operation on this endpoint.
In previous versions the message was clearer (see the quote below), but the result is the same: it's not possible.
May 2014
The /{user-id}/likes documentation page States about Publishing Likes of Facebook Pages:
You can't publish using this edge, as it is not possible to like a Facebook Page via any API. You should use the Like Button if you want people to be able to like a page in your app.
This is the most obvious and clear statement that has been able to give me an answer to the question.
if your app is an open graph app, now you can like using the api, and no need for the button anymore.
https://developers.facebook.com/docs/opengraph/actions/builtin/likes/
If you want this functionality in a page tab or canvas page within facebook (say to allow for liking the page from within a likegated page), a work around you can involves what Tom Wells suggested in his reply to Luke. You first embed the iframe version of their like button on your page, and then simply listen for the edge.create event in your JS like so:
FB.Event.subscribe('edge.create',
function(response) {
alert('You liked the URL: ' + response);
// ...
}
);
In the callback, you can deal with with what happens when the user has liked the page, say like navigating away from the like-gate page, or showing liked-only content.
When the user clicks the iFrame like button, your JS code should receive the edge.create event assuming the iFrame was configured to point to the url of the page in question.
I believe this is not allowed except for specific partner sites, like yelp. The reason is security, you would be able to put some javascript on a page and have everyone that visits that page "Like"ing it without their knowledge.
See How do I "Like" a URL? on the Facebook Platform Developer Forum
You can like an object with its object id using Facebook api using the following piece of code
[FBRequestConnection startForPostWithGraphPath:[NSString stringWithFormat:#"/%#/likes",{object_id}] graphObject:nil completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
//do you customisation post like here
}];

Facebook Application Send Friend request using Facebook Api

I want to send Facebook friend invitations to some of our friends list without using FBML tags (<fb:request ....)
I am writing code in ASP.NET using fbServices.
How can I send friend requests without using FMBL tags?
Friend requests cannot be done through the Facebook API. The FBML fb:request-form tag is the only way to do this.
I spent a great deal of time looking, and finally came accross a very simple solution.
Using the Facebook Javascript API you can do a friend request with:
<script>
FB.ui(
{
method: 'friends.add',
id: fbid // assuming you set this variable previously...
},
function(param){
console.log(param);
// If they cancel params will show:
// {action:false, ...}
// and if they send the friend request it'll have:
// {action:true, ...}
// and if they closed the pop-up window then:
// param is undefined
}
);
</script>
The callback script can then simply performs an ajax call to your server where
you save info about the action, if needed.
You can test this by using the javascript console app on Facebook:
http://developers.facebook.com/tools/console
Paste in the script above, including the tags, or click the "Examples"
button on the bottom of the text area and find the "fb.ui — friends.add" example.
fb:request-form is now obsolete and will be deprecated eventually. The new way, announced on 27 January 2011, is the Requests Dialog.
Facebook does not allow you to programatically send friend requests.
I suggest taking a look at their API
Okay. Years later, things has changed:
https://developers.facebook.com/docs/reference/dialogs/
Dialogs provide a simple, consistent interface to provide social
functionality to your users. Dialogs do not require any additional
permissions because they require user interaction. Dialogs can be used
by your application in every context: within a Canvas Page, in a Page
Tab, in a website or mobile web app, and within native iOS and native
Android applications.
There are currently 7 Dialogs available for you to use:
- The Feed Dialog allows a user to post a story to their Timeline and to their friends' News Feeds
- The OAuth Dialog allows a user to authorize an application as part of an authentication flow.
- The Add Page Tab Dialog allows a user to add an application to a Facebook Page which they administer.
- The Friends Dialog allows a user to send a friend request to another user.
- The Pay Dialog allows a user to make a purchase using Facebook Credits.
- The Requests Dialog allows a user to send a request to one or more of their friends
- The Send Dialog allows a user to send a Facebook Message to one or more of their friends.
See also: https://developers.facebook.com/docs/requests/
You can send requests to friends without using FBML as follows
`FB.ui({
method: 'apprequests',
message: 'This is my applicaiton',
title: 'Application Request without FBML',
filters: 'all'
},
// Callback function returning the list of requestObj Ids
function(response){
}
);`
For more info you could refer
Wiki Page for apprequest graph API