OMX Logo
Documentation
Core SDK

OMX Core SDK Installation

Get started with the OMX Core SDK - the foundation for all OMX platform development.

Core SDK

Build with confidence

The OMX Core SDK provides essential utilities, authentication, and shared services for building robust applications with the OMX platform. It's the foundation that every OMX module depends on.

Installation & Setup
Get up and running with the Core SDK in just a few steps.
1

Install the package

Choose your preferred package manager

typescript
1# npm
2npm install @omx-sdk/core
3
4# yarn
5yarn add @omx-sdk/core
6
7# pnpm
8pnpm add @omx-sdk/core
2

Initialize the client

Set up your API credentials

typescript
1import { OMXClient } from '@omx-sdk/core';
2
3const omx = new OMXClient({
4 clientId: 'your_client_id',
5 secretKey: 'your_secret_key',
6 environment: 'production' // or 'sandbox'
7});
3

Start building

You're ready to use OMX features

typescript
1// The client is now ready to use
2console.log('OMX Client initialized successfully');

Core Features

Essential capabilities that power all OMX modules.

Authentication
Automatic API key management and secure authentication handling.
Environment Management
Seamless switching between development and production environments.
Error Handling
Comprehensive error handling with detailed error information.
TypeScript Support
Full type definitions for enhanced development experience.
Environment Configuration
Configure the SDK for different environments with advanced options.
typescript
1const omx = new OMXClient({
2 clientId: process.env.OMX_CLIENT_ID,
3 secretKey: process.env.OMX_SECRET_KEY,
4 environment: process.env.NODE_ENV === 'production' ? 'production' : 'sandbox',
5
6 // Optional configuration
7 timeout: 30000, // Request timeout in milliseconds
8 retries: 3, // Number of retry attempts
9 baseURL: 'https://api.omx.com/v1' // Custom API endpoint
10});
Authentication
The Core SDK handles all authentication automatically once initialized.
typescript
1// Authentication is handled automatically
2const isAuthenticated = await omx.auth.verify();
3console.log('Authentication status:', isAuthenticated);
4
5// Get current user info
6const user = await omx.auth.getCurrentUser();
7console.log('Current user:', user);
Error Handling
Robust error handling with specific error codes and messages.
typescript
1try {
2 const result = await omx.someMethod();
3} catch (error) {
4 if (error.code === 'UNAUTHORIZED') {
5 console.log('Authentication failed');
6 } else if (error.code === 'RATE_LIMITED') {
7 console.log('Rate limit exceeded');
8 } else {
9 console.log('Unexpected error:', error.message);
10 }
11}
TypeScript Usage
Leverage full type safety with TypeScript definitions.
typescript
1import { OMXClient, OMXConfig, OMXError } from '@omx-sdk/core';
2
3const config: OMXConfig = {
4 clientId: 'your_client_id',
5 secretKey: 'your_secret_key'
6};
7
8const omx = new OMXClient(config);
9
10// Types are automatically inferred
11omx.auth.getCurrentUser().then(user => {
12 console.log(user.id); // TypeScript knows this is a string
13});
Integration with Other Modules
Use the Core SDK as the foundation for all OMX modules.
typescript
1// Install additional modules
2npm install @omx-sdk/geotrigger @omx-sdk/email
3
4// Use with other modules
5import { GeoTrigger } from '@omx-sdk/geotrigger';
6import { Email } from '@omx-sdk/email';
7
8const geoTrigger = new GeoTrigger(omx);
9const email = new Email(omx);
10
11// Now you can use all features
12await geoTrigger.create({ /* trigger config */ });
13await email.send({ /* email config */ });