twitter-openapi-typescript
twitter-openapi-typescript copied to clipboard
How to change who can reply to tweet? (reply_settings)
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);
}
}