Skip to content

Commit

Permalink
add app secret proof support
Browse files Browse the repository at this point in the history
  • Loading branch information
regevbr committed Jan 8, 2024
1 parent 3edb78d commit 5847b25
Show file tree
Hide file tree
Showing 17 changed files with 25,851 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 18
- name: Deploy
run: |
npm install
yarn install
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
npm publish
env:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ jobs:

strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run flow
- run: yarn install
- run: yarn flow
env:
CI: true
- run: yarn build
env:
CI: true
- run: yarn test
env:
CI: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.idea
# Runtime data
pids
*.pid
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ For now, we can use the <a href="https://developers.facebook.com/tools/explorer"
```javaScript
const adsSdk = require('facebook-nodejs-business-sdk');
const accessToken = '<VALID_ACCESS_TOKEN>';
const api = adsSdk.FacebookAdsApi.init(accessToken);
const appsecret_proof = '<VALID_APPSECRET_PROOF>'; //optional
const api = adsSdk.FacebookAdsApi.init(accessToken, appsecret_proof);
```

### Api main class
Expand Down Expand Up @@ -114,7 +115,8 @@ You can access object properties like this:
```javaScript
const adsSdk = require('facebook-nodejs-business-sdk');
const accessToken = '<VALID_ACCESS_TOKEN>';
const api = adsSdk.FacebookAdsApi.init(accessToken);
const appsecret_proof = '<VALID_APPSECRET_PROOF>'; //optional
const api = adsSdk.FacebookAdsApi.init(accessToken, appsecret_proof);
const AdAccount = adsSdk.AdAccount;
const Campaign = adsSdk.Campaign;
const account = new AdAccount('act_<AD_ACCOUNT_ID>');
Expand All @@ -140,7 +142,8 @@ account
```javascript
const adsSdk = require('facebook-nodejs-business-sdk');
const accessToken = '<VALID_ACCESS_TOKEN>';
const api = adsSdk.FacebookAdsApi.init(accessToken);
const appsecret_proof = '<VALID_APPSECRET_PROOF>'; //optional
const api = adsSdk.FacebookAdsApi.init(accessToken, appsecret_proof);
const AdAccount = adsSdk.AdAccount;
const account = new AdAccount('act_<AD_ACCOUNT_ID>');
account
Expand All @@ -159,7 +162,8 @@ Requesting an high number of fields may cause the response time to visibly incre
```javascript
const adsSdk = require('facebook-nodejs-business-sdk');
const accessToken = '<VALID_ACCESS_TOKEN>';
const api = adsSdk.FacebookAdsApi.init(accessToken);
const appsecret_proof = '<VALID_APPSECRET_PROOF>'; //optional
const api = adsSdk.FacebookAdsApi.init(accessToken, appsecret_proof);
const AdAccount = adsSdk.AdAccount;
const Campaign = adsSdk.Campaign;
const account = new AdAccount('act_<AD_ACCOUNT_ID>');
Expand All @@ -183,7 +187,8 @@ account
```javascript
const adsSdk = require('facebook-nodejs-business-sdk');
const accessToken = '<VALID_ACCESS_TOKEN>';
const api = adsSdk.FacebookAdsApi.init(accessToken);
const appsecret_proof = '<VALID_APPSECRET_PROOF>'; //optional
const api = adsSdk.FacebookAdsApi.init(accessToken, appsecret_proof);
const Campaign = adsSdk.Campaign;
const campaignId = <CAMPAIGN_ID>;
new Campaign(campaignId, {
Expand All @@ -197,7 +202,8 @@ new Campaign(campaignId, {
```javascript
const adsSdk = require('facebook-nodejs-business-sdk');
const accessToken = '<VALID_ACCESS_TOKEN>';
const api = adsSdk.FacebookAdsApi.init(accessToken);
const appsecret_proof = '<VALID_APPSECRET_PROOF>'; //optional
const api = adsSdk.FacebookAdsApi.init(accessToken, appsecret_proof);
const Campaign = adsSdk.Campaign;
const campaignId = <CAMPAIGN_ID>;
new Campaign(campaignId).delete();
Expand All @@ -213,7 +219,8 @@ Here the `Cursor` is a superpowered `Array` (with all it's native helpful operat
```javascript
const adsSdk = require('facebook-nodejs-business-sdk');
const accessToken = '<VALID_ACCESS_TOKEN>';
const api = adsSdk.FacebookAdsApi.init(accessToken);
const appsecret_proof = '<VALID_APPSECRET_PROOF>'; //optional
const api = adsSdk.FacebookAdsApi.init(accessToken, appsecret_proof);
const AdAccount = adsSdk.AdAccount;
const Campaign = adsSdk.Campaign;
const account = new AdAccount('act_<AD_ACCOUNT_ID>');
Expand Down Expand Up @@ -246,7 +253,8 @@ If you are using cursor to iterate all of your object under your Ad Account, thi
```javascript
const adsSdk = require('facebook-nodejs-ads-sdk');
const accessToken = '<VALID_ACCESS_TOKEN>';
const api = adsSdk.FacebookAdsApi.init(accessToken);
const appsecret_proof = '<VALID_APPSECRET_PROOF>'; //optional
const api = adsSdk.FacebookAdsApi.init(accessToken, appsecret_proof);
const AdAccount = adsSdk.AdAccount;
const account = new AdAccount('act_<AD_ACCOUNT_ID>');

Expand All @@ -268,7 +276,8 @@ A `FacebookAdsApi` object offers a debugging mode that will log all requests. To
```javascript
const adsSdk = require('facebook-nodejs-business-sdk');
const accessToken = '<VALID_ACCESS_TOKEN>';
const api = adsSdk.FacebookAdsApi.init(accessToken);
const appsecret_proof = '<VALID_APPSECRET_PROOF>'; //optional
const api = adsSdk.FacebookAdsApi.init(accessToken, appsecret_proof);
api.setDebug(true);
```

Expand Down
2 changes: 1 addition & 1 deletion __tests__/batch-processor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

'use strict';
const {BatchProcessor, Content, CustomData, DeliveryCategory} = require('facebook-nodejs-business-sdk');
const {BatchProcessor, Content, CustomData, DeliveryCategory} = require('../');



Expand Down
2 changes: 1 addition & 1 deletion __tests__/content.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

'use strict';
const {Content, DeliveryCategory} = require('facebook-nodejs-business-sdk');
const {Content, DeliveryCategory} = require('../');


describe('Content', function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/custom-data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

'use strict';
const {Content, CustomData, DeliveryCategory} = require('facebook-nodejs-business-sdk');
const {Content, CustomData, DeliveryCategory} = require('../');


describe('CustomData', function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/event-request.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
HttpServiceClientConfig,
ServerEvent,
UserData,
} = require('facebook-nodejs-business-sdk');
} = require('../');


describe('EventRequest', function() {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/signal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

'use strict';
const { SignalUserData, SignalContent, SignalCustomData, SignalEvent, DeliveryCategory } = require('facebook-nodejs-business-sdk');
const { SignalUserData, SignalContent, SignalCustomData, SignalEvent, DeliveryCategory } = require('../');
const sha256 = require('js-sha256');


Expand Down
2 changes: 1 addition & 1 deletion __tests__/user-data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

'use strict';
const {UserData} = require('facebook-nodejs-business-sdk');
const {UserData} = require('../');
const sha256 = require('js-sha256');


Expand Down
2 changes: 1 addition & 1 deletion __tests__/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'use strict';

const { ServerSideUtils } = require('facebook-nodejs-business-sdk');
const { ServerSideUtils } = require('../');
const sha256 = require('js-sha256');


Expand Down
Loading

0 comments on commit 5847b25

Please sign in to comment.