Samva
SDKs & Tools

SDKs & Tools

Official SDKs and developer tools for Samva API

Samva provides official SDKs and tools to make integration quick and easy.

OpenAPI-First: All SDKs are auto-generated from our OpenAPI specification for consistency.

Official SDKs

Developer Tools

Quick Installation

TypeScript/JavaScript

# npm
npm install samva

# yarn
yarn add samva

# bun
bun add samva

Quick Start Example

import { createSamvaClient } from "samva";

const samva = createSamvaClient({
  apiKey: process.env.SAMVA_API_KEY!,
});

// Send email
await samva.email.send({
  body: {
    to: "user@example.com",
    subject: "Welcome to Samva",
    html: "<h1>Welcome!</h1><p>Thanks for joining.</p>",
    text: "Welcome! Thanks for joining.",
  },
});

// Send SMS
await samva.sms.send({
  body: {
    to: "+14155552671",
    message: "Your verification code is 123456",
  },
});

Features

Type Safety

The SDK provides full type safety with auto-completion:

import { createSamvaClient } from "samva";

const samva = createSamvaClient({
  apiKey: process.env.SAMVA_API_KEY!,
});

// TypeScript knows all available options
const response = await samva.email.send({
  body: {
    to: "user@example.com", // Fully typed
    subject: "Hello", // IDE shows all required fields
    html: "<p>Hi!</p>",
  },
});

Error Handling

Consistent error handling:

const response = await samva.email.send({
  body: { to: "user@example.com", subject: "Hi", text: "Hello" },
});

if (response.error) {
  console.error("Error:", response.error);
} else {
  console.log("Sent:", response.data);
}

Webhook Verification

Verify webhook signatures to ensure authenticity:

import crypto from "crypto";

function verifyWebhook(payload: string, signature: string, secret: string) {
  const hmac = crypto.createHmac("sha256", secret);
  const digest = hmac.update(payload).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(digest));
}

SDK Generation

Our TypeScript SDK is generated from the OpenAPI specification using @hey-api/openapi-ts.

This ensures:

  • ✅ Always up-to-date with API
  • ✅ Complete API coverage
  • ✅ Full type safety

Other Languages

For Python, Go, Java, PHP, Ruby, or any other language, use our REST API with your language's HTTP client. The REST API provides full access to all Samva features.

Building a community SDK? Let us know at sdk@samva.app

Testing

The SDK supports test mode with test API keys:

import { createSamvaClient } from "samva";

const samva = createSamvaClient({
  apiKey: "sk_test_your_test_key", // Test keys start with sk_test_
});

// Test mode features:
// - No charges
// - Simulated delivery
// - Test phone numbers
// - Webhook testing

Support Matrix

SDKStatusVersionMin Runtime
TypeScript✅ Stable1.0.0Node 18+
REST API✅ Stablev1Any HTTP client

Contributing

Want to contribute to our SDKs?

  1. Check our GitHub
  2. Read contribution guidelines
  3. Submit pull requests
  4. Report issues

Next Steps

On this page