Concepts

Vartiq has three main concepts:

  • Apps represents your customer. Create one app per customer.
  • Webhooks are the URLs that receive the webhooks. Each app can have multiple webhooks.
  • Messages are the the data that is sent to the webhooks.

Install the SDK

npm i vartiq
// or
bun add vartiq
// or
pnpm add vartiq

Get the API Key

Get the API key from the Vartiq dashboard.

Get the project ID

You can have multiple projects in your account. Get the project ID from the project settings

Initialize the SDK

import { Vartiq } from 'vartiq';

const vartiq = new Vartiq("YOUR_API_KEY");

Creating an App

const app = await vartiq.app.create({
  name: "App name", // setting this to the name or id of your customer is recommended
  projectId: "PROJECT_ID",
});

Creating a Webhook

const webhook = await vartiq.webhook.create({
  url: "https://example.com",
  appId: "APP_ID",
  customHeaders: [{ key: "x-app", value: "x-value" }], // optional
});

Sending a Message

Sending a message to a app(your customer) will send the message to all the webhooks associated with the app.

const message = await vartiq.webhook.message.create("APP_ID", { 
    hello: "world" 
});

Concepts

Vartiq has three main concepts:

  • Apps represents your customer. Create one app per customer.
  • Webhooks are the URLs that receive the webhooks. Each app can have multiple webhooks.
  • Messages are the the data that is sent to the webhooks.

Install the SDK

npm i vartiq
// or
bun add vartiq
// or
pnpm add vartiq

Get the API Key

Get the API key from the Vartiq dashboard.

Get the project ID

You can have multiple projects in your account. Get the project ID from the project settings

Initialize the SDK

import { Vartiq } from 'vartiq';

const vartiq = new Vartiq("YOUR_API_KEY");

Creating an App

const app = await vartiq.app.create({
  name: "App name", // setting this to the name or id of your customer is recommended
  projectId: "PROJECT_ID",
});

Creating a Webhook

const webhook = await vartiq.webhook.create({
  url: "https://example.com",
  appId: "APP_ID",
  customHeaders: [{ key: "x-app", value: "x-value" }], // optional
});

Sending a Message

Sending a message to a app(your customer) will send the message to all the webhooks associated with the app.

const message = await vartiq.webhook.message.create("APP_ID", { 
    hello: "world" 
});