Panne partielleshare-external
Facebook NodeJS Business SDK: How to have types/intellisense?
1

I'm currently getting started with the facebook-nodejs-business-sdk. I'm trying to retrieve one campaign by ID.

However, I'm not having types/intellisense which makes it hard to consume the API as someone who doesn't have experience with it.

This is my approach:

const campaign = await account.getCampaigns([Campaign.Fields.name, Campaign.Fields.id], {
    filtering: [{ field: "id", operator: 'EQUAL', value: "12345" }]
}).then(campaigns => { return campaigns[0]._data })

console.log('no intellisense for "id"', campaign.id)
console.log('no intellisense for "name"', campaign.name)

Is there a way to have intellisense? I also installed the package @types/facebook-nodejs-business-sdk but not sure how to use it in my example.

I appreciate any advice. Thank you.

Phillip
Posée il y a environ 9 mois
Phillip

EDIT: I found a better approach, however, it doesn't give me types either:

const campaign = await (new Campaign(campaignId)).get([ 'id', 'name', 'ads{adset_id,name,leadgen_forms{id,name}}', ]);

11 mars, 17:54