I am using instagram real time updates for tag, to get notification when someone tag media with specific tag. Subscription works fine, and im able to check subscription directly using https://api.instagram.com/v1/subscriptions?client_secret={cs}&client_id={cid}
Within callback i have something like
if (isset ($_GET['hub_challenge'])){
echo $_GET['hub_challenge'];
}
else{
$my_string = file_get_contents('php://input');
$sub_update = json_decode($my_string);
//do the rest of the things with data we fetched
}
}
But, this callback is executed twice from instagram side. So for example, if i subscribe to "winter" tag, and if someone publish media and tag it using that tag, instagram will send notification twice to callback file i specified during subscription (both calls are executed within few secs). Why instagram sending request twice to the callback? Anyone had similar issue?
After debugging and investigation i found that call is sent from instagram twice if callback file is not executed fast enough.
Based on the documentation:
They will send second request in case they dont receive response on first request within 2 secs.
At the end, i had blank callback.php file with only "sleep" inside it and its called twice each time.