Issue Status: This issue is quite old, and the facebook platform has changed significantly in the meantime. You're probably better off not reading any further.

Original Issue:
Are there any plans to integrate the module with the newly released Facebook Pages? Here is a developer's insight about Facebook Pages: http://www.box.net/shared/v114cwzk00, which seems the latest hype for organizations/companies to have on Facebook, and which actually works better than Facebook Groups because Pages are more like user profiles and thus provide better interaction with the subscribers.

Facebook Pages could be an extra "dessimination channel" of posts on your website, so that everytime you publish new content you could push the link + some content on the wall of the Facebook Page, thus reaching all the subscribers of that page within Facebook. For events, there could be some integration with the date modules that push dates via the Facebook API to the feed, so it appears as an event people can subscribe to on Facebook.

What do you think? I am thinking about implementing a separate module that uses the Facebook for Drupal API (which I need to study first a bit better), but I would be very glad to hear some more opinions.

Comments

Dave Cohen’s picture

Status: Active » Closed (works as designed)

There's no need for a seperate module. Facebook treats pages like users, as far as the API is concerned. So feel free to build an app using Drupal for Facebook. On the facebook side, configure the app so it can be added to pages (in addition to, or instead of, users). Then make a page, group or whatever and as the administrator you'll be able to add the app to the page.

The app can add a box to the page, just as it can add a box to a user's profile.

Things like creating events on facebook... the modules don't do this, but they give you a handle to the facebook api where your custom modules can do such things. I'd be interested in an fb_event.module which does such things if its generically applicable to many drupal sites.

pvhee’s picture

As I understood it, I need to create an application that can be added to the Facebook page. However, is it necessary to work via applications? Intuitively, I would expect that having the page ID and authentication in FB would be sufficient to post things to the wall (much like the Twitter module works for announcing posts from your site on Twitter, or the user comments that appear on the user's wall in the Fbconnect module).

thollback’s picture

I have the same use case and am very interested in finding the best way to approach it.

Any advice would be greatly appreciated.

scottrigby’s picture

@Dave Cohen: A fb_event.module would be handy =) Has there by chance been any progress on this already? If not... would it be worth adding a new feature request for this -- or should this issue be re-opened (title updated etc)? Ideally there would be a few people interested to work together on this, and if so i would be willing to pitch in.

Dave Cohen’s picture

Anything to do with events sounds like a seperate issue. Feel free to submit a new one to track it.

szb100’s picture

Agree with #2
There are ways round it via something like twitterfeed to take an rss feed from your site and post directly to your facebook page wall, but you start losing control of your content by going down this route.
A feature that is configurable by the end user administratively residing in a drupal install that enables integration with a facebook page wall would be very welcome.
...but maybe we're talking about a new module here rather than within Drupal for Facebook?

Dave Cohen’s picture

You're talking about using Drupal for Facebook to manage the application and get the facebook APIs into Drupal, then write a module to make the wall posts say whatever you want them to say.

If all you want is to write to one wall, the page with the app installed, you would need...
Enable fb.module, fb_app.module and fb_stream.module. Configure the app on facebook to be added to pages and add it to your page. Configure the app on drupal, just copying the apikey and secret. Then in your module call fb_stream_publish_dialog(). Or, maybe, skip fb_stream.module altogether and call http://wiki.developers.facebook.com/index.php/Stream.publish directly.

That function takes a uid, which will be the id of your page. I have not played with that feature myself, yet. It might be that you have to set up an "infinite session" for that to work. Maybe just the publish_stream extended permission is sufficient. The easiest ways to test that would be to enable the fb_connect.module and fb_permission.module and use them to grant the permissions (publish_stream and, if necessary, offline_access).

If you try this, let us know how it goes.

emdalton’s picture

Would this be a way to post an event (a node with date fields) from Drupal to Facebook?

Dave Cohen’s picture

This is off-topic, if you want to discuss it, start another thread.

Short answer: facebook's API let's your app learn about Facebook Events, but not create them. In other words true facebook events are read-only.

If you have an event in drupal, there are all kinds of ways to link to it from elsewhere in facebook, the stream api is one of them. You can present that Drupal event on a canvas page, in a block on a profile, or on a facebook connect enabled website, but you can't turn it into a Facebook Event, at least not today.

emdalton’s picture

I won't continue to derail the thread, but just in case anyone else is searching and finds this, I'm planning to try syncing through iCal. There are a couple of ways to get iCal appointments into FaceBook now, e.g. http://30boxes.com/import.php and http://www.facebook.com/apps/application.php?id=164414672850

ajayrockrock’s picture

Hi Dave, have you heard of anyone trying to write the facebook app that you've outlined? I'd like to take a stab at it and while I'm a decent PHP programmer, I'm a complete novice at writing drupal plugins. So if no one else has tried it, can you give me a few more pointers?

