ttezel / twit

Twitter API Client for node (REST & Streaming API)
4.31k stars 568 forks source link

[ { code: 170, message: ‘Missing required parameter: status.’ } ], twitterReply: { errors: [ [Object] ] }, statusCode: 403 } #505

Closed taku263 closed 5 years ago

taku263 commented 5 years ago

Hi, I’m trying to post a tweet. But I keep getting this error: message: 'Missing required parameter: status.', code: 170, allErrors: [ { code: 170, message: 'Missing required parameter: status.' } ], twitterReply: { errors: [ [Object] ] }, statusCode: 403 }

This is my Code

console.log('The bot is starting');

var Twit = require('twit');

var config = require('./config');
var T = new Twit(config);

var tweet = {
  staus: '....wait....'
}

T.post('statuses/update', tweet, tweeted);

function tweeted(err, data, response) {
  if (err) {
    console.log("Something Went wrong");
    console.log(err);
  } else {
     //console.log(data)
     console.log("it worked");
}
}

This is the config.js

    module.exports = {
    consumer_key:         'Consumer_Key',
    consumer_secret:      'Consumer_Secret',
    access_token:         'Access_Token',
    access_token_secret:  'Access_Token_secret',
    timeout_ms:           60*1000,  // optional HTTP request timeout to apply to all requests.
    strictSSL:            true,     // optional - requires SSL certificates to be valid.
 }
taku263 commented 5 years ago

Fixed #505 Hey, there was a typo in the code: you wrote "staus" instead of "status"

var tweet = {
  staus: '....wait....'
}
Should be:

var tweet = {
  status: '....wait....'
}