We use optional, privacy-safe analytics to understand which pages help visitors. Nothing optional runs until you choose. Privacy policy

Skip to content
AvailableDirect HTTP API

Send messages from JavaScript with the SendiMessage API

JavaScript has an official SendiMessage SDK: the sendimessage package on npm. It has zero runtime dependencies, runs on Node.js 18+, and covers the whole public API — sending, media, lookup, contacts, lines, conversations, and webhook management with a signature verification helper.

Keep this code on your server. Browser JavaScript must never hold your API key pair; if a web page needs to trigger a message, have it call your own backend route, and let that route call SendiMessage.

Request This SetupBook an Integration Review

What this integration enables

Transactional notifications
Order confirmations, payment receipts, and status changes triggered by your backend.
Appointment reminders
Scheduled jobs that message customers before a booking.
Operational alerts
Delivery windows, service updates, and internal notifications.
Two-way conversations
Incoming replies arrive on your webhook endpoint for routing to support or sales.

Architecture

How it fits together: Your application event, then JavaScript server code, then SendiMessage API, then Managed messaging line, then Webhook events.
  1. Your application eventAn order ships, a booking nears, a ticket updates
  2. JavaScript server codeBuilds the request with credentials from the environment
  3. SendiMessage APIPOST /send-message returns the queued message
  4. Managed messaging lineSMS, or iMessage on supported lines and destinations
  5. Webhook eventsDelivery status and incoming replies post back to your endpoint

Example request

JavaScript
// npm install sendimessage
import SendImessage, { SendImessageError } from "sendimessage";
const client = new SendImessage({
apiKey: process.env.SENDIMESSAGE_KEY,
apiSecret: process.env.SENDIMESSAGE_SECRET,
});
try {
const msg = await client.sendMessage({
number: "+15555550123",
content: "Hello from SendiMessage",
});
console.log(msg.message_handle, msg.status); // "4e828182-…" "QUEUED"
} catch (err) {
if (err instanceof SendImessageError) {
console.error(`SendiMessage error ${err.status}`, err.body);
}
throw err;
}

Server-side only — never expose the API key pair in browser code.

Delivery events and incoming replies

Delivery status and incoming replies arrive as signed webhook events. Verify the signature, then correlate events with your own records via the message_handle returned when you sent.

webhook event
// "outbound" event → your javascript endpoint
// Verify the SendiMessage-Signature header (t={timestamp},v1=HMAC-SHA256 of
// "{timestamp}.{raw body}", keyed with your webhook secret), then use
// GET /v2/messages/{message_handle} for authoritative state and match it to
// your contact_id in javascript.

Limitations and honest notes

  • iMessage delivery is available on supported messaging lines and destinations. Recipients without iMessage receive SMS when fallback is configured — never assume universal iMessage availability.
  • Messages are accepted asynchronously — the API returns status QUEUED and final status arrives via webhook or the message endpoints.
  • Official SDKs are published for JavaScript/TypeScript (npm: sendimessage), Python (PyPI: sendimessage), PHP (Composer: sendimessage/sdk), and Go (github.com/sendimessage/sendimessage-go). Every SDK is dependency-free and covers the full public API surface.

Security considerations

  • Load the API key pair from the environment — never commit it or embed it in client-side code.
  • Verify webhook signatures before processing events.
  • Log message handles, not message bodies, in shared logs.

Frequently asked questions

Is there an official JavaScript SDK for SendiMessage?
Yes — install it with `npm install sendimessage`. The SDK is dependency-free, covers the full public API (messages, media, lookup, contacts, lines, conversations, webhooks), and ships a webhook signature verification helper.
What does the API return when I send a message?
The API accepts messages asynchronously and responds with status "QUEUED" plus a message_handle and the line_handle it will send from. Track final delivery via GET /status, the message history endpoints, or webhook events.
Can I send iMessage from JavaScript?
SendiMessage delivers over iMessage where the destination supports it on your managed line, and falls back to SMS when fallback is configured. iMessage is never guaranteed for every recipient.

Ready to connect JavaScript?

Request a messaging line and a SendiMessage integration specialist will review your JavaScript workflow and guide the setup.