So when I use twurl ...
twurl -H "https://ads-api.twitter.com" "/2/accounts/<myaccountnumber>"
I get the correct response back with all the information about said ads account. This, i assume, means i'm good to go on all account authorization/whitelisting on twitter's side of things. yes? That my ads account and my app are tied together properly?
When I run the code example on https://github.com/FallenTech/twitter-ads
var TwitterAdsAPI = require('twitter-ads');
var T = new TwitterAdsAPI({
consumer_key: 'XXX',
consumer_secret: 'XXX',
access_token: 'XXX',
access_token_secret: 'XXX'
});
T.get('accounts/:account_id', {account_id: 'XXX'}, function(error, resp, body) {
if (error) return console.error(error);
console.log(body);
});
I get
{ code: 'NOT_FOUND',
message: 'Account <myaccountnumber> was not found' }
What step am I missing here? When i authorized twurl i only used consumer-key and consumer-secret.
I have also tried...
T.get('accounts/:account_id', {account_id: 'XXX', sandbox: false, api_version: '2'}, function(error, resp, body) {
if (error) return console.error(error);
console.log(body);
});
Thanks in advance.
You need to specify the flags sandbox: false
and api_version: '2'
in your TwitterAdsAPI configuration, and not as part of the object of your second argument in your T.get
function as you specified you did in your code snippet. See example below:
var TwitterAdsAPI = require('twitter-ads');
var T = new TwitterAdsAPI({
consumer_key: 'XXX',
consumer_secret: 'XXX',
access_token: 'XXX',
access_token_secret: 'XXX',
sandbox: false,
api_version: '2'
});
T.get('accounts/:account_id', {account_id: 'XXX'}, function(error, resp, body) {
if (error) return console.error(error);
console.log(body);
});