Add new ad rule
Below is a list of Insights filters and whether they are supported by Trigger Based Rules:
POST
https://us-central1-appgregator.cloudfunctions.net/facebook/adrules/
Query Parameters
Headers
{
"id": "23852206730700549"
}
Body JSON
{
"name": "Rules-7",
"status": "DISABLED",
"evaluation_spec": {
"evaluation_type": "SCHEDULE",
"filters": [
{
"field": "lifetime_impressions",
"value": "8000",
"operator": "GREATER_THAN"
},
{
"field": "cost_per",
"value": "10",
"operator": "GREATER_THAN"
},
{
"field": "entity_type",
"value": "CAMPAIGN",
"operator": "EQUAL"
},
{
"field": "time_preset",
"value": "MAXIMUM",
"operator": "EQUAL"
}
]
},
"execution_spec": {
"execution_type": "PAUSE",
"execution_options": [
{
"field": "user_ids",
"value": [
"3305578009767732"
],
"operator": "EQUAL"
}
]
},
"schedule_spec": {
"schedule_type": "DAILY"
}
}
curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/facebook/adrules?name=ft-4&connection_name=fbads-01&adaccount_id=act_1514519918873559' \
--header 'x-api-key: U2Fsd...' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Rules-7",
"status": "DISABLED",
"evaluation_spec": {
"evaluation_type": "SCHEDULE",
"filters": [
{
"field": "lifetime_impressions",
"value": "8000",
"operator": "GREATER_THAN"
},
{
"field": "cost_per",
"value": "10",
"operator": "GREATER_THAN"
},
{
"field": "entity_type",
"value": "CAMPAIGN",
"operator": "EQUAL"
},
{
"field": "time_preset",
"value": "MAXIMUM",
"operator": "EQUAL"
}
]
},
"execution_spec": {
"execution_type": "PAUSE",
"execution_options": [
{
"field": "user_ids",
"value": [
"3305578009767732"
],
"operator": "EQUAL"
}
]
},
"schedule_spec": {
"schedule_type": "DAILY"
}
}'
var axios = require('axios');
var data = JSON.stringify({
"name": "Rules-7",
"status": "DISABLED",
"evaluation_spec": {
"evaluation_type": "SCHEDULE",
"filters": [
{
"field": "lifetime_impressions",
"value": "8000",
"operator": "GREATER_THAN"
},
{
"field": "cost_per",
"value": "10",
"operator": "GREATER_THAN"
},
{
"field": "entity_type",
"value": "CAMPAIGN",
"operator": "EQUAL"
},
{
"field": "time_preset",
"value": "MAXIMUM",
"operator": "EQUAL"
}
]
},
"execution_spec": {
"execution_type": "PAUSE",
"execution_options": [
{
"field": "user_ids",
"value": [
"3305578009767732"
],
"operator": "EQUAL"
}
]
},
"schedule_spec": {
"schedule_type": "DAILY"
}
});
var config = {
method: 'post',
url: 'https://us-central1-appgregator.cloudfunctions.net/facebook/adrules?name=ft-4&connection_name=fbads-01&adaccount_id=act_1514519918873559',
headers: {
'x-api-key': 'U2Fsd...',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/facebook/adrules?name=ft-4&connection_name=fbads-01&adaccount_id=act_1514519918873559',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"name": "Rules-7",
"status": "DISABLED",
"evaluation_spec": {
"evaluation_type": "SCHEDULE",
"filters": [
{
"field": "lifetime_impressions",
"value": "8000",
"operator": "GREATER_THAN"
},
{
"field": "cost_per",
"value": "10",
"operator": "GREATER_THAN"
},
{
"field": "entity_type",
"value": "CAMPAIGN",
"operator": "EQUAL"
},
{
"field": "time_preset",
"value": "MAXIMUM",
"operator": "EQUAL"
}
]
},
"execution_spec": {
"execution_type": "PAUSE",
"execution_options": [
{
"field": "user_ids",
"value": [
"3305578009767732"
],
"operator": "EQUAL"
}
]
},
"schedule_spec": {
"schedule_type": "DAILY"
}
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: U2Fsd...',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last updated