For Custom Audience API integration check out Facebook's documentation.
The general Facebook API info is a good place to start.
Then the next steps would be:
-
Install the Facebook Ads API PHP SDK.
-
This step is not mandatory since you can alternatively use an existing custom audience. Create a new custom audience (PHP code example):
<?php
use FacebookAds\Object\CustomAudience;
use FacebookAds\Object\Fields\CustomAudienceFields;
use FacebookAds\Object\Values\CustomAudienceSubtypes;
$audience = new CustomAudience(null, 'act_<AD_ACCOUNT_ID>');
$audience->setData(array(
CustomAudienceFields::NAME => 'My new CA',
CustomAudienceFields::SUBTYPE => CustomAudienceSubtypes::CUSTOM,
CustomAudienceFields::DESCRIPTION => 'People who bought from my website',
));
$audience->create();
?>
- Add people to an existing custom audience (<CUSTOM_AUDIENCE_ID>) (PHP code example):
<?php
use FacebookAds\Object\CustomAudience;
use FacebookAds\Object\Values\CustomAudienceTypes;
$emails = array(
'test1@example.com',
'test2@example.com',
'test3@example.com',
);
$audience = new CustomAudience(<CUSTOM_AUDIENCE_ID>);
$audience->addUsers($emails, CustomAudienceTypes::EMAIL);
?>
More code examples at https://developers.facebook.com/docs/marketing-api/audiences-api
Our Technical Account Managers are happy to help with the implementation.