Create and publish offers on Facebook page using Facebook PHP SDK.
I have implemented the SDK as provided in documentation and successuly created the offer and that API is returning offer id as described. When I run the publish offer API in my case. '/{offer_id}/nativeofferviews' that is showing me this.
"Fatal error: Uncaught exception 'FacebookAds\Http\Exception\AuthorizationException' with message '(#1) An unknown error occurred'"
and there is no offer on my page also.
Here is the code I am trying for publish offer on page.
Api::init(
'app_id', // App ID
'secret',
'Access_Token' // Your user access token
);
//);
$params = array(
'message' => 'This is a offer',
'photos' => array(
'photo_id'
),
'published' => true,
'published_ads' => true
);
$data = Api::instance()->call(
'/offer_id/nativeofferviews',
RequestInterface::METHOD_POST,
$params)->getContent();
Output should be According to documentation.
success: bool,
native_offer_view: numeric string,
post: numeric string,
photos: List [
numeric string
],
videos: List [
numeric string
],
}