The `twitter-api-client` package, currently at version 1.6.1, provides a promise-based Node.js client for interacting with the Twitter API. It aims to cover approximately 90% of official Twitter API endpoints and offers full TypeScript typing for both query parameters and responses, along with an inbuilt in-memory cache to manage Twitter's rate limits effectively. While functional and actively maintained for bug fixes, the project has announced it will not receive further feature development. Developers are explicitly advised by the package maintainers to transition to the official Twitter API TypeScript SDK for new projects or ongoing development due to this package's maintenance-only status. This client was previously a robust community-driven alternative known for its ease of use and comprehensive API coverage.
npm install twitter-api-clientVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to initialize the TwitterClient with API credentials (using environment variables for security) and perform basic API calls like user search and trend discovery, including an example of cache configuration.
For new projects or active development, migrate to the official `twitter-api-sdk` package. This client will only receive critical bug fixes and security patches.
Ensure all four authentication parameters are correctly obtained from your Twitter Developer account and securely passed during `TwitterClient` instantiation. Verify that your app has the necessary permissions for the API endpoints you intend to use.
Utilize the client's `ttl` configuration for caching to reduce redundant requests. For high-volume applications, consider implementing more robust rate-limit handling, such as observing `x-rate-limit` headers in responses and introducing exponential backoff for retries.
Verify that your API Key, API Secret, Access Token, and Access Token Secret are accurately copied from your Twitter Developer Portal and passed to the `TwitterClient` constructor. Ensure there are no leading/trailing spaces or typos.
Configure the `ttl` option for the `TwitterClient` to enable the in-memory cache, reducing duplicate requests. Alternatively, pause or delay subsequent requests to adhere to Twitter's rate limit guidelines for the affected endpoint.
Consult the `REFERENCES.md` file in the project's GitHub repository to confirm the exact method names and their hierarchical structure. Ensure you are using the correct casing (e.g., `usersSearch` not `UsersSearch`).
No dependency data recorded yet.