Requirements
Before you begin, ensure you have:- Node.js 18 or higher installed on your system
- A Contiguity account with access to the Console
- An API token from the Contiguity Console
Install the Package
Install the Contiguity SDK using your preferred package manager:- Full TypeScript definitions
- ESM module support
- Zod for runtime validation
- Optional React Email support for email templates
Get Your API Token
Sign up or log in
Visit console.contiguity.com and sign in to your account.
Create a new token
Click “Create API Key” or “Generate Token” to create a new API token.Your token will start with
contiguity_sk_ followed by a random string.Environment Setup
Using Environment Variables
The SDK automatically reads your API token from environment variables. This is the recommended approach for production applications.Create a .env file
In your project root, create a Or alternatively:
.env file:.env
.env
The SDK checks both
CONTIGUITY_API_KEY and CONTIGUITY_TOKEN. You only need to set one.Framework-Specific Setup
- Next.js
- Express
- Serverless Functions
- Bun
Next.js automatically loads environment variables from For server-side usage:
.env.local:.env.local
app/api/send/route.ts
Initialize the Client
There are three ways to initialize the Contiguity client:1. Using Environment Variables (Recommended)
CONTIGUITY_API_KEY or CONTIGUITY_TOKEN.
2. Passing Token Directly
3. With Configuration Options
Verify Your Setup
Test your installation and configuration with a simple script:test.ts
TypeScript Configuration
The SDK is built with TypeScript and includes full type definitions. For the best experience, ensure yourtsconfig.json includes:
tsconfig.json
Optional: React Email Support
If you want to use React components for email templates, install the peer dependency:Troubleshooting
Error: Contiguity token required
Error: Contiguity token required
This means the SDK can’t find your API token. Ensure:
- You’ve set
CONTIGUITY_API_KEYorCONTIGUITY_TOKENin your environment - Your
.envfile is in the correct location - You’re loading environment variables (with
dotenvor your framework’s loader) - Or pass the token directly to the constructor
Error: Invalid Contiguity token
Error: Invalid Contiguity token
Your token must start with
contiguity_sk_. If you’re seeing this error:- Check that you copied the full token from the Console
- Ensure there are no extra spaces or quotes around the token
- Verify you’re using a Secret Key (not a publishable key)
Module not found errors
Module not found errors
If you see module resolution errors:
- Ensure you’re using Node.js 18 or higher
- Check that your
package.jsonhas"type": "module"for ESM - Or use
.mjsextension for your files - For CommonJS, use
require()instead ofimport
TypeScript errors
TypeScript errors
If you’re getting TypeScript errors:
- Ensure
typescriptversion 5.0 or higher - Set
"moduleResolution": "bundler"or"node16"intsconfig.json - Run
npm installagain to ensure types are installed
Next Steps
Quickstart
Send your first message in 5 minutes
Text Messages
Learn about SMS and text messaging features
Send emails with templates and attachments
Core Features
Explore messaging features and capabilities

