Developer SDK

Overview

Ogmara provides a JavaScript/TypeScript SDK for building applications, bots, and widgets that interact with the Ogmara network. The SDK handles node communication, message signing, and data retrieval so you can focus on your application logic.

The SDK is open source. Full documentation and source code are available on GitHub: github.com/Ogmara/sdk-js

Installation

Install the SDK via npm:

npm install @ogmara/sdk

Quick Start

Connect to a node, list channels, and send a message in just a few lines:

import { OgmaraClient } from '@ogmara/sdk';

const client = new OgmaraClient({ nodeUrl: 'https://your-node.example.com' });
await client.connect();

// List available channels
const channels = await client.getChannels();
console.log(channels);

// Send a message to a channel
await client.sendMessage({
  channelId: 'general',
  text: 'Hello from the SDK!'
});

Embeddable Widget

You can embed an Ogmara chat widget into any website. The widget connects to a specified node and channel, giving your visitors a live chat experience powered by the decentralized network. See the SDK repository for widget configuration options and usage examples.

REST API Overview

Every Ogmara L2 node exposes a REST API at /api/v1/. You can use these endpoints directly if you prefer raw HTTP requests over the SDK.

Key Endpoints

Method Endpoint Description
GET /api/v1/health Node health check
GET /api/v1/channels List all channels
GET /api/v1/news Retrieve news feed posts
GET /api/v1/network/stats Network statistics
WS /api/v1/ws WebSocket for real-time messages and events

Full Documentation

For complete API reference, authentication details, message signing, and advanced usage, visit the SDK repository on GitHub: github.com/Ogmara/sdk-js

All Tutorials