https://github.com/journy-io/js-sdk
π The official Node.js SDK that you can use to easily interact with our API
https://github.com/journy-io/js-sdk
nodejs sdk sdk-nodejs
Last synced: 10 months ago
JSON representation
π The official Node.js SDK that you can use to easily interact with our API
- Host: GitHub
- URL: https://github.com/journy-io/js-sdk
- Owner: journy-io
- License: mit
- Created: 2020-07-09T07:38:04.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-10-13T18:06:32.000Z (over 2 years ago)
- Last Synced: 2025-04-19T10:39:00.825Z (10 months ago)
- Topics: nodejs, sdk, sdk-nodejs
- Language: TypeScript
- Homepage: https://developers.journy.io
- Size: 631 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://journy.io/?utm_source=github&utm_content=readme-js-sdk)
# journy.io Node.js SDK
[](https://www.npmjs.com/package/@journyio/sdk)
[](https://www.npmjs.com/package/@journyio/sdk)
This is the official Node.js SDK for [journy.io](https://journy.io?utm_source=github&utm_content=readme-js-sdk).
## πΎ Installation
You can use your package manager (`npm` or `yarn`) to install the SDK:
```bash
npm install --save @journyio/sdk
```
or
```bash
yarn add @journyio/sdk
```
## π Getting started
### Import
To start, first import the client.
```ts
import { Client } from "@journyio/sdk";
```
### Configuration
To be able to use the journy.io SDK you need to generate an API key. If you don't have one you can create one in [journy.io](https://system.journy.io?utm_source=github&utm_content=readme-js-sdk).
If you don't have an account yet, you can create one in [journy.io](https://system.journy.io/register?utm_source=github&utm_content=readme-js-sdk) or [request a demo first](https://www.journy.io/book-demo?utm_source=github&utm_content=readme-js-sdk).
Go to your settings, under the *Connections*-tab, to create and edit API keys. Make sure to give the correct permissions to the API Key.
```ts
const client = Client.withDefaults("your-api-key");
```
If you want to use a custom [HttpClient](https://github.com/journy-io/http):
```ts
const http = new OwnHttpClientImplementation();
const client = new Client(http, { apiKey: "your-api-key" });
```
### Methods
#### Get API key details
```ts
const result = await client.getApiKeyDetails();
if (result.success) {
console.log(result.data.permissions); // string[]
console.log(result.callsRemaining); // number
}
```
### Handling errors
Every call will return a result, we don't throw errors when a call fails. We don't want to break your application when things go wrong. An exception will be thrown for required arguments that are empty or missing.
You can check whether the call succeeded using `result.success`:
```ts
const result = await client.getTrackingSnippet({
domain: "www.journy.io",
});
if (!result.success) {
console.log(result.error); // string
console.log(result.requestId); // string
}
await client.getTrackingSnippet({
domain: "", // empty string will throw
});
```
The request ID can be useful when viewing API logs in [journy.io](https://system.journy.io?utm_source=github&utm_content=readme-js-sdk).
## π¬ API Docs
[API reference](https://developers.journy.io)
## π― Tests
To run the tests:
```bash
npm run test
```
## β Help
We welcome your feedback, ideas and suggestions. We really want to make your life easier, so if weβre falling short or should be doing something different, we want to hear about it.
Please create an issue or contact us via the chat on our website.
## π Security
If you discover any security related issues, please email security at journy io instead of using the issue tracker.