Skip to content
  • sdk
  • cli
  • api

Send email from TypeScript or your terminal

Install the samva package or the CLI to send email and manage domains and templates, and verify signed webhooks with @samva/webhooks.

Send email from your app with the TypeScript SDK, or from a shell with the CLI. Both call the same public API, so what you send from code matches what you send from the CLI.

import { createClient } from "samva";

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

await samva.messages.send({
  channel: "email",
  to: [{ email: "ada@example.com" }],
  email: { subject: "Welcome", html: "<p>You're in.</p>" },
});
npm install -g @samva/cli
samva email send --to ada@example.com --subject "Welcome" --text "You're in."

A service that only receives webhooks can install @samva/webhooks by itself to verify signatures, no SDK needed.