A simple wrapper for Twitter Ads & TON API in NodeJS.
Installation
$ npm install twitter-ads
Usage
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);
});
T.tonUpload({
file: './test.txt',
content_type: 'text/plain',
bucket_name: 'ta_partner'
},
function(error, location) {
if (error) return console.error(error);
console.log(location);
});
T.tonDownload({
file: './test.txt',
url: 'https://ton.twitter.com/1.1/ton/bucket/ta_partner/2892314386/n3UPAcC02roTP6C'
},
function(error, size) {
if (error) return console.error(error);
console.log(size);
});
Additional Configurables
- sandbox (Boolean) - (Default: true) - Uses sandbox API host.
- api_version (String) - (Default: 2) - Ads API version to use.