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?
Advertisement
Answer
You would use client.v2.userByUsername('handle');
and get the ID value from the response.