Engagement Ad
curl --request POST \
--url https://public.plai.io/meta/create_campaign \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"userId": "<string>",
"campaignName": "<string>",
"status": "<string>",
"budget": 123,
"startDate": "<string>",
"endDate": "<string>",
"url": "<string>",
"specialAdCategories": [
"<string>"
],
"specialAdCountries": [
"<string>"
],
"utmParams": "<string>",
"adSetName": "<string>",
"gender": "<string>",
"ages": {
"minAge": 123,
"maxAge": 123
},
"locations": [
{
"id": "<string>",
"type": "<string>",
"distance_unit": "<string>",
"radius": 123,
"countryCode": "<string>",
"countryName": "<string>"
}
],
"excludedLocations": [
{
"id": "<string>",
"type": "<string>",
"distance_unit": "<string>",
"radius": 123,
"countryCode": "<string>",
"countryName": "<string>"
}
],
"proximityTargeting": [
{
"countryName": "<string>",
"distance_unit": "<string>",
"latitude": "<string>",
"longitude": "<string>",
"radius": 123
}
],
"interests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"narrowInterests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"furtherInterests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"targetLocales": [
123
],
"audienceId": [
"<string>"
],
"excludedAudienceIds": [
"<string>"
],
"manualPlacements": true,
"facebook_positions": [
"<string>"
],
"instagram_positions": [
"<string>"
],
"messenger_positions": [
"<string>"
],
"userDevices": [
"<string>"
],
"userOS": [
"<string>"
],
"campaignType": "<string>",
"messagingApps": [
"<string>"
],
"multipleCreatives": [
{
"url": "<string>",
"primaryText": "<string>",
"headlines": "<string>",
"phoneNumber": "<string>",
"image": "<string>",
"video": {
"video_id": "<string>",
"thumbnail_url": "<string>"
},
"greetingText": "<string>",
"conversations": [
{
"title": "<string>"
}
],
"callToAction": "<string>"
}
]
}
'import requests
url = "https://public.plai.io/meta/create_campaign"
payload = {
"userId": "<string>",
"campaignName": "<string>",
"status": "<string>",
"budget": 123,
"startDate": "<string>",
"endDate": "<string>",
"url": "<string>",
"specialAdCategories": ["<string>"],
"specialAdCountries": ["<string>"],
"utmParams": "<string>",
"adSetName": "<string>",
"gender": "<string>",
"ages": {
"minAge": 123,
"maxAge": 123
},
"locations": [
{
"id": "<string>",
"type": "<string>",
"distance_unit": "<string>",
"radius": 123,
"countryCode": "<string>",
"countryName": "<string>"
}
],
"excludedLocations": [
{
"id": "<string>",
"type": "<string>",
"distance_unit": "<string>",
"radius": 123,
"countryCode": "<string>",
"countryName": "<string>"
}
],
"proximityTargeting": [
{
"countryName": "<string>",
"distance_unit": "<string>",
"latitude": "<string>",
"longitude": "<string>",
"radius": 123
}
],
"interests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"narrowInterests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"furtherInterests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"targetLocales": [123],
"audienceId": ["<string>"],
"excludedAudienceIds": ["<string>"],
"manualPlacements": True,
"facebook_positions": ["<string>"],
"instagram_positions": ["<string>"],
"messenger_positions": ["<string>"],
"userDevices": ["<string>"],
"userOS": ["<string>"],
"campaignType": "<string>",
"messagingApps": ["<string>"],
"multipleCreatives": [
{
"url": "<string>",
"primaryText": "<string>",
"headlines": "<string>",
"phoneNumber": "<string>",
"image": "<string>",
"video": {
"video_id": "<string>",
"thumbnail_url": "<string>"
},
"greetingText": "<string>",
"conversations": [{ "title": "<string>" }],
"callToAction": "<string>"
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userId: '<string>',
campaignName: '<string>',
status: '<string>',
budget: 123,
startDate: '<string>',
endDate: '<string>',
url: '<string>',
specialAdCategories: ['<string>'],
specialAdCountries: ['<string>'],
utmParams: '<string>',
adSetName: '<string>',
gender: '<string>',
ages: {minAge: 123, maxAge: 123},
locations: [
{
id: '<string>',
type: '<string>',
distance_unit: '<string>',
radius: 123,
countryCode: '<string>',
countryName: '<string>'
}
],
excludedLocations: [
{
id: '<string>',
type: '<string>',
distance_unit: '<string>',
radius: 123,
countryCode: '<string>',
countryName: '<string>'
}
],
proximityTargeting: [
{
countryName: '<string>',
distance_unit: '<string>',
latitude: '<string>',
longitude: '<string>',
radius: 123
}
],
interests: [{id: '<string>', name: '<string>', type: '<string>'}],
narrowInterests: [{id: '<string>', name: '<string>', type: '<string>'}],
furtherInterests: [{id: '<string>', name: '<string>', type: '<string>'}],
targetLocales: [123],
audienceId: ['<string>'],
excludedAudienceIds: ['<string>'],
manualPlacements: true,
facebook_positions: ['<string>'],
instagram_positions: ['<string>'],
messenger_positions: ['<string>'],
userDevices: ['<string>'],
userOS: ['<string>'],
campaignType: '<string>',
messagingApps: ['<string>'],
multipleCreatives: [
{
url: '<string>',
primaryText: '<string>',
headlines: '<string>',
phoneNumber: '<string>',
image: '<string>',
video: {video_id: '<string>', thumbnail_url: '<string>'},
greetingText: '<string>',
conversations: [{title: '<string>'}],
callToAction: '<string>'
}
]
})
};
fetch('https://public.plai.io/meta/create_campaign', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public.plai.io/meta/create_campaign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'userId' => '<string>',
'campaignName' => '<string>',
'status' => '<string>',
'budget' => 123,
'startDate' => '<string>',
'endDate' => '<string>',
'url' => '<string>',
'specialAdCategories' => [
'<string>'
],
'specialAdCountries' => [
'<string>'
],
'utmParams' => '<string>',
'adSetName' => '<string>',
'gender' => '<string>',
'ages' => [
'minAge' => 123,
'maxAge' => 123
],
'locations' => [
[
'id' => '<string>',
'type' => '<string>',
'distance_unit' => '<string>',
'radius' => 123,
'countryCode' => '<string>',
'countryName' => '<string>'
]
],
'excludedLocations' => [
[
'id' => '<string>',
'type' => '<string>',
'distance_unit' => '<string>',
'radius' => 123,
'countryCode' => '<string>',
'countryName' => '<string>'
]
],
'proximityTargeting' => [
[
'countryName' => '<string>',
'distance_unit' => '<string>',
'latitude' => '<string>',
'longitude' => '<string>',
'radius' => 123
]
],
'interests' => [
[
'id' => '<string>',
'name' => '<string>',
'type' => '<string>'
]
],
'narrowInterests' => [
[
'id' => '<string>',
'name' => '<string>',
'type' => '<string>'
]
],
'furtherInterests' => [
[
'id' => '<string>',
'name' => '<string>',
'type' => '<string>'
]
],
'targetLocales' => [
123
],
'audienceId' => [
'<string>'
],
'excludedAudienceIds' => [
'<string>'
],
'manualPlacements' => true,
'facebook_positions' => [
'<string>'
],
'instagram_positions' => [
'<string>'
],
'messenger_positions' => [
'<string>'
],
'userDevices' => [
'<string>'
],
'userOS' => [
'<string>'
],
'campaignType' => '<string>',
'messagingApps' => [
'<string>'
],
'multipleCreatives' => [
[
'url' => '<string>',
'primaryText' => '<string>',
'headlines' => '<string>',
'phoneNumber' => '<string>',
'image' => '<string>',
'video' => [
'video_id' => '<string>',
'thumbnail_url' => '<string>'
],
'greetingText' => '<string>',
'conversations' => [
[
'title' => '<string>'
]
],
'callToAction' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public.plai.io/meta/create_campaign"
payload := strings.NewReader("{\n \"userId\": \"<string>\",\n \"campaignName\": \"<string>\",\n \"status\": \"<string>\",\n \"budget\": 123,\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"url\": \"<string>\",\n \"specialAdCategories\": [\n \"<string>\"\n ],\n \"specialAdCountries\": [\n \"<string>\"\n ],\n \"utmParams\": \"<string>\",\n \"adSetName\": \"<string>\",\n \"gender\": \"<string>\",\n \"ages\": {\n \"minAge\": 123,\n \"maxAge\": 123\n },\n \"locations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"excludedLocations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"proximityTargeting\": [\n {\n \"countryName\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"radius\": 123\n }\n ],\n \"interests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"narrowInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"furtherInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLocales\": [\n 123\n ],\n \"audienceId\": [\n \"<string>\"\n ],\n \"excludedAudienceIds\": [\n \"<string>\"\n ],\n \"manualPlacements\": true,\n \"facebook_positions\": [\n \"<string>\"\n ],\n \"instagram_positions\": [\n \"<string>\"\n ],\n \"messenger_positions\": [\n \"<string>\"\n ],\n \"userDevices\": [\n \"<string>\"\n ],\n \"userOS\": [\n \"<string>\"\n ],\n \"campaignType\": \"<string>\",\n \"messagingApps\": [\n \"<string>\"\n ],\n \"multipleCreatives\": [\n {\n \"url\": \"<string>\",\n \"primaryText\": \"<string>\",\n \"headlines\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"image\": \"<string>\",\n \"video\": {\n \"video_id\": \"<string>\",\n \"thumbnail_url\": \"<string>\"\n },\n \"greetingText\": \"<string>\",\n \"conversations\": [\n {\n \"title\": \"<string>\"\n }\n ],\n \"callToAction\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public.plai.io/meta/create_campaign")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"<string>\",\n \"campaignName\": \"<string>\",\n \"status\": \"<string>\",\n \"budget\": 123,\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"url\": \"<string>\",\n \"specialAdCategories\": [\n \"<string>\"\n ],\n \"specialAdCountries\": [\n \"<string>\"\n ],\n \"utmParams\": \"<string>\",\n \"adSetName\": \"<string>\",\n \"gender\": \"<string>\",\n \"ages\": {\n \"minAge\": 123,\n \"maxAge\": 123\n },\n \"locations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"excludedLocations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"proximityTargeting\": [\n {\n \"countryName\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"radius\": 123\n }\n ],\n \"interests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"narrowInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"furtherInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLocales\": [\n 123\n ],\n \"audienceId\": [\n \"<string>\"\n ],\n \"excludedAudienceIds\": [\n \"<string>\"\n ],\n \"manualPlacements\": true,\n \"facebook_positions\": [\n \"<string>\"\n ],\n \"instagram_positions\": [\n \"<string>\"\n ],\n \"messenger_positions\": [\n \"<string>\"\n ],\n \"userDevices\": [\n \"<string>\"\n ],\n \"userOS\": [\n \"<string>\"\n ],\n \"campaignType\": \"<string>\",\n \"messagingApps\": [\n \"<string>\"\n ],\n \"multipleCreatives\": [\n {\n \"url\": \"<string>\",\n \"primaryText\": \"<string>\",\n \"headlines\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"image\": \"<string>\",\n \"video\": {\n \"video_id\": \"<string>\",\n \"thumbnail_url\": \"<string>\"\n },\n \"greetingText\": \"<string>\",\n \"conversations\": [\n {\n \"title\": \"<string>\"\n }\n ],\n \"callToAction\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.plai.io/meta/create_campaign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"<string>\",\n \"campaignName\": \"<string>\",\n \"status\": \"<string>\",\n \"budget\": 123,\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"url\": \"<string>\",\n \"specialAdCategories\": [\n \"<string>\"\n ],\n \"specialAdCountries\": [\n \"<string>\"\n ],\n \"utmParams\": \"<string>\",\n \"adSetName\": \"<string>\",\n \"gender\": \"<string>\",\n \"ages\": {\n \"minAge\": 123,\n \"maxAge\": 123\n },\n \"locations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"excludedLocations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"proximityTargeting\": [\n {\n \"countryName\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"radius\": 123\n }\n ],\n \"interests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"narrowInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"furtherInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLocales\": [\n 123\n ],\n \"audienceId\": [\n \"<string>\"\n ],\n \"excludedAudienceIds\": [\n \"<string>\"\n ],\n \"manualPlacements\": true,\n \"facebook_positions\": [\n \"<string>\"\n ],\n \"instagram_positions\": [\n \"<string>\"\n ],\n \"messenger_positions\": [\n \"<string>\"\n ],\n \"userDevices\": [\n \"<string>\"\n ],\n \"userOS\": [\n \"<string>\"\n ],\n \"campaignType\": \"<string>\",\n \"messagingApps\": [\n \"<string>\"\n ],\n \"multipleCreatives\": [\n {\n \"url\": \"<string>\",\n \"primaryText\": \"<string>\",\n \"headlines\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"image\": \"<string>\",\n \"video\": {\n \"video_id\": \"<string>\",\n \"thumbnail_url\": \"<string>\"\n },\n \"greetingText\": \"<string>\",\n \"conversations\": [\n {\n \"title\": \"<string>\"\n }\n ],\n \"callToAction\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"results": {
"success": true,
"campaign": {
"leadFormId": "<string>",
"campaignId": "<string>",
"adId": [
"<string>"
],
"adGroupId": "<string>"
},
"error": "<string>"
}
}Message Ads
Engagement Ad
This page is used to create a engagement goal campaign. Engagement ads are designed to get more interactions on your content, such as likes, comments, shares, event responses, or post saves on Meta platforms.
Engagement Ad
curl --request POST \
--url https://public.plai.io/meta/create_campaign \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"userId": "<string>",
"campaignName": "<string>",
"status": "<string>",
"budget": 123,
"startDate": "<string>",
"endDate": "<string>",
"url": "<string>",
"specialAdCategories": [
"<string>"
],
"specialAdCountries": [
"<string>"
],
"utmParams": "<string>",
"adSetName": "<string>",
"gender": "<string>",
"ages": {
"minAge": 123,
"maxAge": 123
},
"locations": [
{
"id": "<string>",
"type": "<string>",
"distance_unit": "<string>",
"radius": 123,
"countryCode": "<string>",
"countryName": "<string>"
}
],
"excludedLocations": [
{
"id": "<string>",
"type": "<string>",
"distance_unit": "<string>",
"radius": 123,
"countryCode": "<string>",
"countryName": "<string>"
}
],
"proximityTargeting": [
{
"countryName": "<string>",
"distance_unit": "<string>",
"latitude": "<string>",
"longitude": "<string>",
"radius": 123
}
],
"interests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"narrowInterests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"furtherInterests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"targetLocales": [
123
],
"audienceId": [
"<string>"
],
"excludedAudienceIds": [
"<string>"
],
"manualPlacements": true,
"facebook_positions": [
"<string>"
],
"instagram_positions": [
"<string>"
],
"messenger_positions": [
"<string>"
],
"userDevices": [
"<string>"
],
"userOS": [
"<string>"
],
"campaignType": "<string>",
"messagingApps": [
"<string>"
],
"multipleCreatives": [
{
"url": "<string>",
"primaryText": "<string>",
"headlines": "<string>",
"phoneNumber": "<string>",
"image": "<string>",
"video": {
"video_id": "<string>",
"thumbnail_url": "<string>"
},
"greetingText": "<string>",
"conversations": [
{
"title": "<string>"
}
],
"callToAction": "<string>"
}
]
}
'import requests
url = "https://public.plai.io/meta/create_campaign"
payload = {
"userId": "<string>",
"campaignName": "<string>",
"status": "<string>",
"budget": 123,
"startDate": "<string>",
"endDate": "<string>",
"url": "<string>",
"specialAdCategories": ["<string>"],
"specialAdCountries": ["<string>"],
"utmParams": "<string>",
"adSetName": "<string>",
"gender": "<string>",
"ages": {
"minAge": 123,
"maxAge": 123
},
"locations": [
{
"id": "<string>",
"type": "<string>",
"distance_unit": "<string>",
"radius": 123,
"countryCode": "<string>",
"countryName": "<string>"
}
],
"excludedLocations": [
{
"id": "<string>",
"type": "<string>",
"distance_unit": "<string>",
"radius": 123,
"countryCode": "<string>",
"countryName": "<string>"
}
],
"proximityTargeting": [
{
"countryName": "<string>",
"distance_unit": "<string>",
"latitude": "<string>",
"longitude": "<string>",
"radius": 123
}
],
"interests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"narrowInterests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"furtherInterests": [
{
"id": "<string>",
"name": "<string>",
"type": "<string>"
}
],
"targetLocales": [123],
"audienceId": ["<string>"],
"excludedAudienceIds": ["<string>"],
"manualPlacements": True,
"facebook_positions": ["<string>"],
"instagram_positions": ["<string>"],
"messenger_positions": ["<string>"],
"userDevices": ["<string>"],
"userOS": ["<string>"],
"campaignType": "<string>",
"messagingApps": ["<string>"],
"multipleCreatives": [
{
"url": "<string>",
"primaryText": "<string>",
"headlines": "<string>",
"phoneNumber": "<string>",
"image": "<string>",
"video": {
"video_id": "<string>",
"thumbnail_url": "<string>"
},
"greetingText": "<string>",
"conversations": [{ "title": "<string>" }],
"callToAction": "<string>"
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userId: '<string>',
campaignName: '<string>',
status: '<string>',
budget: 123,
startDate: '<string>',
endDate: '<string>',
url: '<string>',
specialAdCategories: ['<string>'],
specialAdCountries: ['<string>'],
utmParams: '<string>',
adSetName: '<string>',
gender: '<string>',
ages: {minAge: 123, maxAge: 123},
locations: [
{
id: '<string>',
type: '<string>',
distance_unit: '<string>',
radius: 123,
countryCode: '<string>',
countryName: '<string>'
}
],
excludedLocations: [
{
id: '<string>',
type: '<string>',
distance_unit: '<string>',
radius: 123,
countryCode: '<string>',
countryName: '<string>'
}
],
proximityTargeting: [
{
countryName: '<string>',
distance_unit: '<string>',
latitude: '<string>',
longitude: '<string>',
radius: 123
}
],
interests: [{id: '<string>', name: '<string>', type: '<string>'}],
narrowInterests: [{id: '<string>', name: '<string>', type: '<string>'}],
furtherInterests: [{id: '<string>', name: '<string>', type: '<string>'}],
targetLocales: [123],
audienceId: ['<string>'],
excludedAudienceIds: ['<string>'],
manualPlacements: true,
facebook_positions: ['<string>'],
instagram_positions: ['<string>'],
messenger_positions: ['<string>'],
userDevices: ['<string>'],
userOS: ['<string>'],
campaignType: '<string>',
messagingApps: ['<string>'],
multipleCreatives: [
{
url: '<string>',
primaryText: '<string>',
headlines: '<string>',
phoneNumber: '<string>',
image: '<string>',
video: {video_id: '<string>', thumbnail_url: '<string>'},
greetingText: '<string>',
conversations: [{title: '<string>'}],
callToAction: '<string>'
}
]
})
};
fetch('https://public.plai.io/meta/create_campaign', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public.plai.io/meta/create_campaign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'userId' => '<string>',
'campaignName' => '<string>',
'status' => '<string>',
'budget' => 123,
'startDate' => '<string>',
'endDate' => '<string>',
'url' => '<string>',
'specialAdCategories' => [
'<string>'
],
'specialAdCountries' => [
'<string>'
],
'utmParams' => '<string>',
'adSetName' => '<string>',
'gender' => '<string>',
'ages' => [
'minAge' => 123,
'maxAge' => 123
],
'locations' => [
[
'id' => '<string>',
'type' => '<string>',
'distance_unit' => '<string>',
'radius' => 123,
'countryCode' => '<string>',
'countryName' => '<string>'
]
],
'excludedLocations' => [
[
'id' => '<string>',
'type' => '<string>',
'distance_unit' => '<string>',
'radius' => 123,
'countryCode' => '<string>',
'countryName' => '<string>'
]
],
'proximityTargeting' => [
[
'countryName' => '<string>',
'distance_unit' => '<string>',
'latitude' => '<string>',
'longitude' => '<string>',
'radius' => 123
]
],
'interests' => [
[
'id' => '<string>',
'name' => '<string>',
'type' => '<string>'
]
],
'narrowInterests' => [
[
'id' => '<string>',
'name' => '<string>',
'type' => '<string>'
]
],
'furtherInterests' => [
[
'id' => '<string>',
'name' => '<string>',
'type' => '<string>'
]
],
'targetLocales' => [
123
],
'audienceId' => [
'<string>'
],
'excludedAudienceIds' => [
'<string>'
],
'manualPlacements' => true,
'facebook_positions' => [
'<string>'
],
'instagram_positions' => [
'<string>'
],
'messenger_positions' => [
'<string>'
],
'userDevices' => [
'<string>'
],
'userOS' => [
'<string>'
],
'campaignType' => '<string>',
'messagingApps' => [
'<string>'
],
'multipleCreatives' => [
[
'url' => '<string>',
'primaryText' => '<string>',
'headlines' => '<string>',
'phoneNumber' => '<string>',
'image' => '<string>',
'video' => [
'video_id' => '<string>',
'thumbnail_url' => '<string>'
],
'greetingText' => '<string>',
'conversations' => [
[
'title' => '<string>'
]
],
'callToAction' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public.plai.io/meta/create_campaign"
payload := strings.NewReader("{\n \"userId\": \"<string>\",\n \"campaignName\": \"<string>\",\n \"status\": \"<string>\",\n \"budget\": 123,\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"url\": \"<string>\",\n \"specialAdCategories\": [\n \"<string>\"\n ],\n \"specialAdCountries\": [\n \"<string>\"\n ],\n \"utmParams\": \"<string>\",\n \"adSetName\": \"<string>\",\n \"gender\": \"<string>\",\n \"ages\": {\n \"minAge\": 123,\n \"maxAge\": 123\n },\n \"locations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"excludedLocations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"proximityTargeting\": [\n {\n \"countryName\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"radius\": 123\n }\n ],\n \"interests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"narrowInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"furtherInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLocales\": [\n 123\n ],\n \"audienceId\": [\n \"<string>\"\n ],\n \"excludedAudienceIds\": [\n \"<string>\"\n ],\n \"manualPlacements\": true,\n \"facebook_positions\": [\n \"<string>\"\n ],\n \"instagram_positions\": [\n \"<string>\"\n ],\n \"messenger_positions\": [\n \"<string>\"\n ],\n \"userDevices\": [\n \"<string>\"\n ],\n \"userOS\": [\n \"<string>\"\n ],\n \"campaignType\": \"<string>\",\n \"messagingApps\": [\n \"<string>\"\n ],\n \"multipleCreatives\": [\n {\n \"url\": \"<string>\",\n \"primaryText\": \"<string>\",\n \"headlines\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"image\": \"<string>\",\n \"video\": {\n \"video_id\": \"<string>\",\n \"thumbnail_url\": \"<string>\"\n },\n \"greetingText\": \"<string>\",\n \"conversations\": [\n {\n \"title\": \"<string>\"\n }\n ],\n \"callToAction\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public.plai.io/meta/create_campaign")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"<string>\",\n \"campaignName\": \"<string>\",\n \"status\": \"<string>\",\n \"budget\": 123,\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"url\": \"<string>\",\n \"specialAdCategories\": [\n \"<string>\"\n ],\n \"specialAdCountries\": [\n \"<string>\"\n ],\n \"utmParams\": \"<string>\",\n \"adSetName\": \"<string>\",\n \"gender\": \"<string>\",\n \"ages\": {\n \"minAge\": 123,\n \"maxAge\": 123\n },\n \"locations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"excludedLocations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"proximityTargeting\": [\n {\n \"countryName\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"radius\": 123\n }\n ],\n \"interests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"narrowInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"furtherInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLocales\": [\n 123\n ],\n \"audienceId\": [\n \"<string>\"\n ],\n \"excludedAudienceIds\": [\n \"<string>\"\n ],\n \"manualPlacements\": true,\n \"facebook_positions\": [\n \"<string>\"\n ],\n \"instagram_positions\": [\n \"<string>\"\n ],\n \"messenger_positions\": [\n \"<string>\"\n ],\n \"userDevices\": [\n \"<string>\"\n ],\n \"userOS\": [\n \"<string>\"\n ],\n \"campaignType\": \"<string>\",\n \"messagingApps\": [\n \"<string>\"\n ],\n \"multipleCreatives\": [\n {\n \"url\": \"<string>\",\n \"primaryText\": \"<string>\",\n \"headlines\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"image\": \"<string>\",\n \"video\": {\n \"video_id\": \"<string>\",\n \"thumbnail_url\": \"<string>\"\n },\n \"greetingText\": \"<string>\",\n \"conversations\": [\n {\n \"title\": \"<string>\"\n }\n ],\n \"callToAction\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.plai.io/meta/create_campaign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"<string>\",\n \"campaignName\": \"<string>\",\n \"status\": \"<string>\",\n \"budget\": 123,\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"url\": \"<string>\",\n \"specialAdCategories\": [\n \"<string>\"\n ],\n \"specialAdCountries\": [\n \"<string>\"\n ],\n \"utmParams\": \"<string>\",\n \"adSetName\": \"<string>\",\n \"gender\": \"<string>\",\n \"ages\": {\n \"minAge\": 123,\n \"maxAge\": 123\n },\n \"locations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"excludedLocations\": [\n {\n \"id\": \"<string>\",\n \"type\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"radius\": 123,\n \"countryCode\": \"<string>\",\n \"countryName\": \"<string>\"\n }\n ],\n \"proximityTargeting\": [\n {\n \"countryName\": \"<string>\",\n \"distance_unit\": \"<string>\",\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"radius\": 123\n }\n ],\n \"interests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"narrowInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"furtherInterests\": [\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\"\n }\n ],\n \"targetLocales\": [\n 123\n ],\n \"audienceId\": [\n \"<string>\"\n ],\n \"excludedAudienceIds\": [\n \"<string>\"\n ],\n \"manualPlacements\": true,\n \"facebook_positions\": [\n \"<string>\"\n ],\n \"instagram_positions\": [\n \"<string>\"\n ],\n \"messenger_positions\": [\n \"<string>\"\n ],\n \"userDevices\": [\n \"<string>\"\n ],\n \"userOS\": [\n \"<string>\"\n ],\n \"campaignType\": \"<string>\",\n \"messagingApps\": [\n \"<string>\"\n ],\n \"multipleCreatives\": [\n {\n \"url\": \"<string>\",\n \"primaryText\": \"<string>\",\n \"headlines\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"image\": \"<string>\",\n \"video\": {\n \"video_id\": \"<string>\",\n \"thumbnail_url\": \"<string>\"\n },\n \"greetingText\": \"<string>\",\n \"conversations\": [\n {\n \"title\": \"<string>\"\n }\n ],\n \"callToAction\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"results": {
"success": true,
"campaign": {
"leadFormId": "<string>",
"campaignId": "<string>",
"adId": [
"<string>"
],
"adGroupId": "<string>"
},
"error": "<string>"
}
}Request Body
string
required
User ID, If not already created, make a user on create user
page first. If already created,
retrieve the user ID from get profile
page.
string
required
Descriptive name for the campaign
string
default:"PAUSED"
Status of the campaignSupported values are:
ACTIVE, PAUSEDnumber
required
Campaigns daily budget amount.
string
Start Date Format:
YYYY-MM-DD, use to schedule the campaign to start at a
specific date.string
End Date Format:
YYYY-MM-DD, use to schedule the campaign to end at a
specific date.string
required
Your Website URL
string[]
Special ad categories =
HOUSING, FINANCIAL_PRODUCTS_SERVICES,
EMPLOYMENTHOUSING: Ads related to property sales, rentals, or home-related services.FINANCIAL_PRODUCTS_SERVICES: Ads promoting credit cards, loans, insurance, or other financial services.
-EMPLOYMENT: Ads offering job opportunities or recruitment-related services.
string[]
Special Ad Countries is required if specialAdCategories is provided.
US,UKstring
UTM tracking parameters template, expected variables that can be used in it:
{{campaign.id}},{{adset.id}},{{ad.id}},{{campaign.name}},{{adset.name}},{{ad.name}}Targeting Parameters
string
Name of the ad set audience
string
If Special Ad Category is provided, then age targeting will be ignored.
1 for male, 2 for female, and if you want to target all
genders skip this parameterobject
object[]
required
The locations parameter must include only locations within the country specified in the
specialAdCountries field. For example, if you set specialAdCountries to US, then all locations added must be within the United States. Adding locations from other countries will result in an error.If Audience ID is provided, then location targeting is optional
Show Location Targeting Object
Show Location Targeting Object
string
required
Facebook location ID
string
required
Location types:
country, region, zip, country_group, neighborhood, citystring
Use Distance Unit when type is
citymile or km)number
Use Radius when type is
citystring
ISO 3166-1 alpha-2 country codes e.g:
US,UKstring
Country Name
object[]
Areas where you don’t want your ads to appear. Get excluded locations data
from here
object[]
Targets people within a specific radius of a location. You have to get the
proximity targeting data on your own.
object[]
object[]
object[]
boolean
default:false
Set to
false to use Advantage+ placements (recommended).If you set to
true, you have to provide facebook_positions,
instagram_positions, messenger_positionsstring[]
Facebook ad placements =
feed, right_hand_column, marketplace,
video_feeds, story, search, instream_video, facebook_reels,
facebook_reels_overlay, profile_feed, notificationstring[]
Instagram ad placements =
stream, story, explore, explore_home,
reels, profile_feed, ig_search, profile_reelsstring[]
Messenger ad placements =
messenger_home, storystring[]
Device targeting, you have to send the device name in string array, you can
get the list of devices from
here
Make sure to choose right operating system for the device.
- for eg. If the user device is iphone, then you have to send
iosin user operating system.
string[]
Operating system targeting, you have to send the os platform in string
array, you can get the list of operating systems from
here
Engagement Ads Parameters
string
required
For Engagement Goal, campaignType is
OUTCOME_ENGAGEMENTstring[]
required
Messaging apps =
MESSENGER, INSTAGRAM, WHATSAPPobject[]
- Atleast 1 creative is required.
- Maximum 10 creatives are allowed.
Show Multiple Creative Configuration
Show Multiple Creative Configuration
string
required
Destination URL
string
required
Primary Text
string
Headline
Headline max length is 255 characters. however, for non-English languages, the limit is determined by the number of bytes rather than the number of visible characters
string
Phone Number, e.g: +13434343434
string
Image URL is required if video is not provided
- Minimum Image Size: 400x400px
- Supported Aspect Ratios: 1:1, 16:9, 9:16
object
string
required
Greeting Text
- You can use placeholders like
{{user_first_name}},{{user_last_name}},{{user_full_name}}, and{{page_name}}to make your greeting more personal. - These will automatically fill in with the user’s or page’s name.
- For example: Hi,
{{user_first_name}}! Please let us know how we can help you.
string
required
Supported call to action types are:
SEND_MESSAGE, BOOK_NOW,
CONTACT_US, GET_PROMOTIONS, GET_QUOTE, INQUIRE_NOW, LEARN_MORE,
SHOP_NOW, SIGN_UP, SUBSCRIBE, ORDER_NOW, APPLY_NOWResponse
boolean
Indicates that the HTTP response was successful (status code 200 OK).
object
Show Results Object
Show Results Object
boolean
Indicates whether the specific operation or API action was
successful.
object
string
Error string if something went wrong