Reputation: 1569
I am trying to tweet using this sample program and getting an error I am following this tutorial
Here is the code
var Twitter = require('twitter');
var client = new Twitter({
consumer_key: 'CONSUMER_KEY',
consumer_secret: 'CONSUMER_SECRET',
access_token: 'ACCESS_TOKEN',
access_token_secret: 'ACCESS_TOKEN_SECRET'
});
//var stat = ["First Tweet","Second Tweet","Third Tweet","Forth Tweet","Fifth Tweet"];
client.post('statuses/update', {status: 'I Love Twitter'}, function(error, tweet, response){
if(error) throw error;
console.log(tweet); // Tweet body.
console.log(response); // Raw response object.
});
whenever i run this code i receive following error
E:\Local server\nodejs\status_update\test.js:12
if(error) throw error;
^
[object Object]
Upvotes: 1
Views: 148
Reputation: 26
try it this way. Fixed mine.
client.post('statuses/update', {status: "words"}, function(error, tweet, response){
if (!error) {
console.log(tweet);
}
});
Upvotes: 1