-1

I'm aware you can force update a page's cache by entering the URL on Facebook's debugger tool while been logged in as admin for that app/page: https://developers.facebook.com/tools/debug

But what I need is a way to automatically call an API endpoint or something from our internal app whenever somebody from our Sales department updates the main image of one of our pages. It is not an option to ask thousands of sales people to login as an admin and manually update a page's cache whenever they update one of our item's description or image.

We can't afford to wait 24 hours for Facebook to update its cache because we're getting daily complaints from our clients whenever they don't see a change showing up as soon as we change it on our side.

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • If you go to the debugger tool and scrape the URL then scroll down to `Scrape via API` it will give you the API call to make to rescrape. – WizKid Jul 19 '21 at 05:21

1 Answers1

0

This worked a while ago:

$.post('https://graph.facebook.com', {
    id: 'https://www.yourdomain.com/someurl',
    scrape: true
}, (response) => {
    console.log(response);
});

In this case, with jQuery - but of course you can also use the fetch API or axios.

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • if possible an unix command is prefered, to loop it in a vps, like this one while true; do sleep 2; curl -F id="http://YOURDOMAIN" -F scrape=true -F access_token='YOURACCESSTOKEN' -F appID=FACEBOOKAPPID https://graph.facebook.com; done & – ADIL EL ALAOUI Jul 19 '21 at 06:52
  • tell me if that works and i will add it to my answer - but you really should not do this every 2 seconds, i would not re-scrape more than once in an hour or so. open graph tags are not meant to be changed the whole time. – andyrandy Jul 19 '21 at 06:56
  • Yes this code was working at api v3.3, after that the access_token is deprecated – ADIL EL ALAOUI Jul 19 '21 at 22:50
  • what do you mean? access tokens are still important with the graph api, did you try with an app access token? > https://developers.facebook.com/docs/facebook-login/access-tokens/ – andyrandy Jul 20 '21 at 05:40