8

I have been investigating the Facebook Open Graph API. There is a "manage pages" extended permission which allows publishing to a user's Facebook Page news feed/wall via "impersonation". This is nice functionality, but is there anything more you can do through the API?

Specifically, I would like to be able to Add or Remove a "Tab" application from a user's Page via the API. Right now it's complicated to guide a user through the process of adding a tab app to their business (or Place) Facebook Page, and it would be AWESOME if they could just grant my app permission and I could add the app for them with the API.

Basically I am wondering if the API allows for true "page management", or just posting to the Page.

Anyone have any experience with this?

Is the best I can do pointing them to the "add.php" page with the "page" GET variable (e.g. http://www.facebook.com/add.php?api_key=xxxx&pages=1&page=xxxxxx)? This works OK for ADDING a tab application, but there is nothing at all to help them REMOVE an application from their Page so far as I know.

Thanks!

1

3 Answers 3

13

It is worth noting now, for anyone viewing this question (which is celebrating it's 1st birthday!), that Facebook significantly upgraded their API functionality back in July 2011. You can now Add, Remove, Rename, Reorder and set tabs as Default via the Open Graph API. The blog post is here:

https://developers.facebook.com/blog/post/524/

And the official documentation is here:

https://developers.facebook.com/docs/reference/api/page/#tabs

What Facebook does NOT have yet is a new API method for creating new tab apps, or for changing the tab icon. This is a big step though!

UPDATE: There is bug on the new bug tracker to follow about creating apps in the API if you want to follow it and see what they do: http://developers.facebook.com/bugs/295627350461318

2
3

There's a way to do it via the API. We finally got it to work, after many hours of sweat and tears :)

You can add a tab to a page without leaving your app. Here's a snippet of code that we used for that. We get a list of pages that a user manages, show them in a drop down and ask them to select what page they want to add our "my agent profile" tab to.

And the final product looks something like this - http://www.facebook.com/pages/Jennifer-Anderson-Real-Estate-Agent/185071901564573?sk=app_253956901293839

protected void btnAddTab_Click(object sender, EventArgs e)
{
    if (ddlPage2.SelectedIndex >= 0)
    {
        FaceBookPages page = FaceBookPages.LookupByPageID(long.Parse(ddlPage2.SelectedValue));
        if (page == null)
            throw new NPlaySysException("FaceBookPages is null.");

        AnalyticLog log = new AnalyticLog();
        log.EventID = FBCommon.Events.AddAgentAppTabID;
        log.UserID = UserID;
        log.EventTime = DateTime.Now;
        log.Update();

        string result = FacebookSvc.AddTab(Web.AgentAppID, "me", page.AccessToken);
        if (result.Equals("true"))
        {
            FaceBookPages.UpdateAgentProfileAdded(page.PageID, true);
            List<FaceBookPages> notTabbedPages = FaceBookPages.LookupAgentProfileNotAddedByUserID(UserID);

            imgStep3.ImageUrl = StepDoneImagePath;
            divStep3.Attributes["class"] = StepDoneCssClass;
            phStep3.Visible = false;
            Step3Done = true;
            btnCloseStep3.Visible = false;

            if (notTabbedPages.Count > 0)
                btnEditStep3.Visible = true;
            else
                btnEditStep3.Visible = false;
        }
        else
        {
            lblErrorAddTab.Text = "Failed to add your profile to page.";
            Web.EmailError(string.Format("FacebookSvc.AddTab Failed. result={0}<br />UserID={1}<br />PageID={2}", result, UserID, page.PageID));
        }
    }
}
1
  • Thanks Daniel, I will have to try this out.
    – thaddeusmt
    Oct 4, 2011 at 15:53
2

Yes, the best you can do is direct them to the add.php url. You can't do anything to help them remove the app.

The good news is that the user used to have to go through the add process AND physically decide to "enable" the tab by finding it in the tab dropdown on the page. Facebook has recently changed that and it seems that the tab is now immediately enabled after a user adds the app to their page.

As for "has_added_app" that works... sorta. It will tell you if the app is added to the page, but it won't tell you if the tab is enabled. For example, a user can disable the tab but still technically have the app installed on the page. Therefore "has_added_app" will return true even though the tab isn't actually visible.

1
  • Thanks for the answer! I was afraid this was case, just feeling around to make sure there aren't some hidden "features". I will have to play around with the has_added_app, that is at least somewhat helpful.
    – thaddeusmt
    Sep 22, 2010 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.