Search code examples
ruby-on-railsfacebookfacebook-graph-apikoala

How to add an app to a page via Graph API? (with Koala gem)


Ok, I have a Rails app using the Koala gem. I have manage_pages permissions and I'm able to successfully get the user's pages and access_tokens.

I want to add an application with a Page Tab to one of the user's pages. Basically the equivalent of going to an app's profile, clicking "add to page" and selecting a page to add it to.

I don't see where in the Graph API this is done.


Solution

  • If you have the manage pages permission using the Graph API you can install a profile_tab at the end of the current list of installed tabs for a page by issuing an HTTP POST request to PAGE_ID/tabs with a Page Access Token

    https://graph.facebook.com/YOUR_PAGE_ID/tabs/create/?app_id=YOUR_APP_ID&access_token=YOUR_TOKEN

    Hope that helps.