GithubHelp home page GithubHelp logo

Comments (6)

josescasanova avatar josescasanova commented on April 23, 2024 6

You can use the FacebookAdsApiBatch API (https://github.com/facebook/facebook-nodejs-ads-sdk/blob/master/src/api-batch.js#L17)

FB docs: https://developers.facebook.com/docs/marketing-api/asyncrequests/v2.11 (See Batch Requests midway through)

You can probably do something like:

const batch = new FacebookAdsApiBatch(facebookApi);

batch.add(
  'GET',
  'path/to/request/campaign',
  campaignSettings,
);

batch.add(
  'GET',
  'path/to/request/adset',
  adsetSettings,
);

batch.add(
  'GET',
  'path/to/request/ad',
  adSettings,
);

const response = await batch.execute();

from facebook-nodejs-business-sdk.

roundrobin avatar roundrobin commented on April 23, 2024 6

@josescasanova How does the adset/ad knows it belongs to the campaign added earlier to the batch request?

from facebook-nodejs-business-sdk.

WilliSchmidt avatar WilliSchmidt commented on April 23, 2024 1

@josescasanova How does the adset/ad knows it belongs to the campaign added earlier to the batch request?

https://developers.facebook.com/docs/graph-api/making-multiple-requests/#multiple_methods

Specifying dependencies between operations in the request:

{result=(parent operation name):(JSONPath expression)}

Example:

curl \
   -F 'access_token=...' \
   -F 'batch=[{ "method":"GET","name":"get-friends","relative_url":"me/friends?limit=5",},{"method":"GET","relative_url":"?ids={result=get-friends:$.data.*.id}"}]' \
   https://graph.facebook.com/

from facebook-nodejs-business-sdk.

mishrakrishnakant avatar mishrakrishnakant commented on April 23, 2024

Wouldn't you just chain them up in a Promise chain?

from facebook-nodejs-business-sdk.

stale avatar stale commented on April 23, 2024

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

from facebook-nodejs-business-sdk.

stale avatar stale commented on April 23, 2024

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

from facebook-nodejs-business-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.