Using the wrapper
Create an API instance using the factory function
const { twitterApi } = require("@techcityventures/twitter-api)
const twitter= twitterApi({
apiKey:"key",
apiSecret:"secretsecretsecret",
bearerToken:"XYZ"
})
Usage
- Search tweets
- Users lookup
try {
const res = await twitter.usersLookup({
ids:"1525752132",
expansions:"pinned_tweet_id",
"tweet.fields":"attachments,author_id,context_annotations,conversation_id,created_at,entities,geo,id,in_reply_to_user_id,lang,possibly_sensitive,public_metrics,referenced_tweets,source,text,withheld",
"user.fields":"created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld"
})
console.log(res)
} catch (error) {
console.log(error)
}