Facebook Ads Library for Node.js
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
README.md
package.json

README.md

Examples

var fbConfig = require('facebook-ads');

fbConfig.addConfig("default", {
	//Ads Account Id
	accountId: "<ACCOUNT_ID>",
	//Ads Account Access with whitelisted application
	accessToken: "<ACCESS_TOKEN>"
});

var fb = fbConfig.getInstance(/* "default" (optional)*/);

fb.getAdAccountStats(function(stats) {
	console.log(stats);
});

fb.getAdCampaigns(function(campaigns){
	campaign_id = campaigns.data[0].id;
	
	fb.createAdGroup({
		campaign_id: campaign_id,
		name: "Test Group Name",
		creative: {
			type: 9,
			object_id: 125772667501234
		},
		max_bid: 30,
		bid_type: 1,
		targeting: {
			countries: ['US']
		}
	}, function(adgroup) {
		console.log(adgroup);
	});
});

Methods

  • createAdCampaign(settings, cb)
  • createAdGroup(settings, cb)
  • createAdCreative(settings, cb)
  • getAdCampaigns(cb)
  • getAdGroups([account_id,] cb)
  • getAdCreatives(cb)
  • getAdCampaignStats(campaign_id, cb)
  • getAdGroupStats(adGroupId, cb)
  • getAdAccountStats([accountId,] cb)