Skip to main content

Installing the SDK

1

Install the SDK

bun add contiguity
2

Initialize the Client

import { Contiguity } from "contiguity";
const contiguity = new Contiguity("contiguity_sk_...your_key...");

Sending an email

Various email parameters can be configured in the Console such as tracking, custom domains, and more.Send with html, text, or both at the top level:
const res = await contiguity.email.send({
  to: ["user@example.com", "ops@example.com"],
  from: "Your App <no-reply@yourapp.com>",
  subject: "Welcome",
  html: "<p>Hello!</p>",
  text: "Hello!",
  reply_to: "support@yourapp.com",
  cc: "manager@example.com"
});

Response

email_id
string
Unique identifier for the sent email, used for tracking delivery status and analytics.
metadata
object
Request metadata including ID, timestamp, and API version.
For React Email (render a React component to HTML/text), use the top-level react option and see the JS SDK Email docs.

Parameters

email.send(params)

to
string | string[]
required
The recipient’s email address or an array of email addresses.
from
string
required
The sender’s email address. Can include a display name: "Your App <no-reply@yourapp.com>"
subject
string
required
The email subject line.
html
string
HTML version of the email (JS: top-level; Python: top-level). Use with text and/or react (JS) as needed.
text
string
Plain text version of the email.
react
ReactNode
JS only. A React Email component; the SDK renders it to HTML and plain text. See JS SDK Email.
body
object
JS only, deprecated. Use top-level html, text, and react instead. Still supported: body: { text?, html?, react? }.
reply_to
string
Email address for replies. If not specified, replies will go to the from address.
cc
string | string[]
Carbon copy recipients. Can be a single email address or an array of addresses.
bcc
string | string[]
Blind carbon copy recipients. Can be a single email address or an array of addresses.
headers
object[]
Custom email headers as an array of objects with name and value properties.