【问题标题】:How to get INTERESTS in the "facebook-nodejs-business-sdk"如何在“facebook-nodejs-business-sdk”中获得兴趣
【发布时间】:2021-04-15 04:02:30
【问题描述】:

我正在开发一个应用程序来使用 facebook api,使用版本 v9.0 中的包“facebook-nodejs-business-sdk”。

我正在寻找获取兴趣的方法,但找不到。

我查看了包中提供的示例,但找不到任何可以让我搜索搜索节点的内容。

使用 graph api explorer 我可以看到使用 javascript 进行这些调用的代码如下:

FB.api( '/search','GET', {"type":"adinterest","q":"Golf","limit":"10000","locale":"pt_BR"}, function(response) { // Insert your code here } );

但应用程序正在使用提到的包,并且通常具有特定的调用方法。

我是编程初学者,所以我迷路了。

有人可以帮我吗?

谢谢!

【问题讨论】:

    标签: node.js npm facebook-graph-api facebook-marketing-api facebook-nodejs-business-sdk


    【解决方案1】:

    我在 SDK 中没有找到对此的任何引用,但您似乎可以通过以下示例自行调用 targeting search api

    const bizSdk = require('facebook-nodejs-business-sdk');
    
    const access_token = '<the_token>';
    
    const api = bizSdk.FacebookAdsApi.init(access_token);
    const showDebugingInfo = true; // Setting this to true shows more debugging info.
    if (showDebugingInfo) {
      api.setDebug(true);
    }
    
    const params = {
      'type' : 'adinterest',
      'q' : 'Golf',
      'limit' : '10000',
      'locale' : 'pt_BR',
    };
    
    api.call('GET',['search'], params).then((response) => {
      console.log(response)
    }).catch(error => {
      console.log("something bad happened somewhere", error);
    });
    

    此代码将输出如下内容:

    {
      data: [
        {
          id: '6003631859287',
          name: 'Golf',
          audience_size: 218921,
          path: [Array],
          description: null,
          disambiguation_category: 'Negócio local',
          topic: 'News and entertainment'
        },
        {
          id: '6003510075864',
          name: 'Golfe',
          audience_size: 310545288,
          path: [Array],
          description: '',
          topic: 'Sports and outdoors'
          ....
    

    希望有帮助

    【讨论】:

    • 哦,谢谢!不知道api.call这个方法,会很有用!!!非常感谢!!!
    猜你喜欢
    • 1970-01-01
    • 2022-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多