import { TwitterClient, createTwitterV2Client } from '@deepagent/twitter'// Requires Nango connection ID and callback URL environment variablesconst rawClient = await createTwitterV2Client()const twitter = new TwitterClient({ client: rawClient })const res = await twitter.createTweet({ text: 'hello, world'})
This example uses Nango for OAuth support via the createTwitterV2Client helper function, but you can pass any instance of the underlying TwitterV2Client to the TwitterClient constructor.
All TwitterClient methods are automatically throttled based on your Twitter API plan. You can set the twitter plan by setting the TWITTER_API_PLAN environment variable or by passing the twitterApiPlan parameter to the TwitterClient constructor.