Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload custom app image (tab_image) for Timeline Page tabs via API?

Facebook released the new Timeline for Pages today. Apps installed to pages as "tabs" now appear above the timeline with a 111px x 74px size thumbnail "app image". You can customize this on a per-page level (just like the custom tab name) if you navigate the Facebook Page admin interface.

You can update the tab's "custom name" via the Open Graph API, but they do not appear to have updated their API docs to show how to upload a custom tab_image (assuming they will). Is it possible now but undocumented? Has anyone figured out how to do this yet?

like image 332
thaddeusmt Avatar asked Dec 22 '22 01:12

thaddeusmt


2 Answers

Updated 2016:

With the latest Open Graph 2.5 API tabs endpoint and PHP SDK 5, the code should look like this:

<?php 
$fb = new Facebook\Facebook([/* . . . */]);
$response = $fb->post(
    '/{page-id}/tabs',
    [
        'custom_name'=>'My Custom Tab',
        'custom_image_url'=>'http://publicly.accessible/image.jpg',
        'app_id'=>'{app-id}',
    ],
    '{page-access-token}',
);

Original 2012 post:

I figured it out, it's just like uploading an image. The field is called "custom_image". Presumably they will update the documentation soon. It's nice they enabled this API hook so quickly with the new release!

Here's how to do it with the Facebook PHP SDK:

<?php
$page_access_token = 'XXXXXXX'; // you'll need the manage_pages permission to get this
$facebook = new Facebook(array(
  'appId'  => 'YOUR_APP_ID',
  'secret' => 'YOUR_APP_SECRET',
  'fileUpload' => true, // enables CURL @ file uploads
));
$facebook->api(
  '/PAGE_ID/tabs/TAB_NAME', // looks like "app_xxxx" where xxxx = APP_ID
  'POST' // post to update
  array(
    'custom_image' => '@' . realpath('path/to/my/file.jpg'),
    'custom_name' => 'My App', // give it a custom name if you want too
    'access_token' => $page_access_token // access token for the page
  )
);

Cheers

like image 68
thaddeusmt Avatar answered May 12 '23 23:05

thaddeusmt


As you said Timeline for Pages is just announced and it's too soon to say it'll be possible via API. Currently it's not possible even in settings of your App in Developer Application.

This information is simply not yet documented in help center or Graph API documentation.

It's also way soon to say someone have discovered if such functionality exists...

We all should wait a bit and probably file bugs which may get some response from officials confirming, rejecting or adding this to wish list.

like image 44
Juicy Scripter Avatar answered May 12 '23 23:05

Juicy Scripter