twitter bot media and post using twitter-sdk

Viewed 20

Im building a bot and using twitter's sdk. Im not understanding why I need a callback on the bot when the bot itself is posting? It isn't posting on behalf on any other users. I've retrieved the Access Token and Secret from the twitter dashboard for the app. What am I missing? or the bot still needs a callback?

const { Client, auth } =require("twitter-api-sdk");

const {TWITTER_ACCESS_SECRET, TWITTER_ACCESS_TOKEN, TWITTER_CLIENT_ID, TWITTER_CLIENT_SECRET}=process.env;
    const authClient = new auth.OAuth2User({
        client_id: TWITTER_CLIENT_ID,
        client_secret: TWITTER_CLIENT_SECRET,
        access_token: TWITTER_ACCESS_TOKEN,
        access_token_secret: TWITTER_ACCESS_SECRET,
        scopes: ["tweet.read", "tweet.write", "users.read", "media"],
      });

    const client = new Client(authClient);

    // it is saying need access token
    await client.tweets.createTweet({text: "Are you excited for the weekend?",})
0 Answers
Related