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
Asked about 4 months ago
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}}', ]);

March 11 at 5:54 PM