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_token...");

Sending a WhatsApp Message

Send rich WhatsApp content to your users with automatic fallback to SMS when WhatsApp is not available.
WhatsApp messages require the recipient to have WhatsApp installed and active. If WhatsApp is not available, you can configure automatic fallback to SMS.
const res = await contiguity.whatsapp.send({
  to: "+1234567890",
  message: "Hello via WhatsApp!",
  // from: "+15555555555",
  fallback: { 
    when: ["whatsapp_unsupported", "whatsapp_fails"], 
    from: "+15555555555" 
  },
  attachments: ["https://example.com/image.png"]
});

Response

message_id
string
Unique identifier for the sent WhatsApp message, used for tracking delivery status.
metadata
object
Request metadata including ID, timestamp, and API version.
You can also send a simple WhatsApp message without attachments:
const res = await contiguity.whatsapp.send({
  to: "+1234567890",
  message: "Hello from your app!"
});

Typing Indicators

Show typing indicators to create a more interactive messaging experience.Start typing indicator:
const res = await contiguity.whatsapp.typing({
  to: "+1234567890", 
  action: "start"
});

Response

status
string
Current status of the typing indicator action (e.g., “started”, “stopped”).
metadata
object
Request metadata including ID, timestamp, and API version.
Stop typing indicator:
const res = await contiguity.whatsapp.typing({
  to: "+1234567890", 
  action: "stop"
});

Parameters

whatsapp.send(params)

to
string
required
The recipient’s phone number in E.164 format (e.g., “+1234567890”).
message
string
required
The message content to send via WhatsApp.
from
string
Optional leased phone number to use as the sender. Must be a number you have leased from Contiguity.
fallback
object
Fallback configuration for when WhatsApp is not available.
attachments
string[]
Array of attachment URLs to include with the message. Supports images and other media.

whatsapp.typing(params)

to
string
required
The recipient’s phone number in E.164 format (e.g., “+1234567890”).
action
string
required
The typing indicator action. Options: "start" to show typing, "stop" to hide typing.
from
string
Optional leased phone number to use as the sender.