The `sailthru-client` is the official Node.js client library for interacting with the Sailthru REST API. It facilitates common operations such as sending emails, managing user profiles, and executing jobs, primarily communicating in JSON format. The current stable version is `5.0.5`. This library typically sees minor patch releases for bug fixes and dependency updates, with major version increments reserved for significant internal refactors or breaking changes in API interaction or environment requirements. Key differentiators include its direct integration with the Sailthru ecosystem, handling API authentication, rate limiting information, and supporting various HTTP methods including multipart uploads for tasks like importing user data. It's designed for server-side Node.js applications and has a clear focus on robust API interaction rather than front-end integration.
npm install sailthru-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Sailthru client with API credentials and optional proxy settings, then make an `apiPost` call to add a user's email to a specified list, including error handling.
Upgrade your Node.js runtime to version 18.14.0 or newer. Consider using a Node Version Manager (NVM) for easy switching.
Refactor client initialization: `createSailthruClient(apiKey, apiSecret, { agent: new ProxyAgent(proxyUrl), apiUrl: 'api.example.com' });`Ensure you are using `sailthru-client` version `5.0.1` or newer to avoid memory issues with large file uploads. If upgrading is not immediately possible, consider splitting large files or optimizing the upload process.
Upgrade `sailthru-client` to `v3.0.4` or newer to ensure compatibility with modern Node.js `fs` module behavior, especially for multipart job imports.
Adjust any custom logging parsers or debugging scripts that relied on the previous Node Util-based output format. Standard `console.log` output should now be expected.
Use CommonJS `require` syntax: `const sailthruClient = require('sailthru-client'); const sailthru = sailthruClient.createSailthruClient(apiKey, apiSecret);`Double-check your `SAILTHRU_API_KEY` and `SAILTHRU_API_SECRET` values against your Sailthru account. Ensure they are correctly configured in your environment variables or code. Verify API key permissions for the specific API calls being made.
Verify the `apiUrl` option. The default is `'api.sailthru.com'`. If you're using a custom API endpoint, ensure it is correct and resolvable. Check network connectivity to the API host.
This was a known issue in `v5.0.1`. Consider upgrading to `v5.0.4` or newer, as subsequent patch releases (like `v5.0.4` and `v5.0.5`) addressed issues related to `Sailthru Util` which could impact multipart requests.