Samva

Quickstart Guide

Send your first email with Samva in 5 minutes

Get up and running with Samva's messaging platform in just a few minutes.

Prerequisites

Before you begin, make sure you have:

  • A Samva account (sign up at samva.app/signup)
  • Node.js 18+ installed (for TypeScript SDK)

Step 1: Get Your API Key

  1. Log in to your Samva Dashboard
  2. Navigate to Developers → API Keys
  3. Click Create API Key
  4. Copy your API key and keep it secure

Security Tip: Never commit API keys to version control. Use environment variables instead.

Step 2: Install the SDK

Choose your preferred method:

bash npm install samva
bash bun add samva
bash yarn add samva

Step 3: Initialize the Client

import { createSamvaClient } from "samva";

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

Step 4: Send Your First Email

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

console.log("Email sent:", response.data?.messageId);

Step 5: Check Message Status

// Get message status
const message = await samva.messages.get({
  path: { id: response.data?.messageId! },
});

console.log("Delivery status:", message.data?.status);
// Possible values: pending, processing, sent, delivered, failed

Using REST API

If you prefer using the REST API directly:

# Send email via REST API
curl -X POST https://api.samva.app/v1/email/send \
  -H "X-API-Key: sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "user@example.com",
    "subject": "Welcome to Samva",
    "html": "<h1>Welcome!</h1><p>Thanks for joining Samva.</p>",
    "text": "Welcome! Thanks for joining Samva."
  }'

Next Steps

Common Issues

Invalid Email Address

Error: Invalid email address format

Solution: Ensure the email address is properly formatted (e.g., user@example.com).

Domain Not Verified

Error: Sender domain not verified

Solution: Verify your sending domain in the dashboard under Email → Domains.

Insufficient Credits

Error: Insufficient credits in wallet

Solution: Top up your credits in the Billing Dashboard.

Support

Need help? We're here for you:

On this page