FacebookAds.createAdSet()

create an ad set and the creative

return a paused campaign

Usage

Hover over inputs/exits for more info.

var FacebookAds = require('machinepack-facebookads');


// create an ad set and the creative

FacebookAds.createAdSet({

adAccount: '12314231231232',

fbUserId: '509503',

campaignGroupId: '3213213124',

fbPageId: '2313212421',

accessToken: 'CAACEdEose0cBACBhZA7DJbYapwM7oZBt1EWhPiGqibBZAZAZCZCe6IOkfDRzrs1jyZCS93zSuj9GaNQQtxbny0jeSCqyBNaQUl3ocDiD3lO4GSboFm5B7NogSHFzTGYw0rdpndDKolQcfsS5nYeYwZAIKXF1WPzgGaGxNIDh36oZBHuazcN3WSNmL9jGyO9YmYlZBmZCcigBuMFvtXj4XlzNWyb',

images: [ '1jk3l21', '1231231kjld123' ],

titles: [ 'this is a sample title', 'second sample title' ],

captions: [ 'test caption', 'second test caption' ],

url: 'http://www.example.com',

gender: 1,

locations: {},

interests: [],

age_min: '18',

age_max: '19',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

adAccount required

facebook user ad account

'12314231231232'
fbUserId required

facebook user id

'509503'
campaignGroupId required

woo campaign group id

'3213213124'
fbPageId required

fb page for the ad

'2313212421'
accessToken required

this is the facebook issued access token for a given user and app pair

'CAACEdEose0cBACBhZA7DJbYapwM7oZBt1EWhPiGqibBZAZAZCZCe6IOkfDRzrs1jyZCS93zSuj9GaNQQtxbny0jeSCqyBNaQUl3ocDiD3lO4GSboFm5B7NogSHFzTGYw0rdpndDKolQcfsS5nYeYwZAIKXF1WPzgGaGxNIDh36oZBHuazcN3WSNmL9jGyO9YmYlZBmZCcigBuMFvtXj4XlzNWyb'
images required

an array of image_hashes returned by facebook

[ '1jk3l21', '1231231kjld123' ]
titles required

an array of title strings

[ 'this is a sample title', 'second sample title' ]
captions required

an array of caption strings

[ 'test caption', 'second test caption' ]
url required

url target of the ad campaign

'http://www.example.com'
gender required

integer

1
locations required

a dictionary of locations

{}
interests required

an array of interests as strings

[]
age_min required

minimum age

'18'
age_max required

maximum age

'19'

Exits

error

An unexpected error occurred.

success

OK.