0

I'm trying to add custom tab using facebook graph api. I tried everything on the doc but nothing is working. Here's my sample code.

    $('#addTab').click(function(event){
    FB.ui({
        method: 'pagetab',
        redirect_uri: 'https://{mydomain}.com',
    }, function(response) {
        if((response && !response.error_code) || window.mobileAndTabletCheck()) {
            console.log(response);
            FB.api(
                '/{mypageid}/tabs',
                'POST',
                {"custom_name":"My Custom Tab","tab":"app_{myappid}",
                    "access_token":"{I put my access token here}"},
                function(response) {
                    // Insert your code here
                    //   
                }
            );
        } else {
            console.log('error');
        }
    });
});

But I'm getting this messages from the two method

FB.ui

FB.api

Daniel_C
  • 21
  • 1
  • 7
  • Why do you have two different methods of adding a tab nested into each other to begin with? Use _either_ the dialog, _or_ the POST method. – CBroe Aug 08 '22 at 06:04
  • Is the page you are trying this on eligible for having custom tabs? ("Only Pages with 2000 or more likes can create custom Page tabs.") – CBroe Aug 08 '22 at 06:05
  • @CBroe first I tried using only one of them. I also tried using the cURL. But still not working and getting the same message which "tab 'app_id' does not exist on profile". So that's why I tried using both methods of adding just incase it will work. – Daniel_C Aug 08 '22 at 21:14

0 Answers0