fa0311 / twitter-openapi-typescript

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

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

Closed darkmasta closed 1 month ago

darkmasta commented 4 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 3 months ago

Any news? 😕 @fa0311

fa0311 commented 1 month ago

This has been implemented

await client.getPostApi().postCreateTweet({
    tweetText: `Test[${time}]`,
    attachmentUrl: 'https://x.com/elonmusk/status/1349129669258448897',
    conversationControl: 'Community', // Community, Verified, ByInvitation
  });