Node.js
Introduction
Get started with Sendable in Node.js applications.
Prerequisites
- Node.js 18 or higher
- A Sendable account with an active session
- An API key from your dashboard
Installation
Install the official TypeScript SDK:
npm install @sendable-dev/sdkBasic Setup
Create a .env file:
SENDABLE_API_KEY=your_api_key_here
SENDABLE_API_URL=https://api.sendable.devQuick Example
import { Sendable } from '@sendable-dev/sdk'
const sendable = new Sendable({
apiKey: process.env.SENDABLE_API_KEY!,
apiKeyScope: 'session',
baseUrl: process.env.SENDABLE_API_URL,
})
export async function sendMessage(chatId: string, text: string) {
return sendable.messages.send({
chatId,
text: { content: text },
})
}
// Usage
await sendMessage('[email protected]', 'Hello from Node.js!')Available Guides
- TypeScript SDK - Install and use the official SDK
- Next.js Integration - Full-stack Next.js app with Sendable
- Express Integration - REST API with Express and Sendable
Environment Variables
| Variable | Required | Description |
|---|---|---|
SENDABLE_API_KEY | Yes | Your session API key |
SENDABLE_API_URL | No | API base URL (default: https://api.sendable.dev) |
SENDABLE_WEBHOOK_SECRET | No | For verifying webhooks |