Text Marketing API

Send personalized SMS messages, schedule campaigns, and track delivery in real time.

Send a Message

POST /v1/messages

Send an SMS to a single recipient.

Request parameters

torequired
string
E.164 formatted phone number (+15551234567)
bodyrequired
string
Message text. Max 1600 characters.
fromrequired
string
Sender name or phone number
send_at
ISO 8601 string
Schedule for future delivery
shorten_urls
boolean
Shorten and track links in body (default: false)
const message = await client.messages.create({
  to: "+15551234567",
  body: "Your exclusive offer: 30% off today only! šŸŽ‰",
  from: "MyBrand",
  // Optional: shorten and track links
  shortenUrls: true,
});

// message.sid      → "msg_01jxxxx"
// message.status   → "queued" | "sent" | "delivered" | "failed"

Schedule Messages

Use the send_at parameter to schedule messages for future delivery. Minimum 15 minutes in advance.

const message = await client.messages.create({
  to: "+15551234567",
  body: "Black Friday starts NOW! 50% off everything šŸ›ļø",
  from: "MyBrand",
  // Schedule for Black Friday at 9 AM UTC
  sendAt: "2025-11-28T09:00:00Z",
});

Webhooks

Textmodo sends webhooks when message status changes. Configure your endpoint in the dashboard.

Event types

message.queuedmessage.sentmessage.deliveredmessage.failedmessage.clicked

Payload example

{
  "event": "message.delivered",
  "sid": "msg_01jxxxx",
  "to": "+15551234567",
  "status": "delivered",
  "delivered_at": "2025-01-01T12:00:05Z"
}

Verify webhook signatures

webhook-verify.jsjavascript
const crypto = require("crypto");

function verifyWebhook(payload, signature, secret) {
  const expected = crypto
    .createHmac("sha256", secret)
    .update(payload)
    .digest("hex");
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}