4

I have the following function (taken from the facebook webhook tutorial) for subscribing an app to a page, but I want the reverse thing to happen ( unsubscribe).

How can I do that? I have not found any answers yet, in JavaScript.

function subscribeApp(page_id, page_access_token) {
        console.log('Subscribing page to app! ' + page_id);
        FB.api(
            '/' + page_id + '/subscribed_apps',
            'post',
            {access_token: page_access_token},
            function(response) {
                console.log('Successfully subscribed page', response);
                // insert in DB
            });
    }
Alex Besleaga
  • 61
  • 1
  • 5
  • 1
    I think I have found my answer : function unsubscribeApp(page_id, page_access_token) { console.log('Unsubscribing... ! ' + page_id); FB.api( '/' + page_id + '/subscribed_apps', 'DELETE', {access_token: page_access_token}, function(response) { console.log('Successfully unsubscribed page', response); // insert in DB }); } – Alex Besleaga Apr 06 '16 at 08:10

1 Answers1

8

Here ya go.

  function unSubscribeApp(page_id, page_access_token) {
    console.log('Unsubscribing app from page! ' + page_id);
    FB.api(
      '/' + page_id + '/subscribed_apps',
      'delete',
      {access_token: page_access_token},
      function(response) {
        console.log('Successfully unsubscribed page', response);
      }
    );
  }
joshlsullivan
  • 1,375
  • 2
  • 14
  • 21