Skip to content

Commit 62d66d4

Browse files
authored
Merge pull request #34 from bufferapp/epd-1014/fix-ig-audience-response
[EPD-1014] Handle IG audience data response as lifetime values
2 parents 38bfc77 + d088aed commit 62d66d4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: Facebook/Facebook.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ private function extractPageInsightsMetricsFromResponse($response)
381381
foreach ($metricValuesByDay as $key => $value) {
382382
if (isset($value["end_time"]) && isset($value["value"])) {
383383
$result[$metricName][$value["end_time"]] = $value["value"];
384+
} else if (isset($value["value"])) {
385+
$result[$metricName] = $value["value"];
384386
}
385387
}
386388
}
@@ -482,13 +484,13 @@ public function subscribeToWebhook($pageId)
482484
// which currently does not support Instagram webhooks fields
483485
// as a workaround we are subscribing to the email fields, to get the webhooks up and running
484486
// so that it will return story_insights events
485-
$params = ["subscribed_fields" => 'email' ];
486-
return $this->sendRequest("POST", "/${pageId}/subscribed_apps", $params)->getDecodedBody();
487+
$params = ["subscribed_fields" => 'email'];
488+
return $this->sendRequest("POST", "/{$pageId}/subscribed_apps", $params)->getDecodedBody();
487489
}
488490

489491
public function unsubscribeFromWebhook($pageId)
490492
{
491-
return $this->sendRequest("DELETE", "/${pageId}/subscribed_apps")->getDecodedBody();
493+
return $this->sendRequest("DELETE", "/{$pageId}/subscribed_apps")->getDecodedBody();
492494
}
493495

494496
public function getMe()

0 commit comments

Comments
 (0)