LanguageGuide · official SDK soon

Send SMS in Tunisia from Node.js with fetch.

Since Node.js 18, fetch is built in: no dependency is needed to call the Sendimo API from Express, NestJS, Next.js or a serverless function. The official JavaScript SDK is on its way.

What it does

  • No dependency on Node.js 18 or newer.
  • Works in Express, NestJS, Next.js API routes and serverless functions.
  • JSON errors with a stable code so you can react cleanly (rate_limited, insufficient_balance…).
  • The key stays on the server: never use it in the browser or a mobile app.

Setup

  1. 1Use Node.js 18 or newer.
  2. 2Put your API key in SENDIMO_API_KEY (.env file or your host's secrets).
  3. 3POST to /v1/messages from your server.
  4. 4Receive statuses by webhook and verify their signature.
Send an SMSJavaScript
// Node.js 18+ (fetch built in)
const response = await fetch("https://api.sendimo.tn/v1/messages", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SENDIMO_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "order-4821-otp",
  },
  body: JSON.stringify({
    to: "+21620123456",
    from: "SENDIMO",
    text: "Your code is 482913. It expires in 5 minutes.",
    reference: "order-4821",
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}

const message = await response.json();
console.log(message.id, message.status); // msg_01HF8Z3K9QX2 queued
Response 202 AcceptedJSON
{
  "id": "msg_01HF8Z3K9QX2",
  "status": "queued",
  "to": "+21620123456",
  "from": "SENDIMO",
  "text": "Your code is 482913. It expires in 5 minutes.",
  "encoding": "GSM-7",
  "segments": 1,
  "network": "ooredoo",
  "cost": { "amount": "0.140", "currency": "TND" },
  "reference": "order-4821",
  "scheduled_at": null,
  "created_at": "2026-10-30T09:15:00Z"
}

Next steps

Other integrations

Ready to send your SMS?

Launching soon in Tunisia. Join early access.