Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter Bookmarks API Endpoint #197

Open
ephraimduncan opened this issue May 16, 2022 · 1 comment
Open

Twitter Bookmarks API Endpoint #197

ephraimduncan opened this issue May 16, 2022 · 1 comment

Comments

@ephraimduncan
Copy link

How do I access the Twitter Bookmarks API endpoint with this library?

@rprend
Copy link

rprend commented Sep 18, 2022

Assuming you have an OAuth session with the relevant keys, this should work.

const search = async(req, res) => {
  const client = new Twitter({
          version: '2',
          consumer_key: process.env.CLIENT_ID,
          consumer_secret: process.env.CLIENT_SECRET,
          access_token_key: token.twitter.access_token,
          access_token_secret: token.twitter.refresh_token,
          extension: false,
      });
    try {
        const results = await client.get(`users/${token.sub}/bookmarks`);
  
        return res.status(200).json({
            status: 'Ok',
            data: results
        });
    } catch(e) {
        console.log("Error")
        console.dir(e, {depth: null, colors: true});
        return res.status(400).json(e);
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants