fa0311 / twitter-openapi-typescript

Implementation of Twitter internal API (Twitter graphql API) in TypeScript
https://www.npmjs.com/package/twitter-openapi-typescript
Other
66 stars 9 forks source link

How to change who can reply to tweet? (reply_settings) #102

Open darkmasta opened 2 months ago

darkmasta commented 2 months ago

I need to create a tweet with reply_settings. Legacy client has this as shown below but I need to do this with twitter-openapi-typescript client. Can you add this feature @fa0311, please??🙏🙏🙏

const { TwitterApi } = require('twitter-api-v2');

const client = new TwitterApi({
  appKey: apiKey,
  appSecret: apiSecretKey,
  accessToken: accessToken,
  accessSecret: accessTokenSecret,
});

// Function to post a tweet with reply settings
async function postTweetWithReplySettings() {
  try {
    const tweet = await client.v2.tweet({
      text: 'This is a tweet with restricted replies!',
      reply_settings: 'mentionedUsers', // Options: 'everyone', 'mentionedUsers', 'following'
    });

    console.log('Tweet posted successfully:', tweet);
  } catch (error) {
    console.error('Error posting tweet:', error);
  }
}
darkmasta commented 2 months ago

Any news? 😕 @fa0311