通过 Open Graph API 管理 Facebook 页面选项卡应用程序?

发布于 2024-09-20 00:01:08 字数 609 浏览 5 评论 0原文

我一直在研究 Facebook Open Graph API。有一个“管理页面”扩展权限,允许通过“模拟”发布到用户的 Facebook 页面新闻源/墙。这是一个不错的功能,但是您还可以通过 API 执行更多操作吗?

具体来说,我希望能够通过 API 从用户页面添加或删除“选项卡”应用程序。目前,引导用户完成将选项卡应用程序添加到他们的企业(或地点)Facebook 页面的过程很复杂,如果他们可以授予我的应用程序权限并且我可以使用 API 为他们添加应用程序,那就太棒了。

基本上我想知道 API 是否允许真正的“页面管理”,或者只是发布到页面。

有人有这方面的经验吗?

我能做的最好的事情就是用“page”GET变量将它们指向“add.php”页面(例如 http://www.facebook.com/add.php?api_key=xxxx&pages=1&page=xxxxxx)?这对于添加选项卡应用程序来说是可以的,但据我所知,没有任何东西可以帮助他们从页面中删除应用程序。

谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

漫雪独思 2024-09-27 00:01:08

现在值得注意的是,对于查看此问题的任何人(正在庆祝其一岁生日!),Facebook 早在 2011 年 7 月就显着升级了其 API 功能。您现在可以通过以下方式添加、删除、重命名、重新排序并将选项卡设置为默认值开放图谱 API。博客文章在这里:

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

官方文档在这里:

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

Facebook 还没有用于创建新选项卡应用程序或更改选项卡图标的新 API 方法。但这是迈出的一大步!

更新:如果您想关注新的错误跟踪器并了解它们的作用,请关注有关在 API 中创建应用程序的新错误跟踪器上的错误http://developers.facebook.com/bugs/295627350461318

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

苏璃陌 2024-09-27 00:01:08

有一种方法可以通过 API 来做到这一点。经过数小时的汗水和泪水,我们终于让它开始工作了:)

您可以在不离开应用程序的情况下向页面添加选项卡。这是我们用于此目的的一段代码。我们获取用户管理的页面列表,将其显示在下拉列表中,并要求他们选择要将我们的“我的代理个人资料”选项卡添加到的页面。

最终产品看起来像这样 - 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));
        }
    }
}

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));
        }
    }
}
笑叹一世浮沉 2024-09-27 00:01:08

是的,您能做的最好的就是将他们定向到 add.php url。您无法采取任何措施来帮助他们删除该应用程序。

好消息是,用户过去必须经历添加过程,并通过在页面的选项卡下拉列表中找到它来实际决定“启用”选项卡。 Facebook 最近对此进行了更改,似乎在用户将应用程序添加到其页面后,该选项卡立即启用。

至于“has_added_app”有效......有点。它会告诉您应用程序是否已添加到页面,但不会告诉您选项卡是否已启用。例如,用户可以禁用该选项卡,但从技术上讲,该应用程序仍然安装在页面上。因此,即使选项卡实际上不可见,“has_added_app”也会返回 true。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文