Send messages from TypeScript with the SendiMessage API
The official sendimessage npm package ships full TypeScript definitions, so every request parameter and response field is typed out of the box — no DefinitelyTyped package, no hand-written interfaces.
The types mirror the real API contract: sendMessage returns an OutboundMessage with a message_handle and a QUEUED status, and the compiler keeps every send site in your codebase honest about what the API accepts and returns.
What this integration enables
Architecture
- Your application eventAn order ships, a booking nears, a ticket updates
- TypeScript server codeBuilds the request with credentials from the environment
- SendiMessage APIPOST /send-message returns the queued message
- Managed messaging lineSMS, or iMessage on supported lines and destinations
- Webhook eventsDelivery status and incoming replies post back to your endpoint
Example request
// npm install sendimessage — TypeScript definitions includedimport SendImessage, { SendImessageError } from "sendimessage";import type { OutboundMessage, SendMessageParams } from "sendimessage";const client = new SendImessage({apiKey: process.env.SENDIMESSAGE_KEY!,apiSecret: process.env.SENDIMESSAGE_SECRET!,});async function notify(params: SendMessageParams): Promise<OutboundMessage> {try {return await client.sendMessage(params);} catch (err) {if (err instanceof SendImessageError) {console.error(`SendiMessage error ${err.status}`, err.body);}throw err;}}const msg = await notify({number: "+15555550123",content: "Hello from SendiMessage",});console.log(msg.message_handle, msg.status); // "4e828182-…" "QUEUED"
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.
// "outbound" event → your typescript 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 typescript.
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 TypeScript SDK for SendiMessage?
What does the API return when I send a message?
Can I send iMessage from TypeScript?
Related integrations
Ready to connect TypeScript?
Request a messaging line and a SendiMessage integration specialist will review your TypeScript workflow and guide the setup.