Home > Mobile >  How to get retrieve twitter user id from twitter handle using the twitter v2 API
How to get retrieve twitter user id from twitter handle using the twitter v2 API

Time:07-30

I am currently using the twitter v2 API, using the following npm package link

const tweets = await client.v2.userTimeline(userId, { exclude: 'replies' });

I require the userID and not the twitter handle for this command.

How would I be able to get the twitter user id from the twitter handle using the twitter API?

CodePudding user response:

You would use client.v2.userByUsername('handle'); and get the ID value from the response.

  • Related