I have the fb modules installed and enabled like you said. My goal is to get the the module to kinda act like the twitter module. In the sense that when I post new content to my drupal site, it will automatically get posted to my blog's facebook page.

So I was thinking about just copying the twitter module and using that as a jumping off point. With the facebook modules loaded can I just use the hook_nodeapi() to "intercept newly published nodes" and post them to facebook?

Dave Cohen’s picture

ajayrockrock,

Take a look at this example, http://drupal.org/node/685320, which posts something to the current user's wall. There's another parameter which could be used to publish to a page instead, called target or something, details escape me.

Let us know how it goes.

szb100’s picture

ajayrockrock,

Before writing your own module / plugin, you may want to look at twitterfeed (which contrary to its name posts on facebook as well). There are probably other 3rd party services around as well which use an RSS feed, apply some rules, and post the result onto whatever medium you require.

ajayrockrock’s picture

@szb100: I'm already using the facebook Notes application to import my RSS feed and it's annoying. When I first set it up, it didn't recognize my rss feed. I tried a few minutes later and it "magically" worked? Also, I updated my drupal site yesterday and the Facebook site is still not updated. While 3rd party services usually work, the goal here is to just post directly from drupal to facebook without any middle men.

@Dave: Thanks for the example, sorry I missed that when I read the facebook docs earlier. I set this up last night but I must be missing something. I have the dupal module setup and my facebook app setup as well and correctly filled out the API key, Secret, and Application ID (I know this because Drupal isn't complaining about it anymore). Then I made a new module called, "facebookpost" and have an admin settings page that will take the page_id of the page you want to post to.

Now I'm on "Create Content" screen and trying to get the "Share on Facebook" checkbox to show up and my install isn't happy with this if statement:

if (isset($GLOBALS['fb']) && fb_facebook_user()) { ... }

Apparently my $GLOBALS['fb'] is defined and set to 'null' as is my $GLOBALS['fb_app']. I know I'm missing something and I'm not sure what. I have my app on facebook, I have Drupal for Facebook installed and talking to Facebook with no errors. After those two are talking, how do I get my module working? I created my module outside of the 'fb' module so it's standalone. Should I build it inside of the fb module? Thanks for your help!

Dave Cohen’s picture

If you're using the latest modules/fb/, go to admin/fb/fb_connect and make sure the "Primary Connect Application" is set to your app. Does that fix it?

ajayrockrock’s picture

that fixed it once I made sure that the application that I built on the drupal side was "published". Now $GLOBALS['fb'] is set. The other part of that if statement "fb_facebook_user()" is returning false.

I tried to enable the facebook module on the login page and then authenticate that way but it resulted in a Firefox, "This page isn't redirecting properly" message. Plus I don't really want anyone else using the facebook stuff, just me (being the primary author and posting to my site's FaceBook Page).

So how do I go about "authenticating" my drupal install so it can post to facebook? Mainly, how can I get "fb_facebook_user()" to return true?

PS. Thanks for the help, I'm learning quite a bit about drupal modules!

merilainen’s picture

Configure the app on facebook to be added to pages and add it to your page.

I tried to do this, but I think it's not possible to add the application to the page before it's in the Facebook directory. And an application cannot be sent there before there are some users. So how to test this?

summit’s picture

Subscribe, greetings, Martijn

edemicity’s picture

I am facing the same problem, I am using fb connect module, I ve add my facebook API which i believe is 107563219305571, when i log out of my site and try to log in with facebook, it tells me invalid API, I want some one to help me on how to integrate my site with facebook. example of API and secret,

RedTop’s picture

subscribe

md hafizor rahman’s picture

Title: Integration with Facebook Pages? » How can I Post drupal node content on facebook
Version: 6.x-3.x-dev » 6.x-3.0-rc13
Component: Code » Facebook Connect
Assigned: Unassigned » md hafizor rahman

How can user post drupal node content just like twitter module

Dave Cohen’s picture

Title: How can I Post drupal node content on facebook » Integration with Facebook Pages?
Version: 6.x-3.0-rc13 » 6.x-3.x-dev
Component: Facebook Connect » Code
Assigned: md hafizor rahman » Unassigned

This is a closed issue. Leave it alone.

Dave Cohen’s picture

Title: Integration with Facebook Pages? » old api for posting to page

Much of the information in this thread is no longer correct. Facebook has changed the platform.

mxt’s picture

Any news on this issue? Can someone tell me the right way to reach this objective:

How to automatically publish my drupal 7 site nodes to my own personal facebook page (not my profile page, but a "page" I've created on facebook).

Can you help me?

Thank you very much!

MXT

mxt’s picture

Issue summary: View changes

updated status