Operational

DocsGithub Open app

Operational

Github Articles Pitch Usecases Playground API

Contents

Start here
Setup
Get started Send your first event Structured Events Actions Contexts Log limits and errors
Events API
API
Error handling Event parametersPOST Log event Sending actions in events
The Manual
Introduction PWA & push notifications Conventions Setup Manage projects and teammates Categories and search View events in your project Setup PWA on phone Test mode Notifications
Integrations
Nodejs SDK PHP SDK Wordpress plugin
Self hosting
Introduction Install locally Install on VPS Install on Render Install via Docker Install via Docker and Coolify Onboarding Setup .env Setup PWA & push notifications Best practices Durability testing
Other
Vision Roadmap Contributing

Nodejs SDK

Installation

Use npm to install Operational’s nodejs SDK. Run this inside your project:

npm install --save-exact @operational.co/sdk

Initialize SDK

Pass your API key to the constructor:

import Operational from "@operational.co/sdk"
// Or use this if you're on a older version of nodejs
// const Operational = require('@operational.co/sdk')

const apikey = ''; // <-- Enter your api key here

const ops = new Operational(apikey);

Constructor options

You can pass baseUrl, test, and debug as constructor options.

import Operational from "@operational.co/sdk";

const ops = new Operational("API_KEY", {
  baseUrl: "https://api.operational.co", // optional
  test: false, // optional, when true events are sent as test events
  debug: true, // optional, logs SDK errors to console
});

events.ingest(event)

This is the main SDK function for sending events.

import Operational from "@operational.co/sdk";

const ops = new Operational("API_KEY");

await ops.events.ingest({
  name: "user signed up",
  avatar: "✅",
  category: "auth",
  content: "New signup from landing page",
});

You can also send structured rows:

await ops.events.ingest({
  name: "payment failed",
  type: "rows",
  category: "billing",
  content: [
    { label: "Invoice", content: "inv_2044" },
    { label: "Amount", content: "$39.00" },
    { label: "Reason", content: "card_declined" },
  ],
});

Complete example

import Operational from "@operational.co/sdk";

const ops = new Operational("API_KEY", {
  debug: true,
});

await ops.events.ingest({
  name: "server started",
  category: "server",
  content: "api-west-2 booted",
});

Related docs

  1. Log event API
  2. Event parameters
  3. Playground

For self hosters

Pass your backend’s url when initiating the Operational class.

const ops = new Operational(apikey, {
  baseUrl : 'https://xzy.abc.com' // <- Enter your backend's url here.
})

You can find this url inside your self hosted instance’s profile page under your api key.

PHP SDK

Operational

PrivacyTerms
About the product
  • Use cases
  • Playground
  • API
  • Pitch
  • Pricing
  • Wordpress plugin
Related to the product
  • Open Source
  • Articles
  • VS Logsnag
Useful articles for your SaaS
  • My experience running a Commercial OSS project
  • Force post: The Payment Hack that lets Merchants charge you without approval
  • 6 Best practices for early stage B2B SaaS customer support
  • Setup event notifications for your SaaS