Skip to main content

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.
    • Webhooks can be created without an app as well. Which we call global webhooks.
  • Messages are 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. api-key

Get the project ID

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

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 within an app

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

Creating a webhook without an app

const webhook = await vartiq.webhook.create({
  projectId: "PROJECT_ID",
  environmentId: "ENVIRONMENT_ID",
  url: "https://example.com",
  customHeaders: [{ key: "x-key", 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({ appId: "APP_ID"}, { 
  hello: "world" 
});

Have questions or need help with Vartiq?

Schedule a quick call with our team to get personalized support, feature walkthroughs, or technical guidance.