@fern-api/klaviyo v0.0.14
Klaviyo Node Library
The Klaviyo Node.js library provides access to the Klaviyo API from JavaScript/TypeScript.
Documentation
API reference documentation is available here.
Usage
import { KlaviyoClient } from '@fern-api/klaviyo';
const klaviyo = new KlaviyoClient({
apiKey: 'YOUR_API_KEY',
});
const profiles = await klaviyo.profiles.getProfileRelationshipsLists('01GDDKASAP8TKDDA2GRZDSVP4H')
console.log("Received response from klaviyo", response);
Handling Errors
All exceptions thrown by the SDK will sublcass KlaviyoError.
import { KlaviyoError } from "@fern-api/klaviyo";
try {
klaviyo.profiles.getProfileRelationshipsLists('01GDDKASAP8TKDDA2GRZDSVP4H')
} catch (err) {
if (err instanceof KlaviyoError) {
console.log(err.statusCode);
console.log(err.message);
console.log(err.body);
}
}
Request Options
You can optionally pass a request options argument to each method in the SDK. Below is an example on how to configure the HTTP timeout:
await client.profiles.getProfileRelationshipsLists('01GDDKASAP8TKDDA2GRZDSVP4H', {
timeoutInSeconds: 30, // HTTP timeout for this endpoint
})
Beta status
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your package.json file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributing
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!