Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Facebook Ads Library for Node.js
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

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)
Something went wrong with that request. Please try again.