ant-in-pant
ant-in-pant

Reputation: 1

Making a Twitter Bot and keep getting Error Code 453

I'm trying to make a Twitter bot and using this article as my guide. I have:

  1. Signed up for a Twitter Developer account and created an App
  2. Changed the User authentication settings to the following:

First screen of user authentication settings

Second screen of user authentication settings

  1. (Having installed Node and Twit) I created a server.js file with the following contents:
const Twit = require( 'twit' ),

      fs = require( 'fs' ),
      path = require( 'path' ),
      config = require( path.join( __dirname, 'config.js' ) );

const T = new Twit( config );

T.post( 'statuses/update', { status: 'Look, I am tweeting!' }, function( err, data, response ) {
  console.log( data )
} );
  1. And a config.js file that looks like this (subbing out my codes with "XXX"):
const config = {
  consumer_key:         'XXX',
  consumer_secret:      'XXX',
  access_token:         'XXX',
  access_token_secret:  'XXX'
}

module.exports = config;

Finally, I ran my code with node server.js

What I got in response was the following error (and nothing was posted to my Twitter account):

    {
  errors: [
    {
      message: 'You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve',
      code: 453
    }
  ]
}

My understanding was that I do not need Elevated access to create a Bot like this. Am I wrong about that? Could it be something with my User authentication settings? Do I somehow need to include a Client ID?

Any advice is much appreciated!

Upvotes: 0

Views: 3024

Answers (1)

Mufaddal Hakim
Mufaddal Hakim

Reputation: 25

Twit uses api v1.1. Currently you have Essential Access which only gives you access to api v2. You can either apply for Elevated Access to use v1.1 or use another npm package for v2 like this one- https://www.npmjs.com/package/twitter-api-v2

Upvotes: 0

Related Questions