The official Node SDK for Jiter
npm i @jiter/node
# or
yarn add @jiter/node
import Jiter, { JiterConfig } from '@jiter/node';
const config: JiterConfig = { apiKey: 'YOUR_API_KEY' };
Jiter.init(config);
🔐 Do not to include your API key in code; use a package like dotenv
to securely load your token via process.env
JavaScript example
const Jiter = require('@jiter/node');
Jiter.init({ apiKey: 'YOUR_API_KEY' });
const fifteenMinutesFromNow = new Date(Date.now() + 1000 * 60 * 15);
try {
const createdEvent = await Jiter.Events.createEvent({
destination: `${YOUR_API_URL}/webhooks/jiter`,
payload: 'Hello there!',
scheduledTime: fifteenMinutesFromNow.toISOString(),
});
console.log(createdEvent);
} catch (error) {
if (isJiterError(error)) {
console.log(`${error.code} - ${error.response?.data}`);
} else {
console.error(error);
}
}