The TypeScript SDK is the primary client library for Titan’s WhatsApp API. It ships with full type inference powered by theDocumentation Index
Fetch the complete documentation index at: https://docs.usetitan.app/llms.txt
Use this file to discover all available pages before exploring further.
@titan-api/types package, built-in webhook signature verification, and automatic detection of API deprecation headers. You can use it in Node.js, Bun, edge runtimes, and any TypeScript or JavaScript project.
Installation
Create a client
ImportTitanClient and initialize it with your base URL and API key.
Your API key starts with
titan_. Keep it on the server — never expose it in browser code. Use client tokens for browser-side access.Send a message
Call methods on the domain that corresponds to the resource you want to work with. Sending a message usesclient.messages.send.
Service domains
The client exposes every Titan API domain as a property. All methods are async and return typed response objects.| Domain | Property |
|---|---|
| Sessions | client.sessions |
| Messages | client.messages |
| Contacts | client.contacts |
| Groups | client.groups |
| Channels | client.channels |
| Presence | client.presence |
| Profile | client.profile |
| Labels | client.labels |
| Chats | client.chats |
| Webhooks | client.webhooks |
| Pairing | client.pairing |
| LIDs | client.lids |
| Media | client.media |
| Client tokens | client.clientTokens |
Webhook verification
UseverifyWebhookSignature to validate the HMAC-SHA256 signature on incoming webhook deliveries. The function returns the parsed event object, fully typed based on the event name.
string or Uint8Array, the value of the X-Webhook-Signature header, and your webhook secret. The function throws if the signature does not match.
Client tokens
To use a short-lived client token instead of a server API key, passclientToken instead of apiKey:
TitanClient class handles both. See Client tokens for how to mint tokens and configure session rules.
Full client token flow
Types
The TypeScript SDK gets its types from the@titan-api/types npm package, published separately from packages/shared/ in the Titan API monorepo. Types are kept in sync with the OpenAPI spec. You can import types directly if you need them without instantiating a client:
Deprecation warnings
The SDK readsDeprecation, Sunset, and Titan-SDK-Deprecation response headers automatically. When any of these headers appear, the SDK emits a warning to the console once per client lifetime to avoid log spam.
Deprecation: true— the API version you are calling is deprecated; action required.Sunset: <date>— the API version will be removed on the given date.Titan-SDK-Deprecation— your SDK version is outdated; upgrade to avoid future breakage.