public fetchPrivateConversations ( ) : array | Illuminate\View\View | ||
Résultat | array | Illuminate\View\View |
public function fetchPrivateConversations()
{
$fb = initFb();
$token = $this->config->FbAccessToken();
try {
$posts = $fb->get('/' . config('crm-launcher.facebook_credentials.facebook_page_id') . '/conversations?fields=id,updated_time', $token);
return json_decode($posts->getBody());
} catch (Exception $e) {
getErrorMessage($e->getCode());
return back();
}
}
/** * Handles all private conversations from Facebook * @return void */ public function collectPrivateConversations() { $newest = $this->message->getNewestMessageDate(); $conversations = $this->facebookContent->fetchPrivateConversations(); foreach ($conversations->data as $key => $conversation) { if (changeFbDateFormat($conversation->updated_time) > $newest) { $this->collectPrivateMessages($conversation, $newest); } } }