Skip to main content

Install

Initialize

The client automatically reads MESSAGES_API_KEY from your environment. To pass a key explicitly:

Send a message

Receive messages via webhooks

Create a webhook from the Webhooks page in your dashboard and copy the signing secret. Then handle incoming events on your server:
If the signature is invalid, verifyWebhook throws a SignatureVerificationError.

List messages

Reactions

Typing indicators

Read receipts

Files

Upload files to send as message attachments:

Delivery tracking

Lines

Chats

Webhooks

Pagination

List methods return a page object with data, hasMore, and nextCursor. Use for await...of to iterate through all results:

Error handling

All errors extend MessagesError and include the error type, code, and message from the API:
Every error includes:

Configuration

All options are passed to createClient:

TypeScript

The SDK is written in TypeScript and exports types for all resources: