How to Send SMS via RESTful API, SMPP or Node.js SDK (NPM)

Friday, 26 Sep 2025 General
Anita Nowak
Anita Nowak Content Writer
How to Send SMS via RESTful API, SMPP or Node.js  SDK (NPM)

Introduction: Why Businesses Need SMS APIs

In today’s digital world, instant communication is critical. From appointment reminders to OTPs, marketing alerts to service notifications, SMS remains one of the most reliable communication channels, boasting an open rate of over 98%.

But sending SMS messages at scale isn’t just about typing on a phone. Businesses need powerful APIs and SDKs that can integrate with their existing systems, automate workflows, and provide delivery reporting.

That’s exactly what Dialogios SMS Messaging Platform delivers. With our RESTful SMS API, SMPP protocol, and Node.js SDK on NPM, you can easily send, track, and manage SMS worldwide.

In this article, we’ll walk through how SMS APIs work, how to use our SDK on NPM, and why developers and businesses choose Dialogios for reliable SMS delivery.


What Is an SMS API?

An SMS API (Application Programming Interface) is a software interface that allows applications to send and receive SMS messages programmatically. Instead of manually sending messages from a phone, developers integrate SMS APIs into apps, websites, or CRM systems.

Key benefits of using an SMS API include:

  • Automation – Trigger SMS alerts automatically based on user actions (e.g., sign-ups, purchases, password resets).

  • Scalability – Send millions of SMS messages without relying on manual processes.

  • Reporting – Retrieve message delivery reports, status updates, and error logs.

  • Global Reach – Connect to telecom networks worldwide through a single interface.


What Is an SMS SDK on NPM?

For Node.js developers, Dialogios provides an official SDK on NPM: @dialogios/sdk

The SDK simplifies SMS integration by providing pre-built functions for sending messages, checking delivery status, and handling callbacks. Instead of manually handling REST API calls, you can use simple methods in JavaScript and TypeScript. This speeds up development, reduces errors, and allows teams to deploy SMS features faster.


How to Send an SMS via Dialogios RESTful API

Authentication

All API requests use Basic Auth with your Account SID (username) and Account Token (password). You can find both in your account dashboard.

Request Parameters

  • from – Sender ID (must be pre-approved).

  • to – Recipient’s international phone number (/^\d{10,15}$/).

  • text – Message content.

  • encoding – Default: gsm7. Options: ucs2, latin1, utf8.

  • callback_url – (Optional) URL to receive delivery status updates.

Example Request

curl -X POST 'https://api.dialogios.com/v1/accounts/{{account_sid}}/messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {{base64(account_sid:account_token)}}' \
--data '{
    "from": "{{sender_id}}",
    "to": "{{recipient_number}}",
    "text": "Hello World!",
    "encoding": "ucs2",
    "callback_url": "{{callback_url}}"
}'

Example Success Response

{
    "statusCode": 201,
    "message": "CREATED",
    "messageSid": "639a083f-12c8-3e98-4d24-7dfffa******"
}

Example Error Response

{
    "statusCode": 401,
    "message": "Invalid credentials",
    "error": "Unauthorized"
}

Using Callback URLs for Delivery Status

Dialogios supports webhook callbacks to notify your system when an SMS is delivered or undeliverable.

Delivered Example:

{
    "message_id":"639a083f-3180-fbdd-b3d1-2eafb4c3****",
    "status":"DELIVRD",
    "timestamp":"2025-09-01T12:42:07.339Z",
    "to":"5255123456***",
    "from":"{{sender_id}}",
    "error_code":"000",
    "info": {
      "message":"stat:DELIVRD err:000 text:- "
    },
    "text":"Hello World!"
}

Undelivered Example:

{
    "message_id":"639a083f-de30-1636-f4e4-8c917c44****",
    "status":"UNDELIV",
    "timestamp":"2025-09-01T12:47:24.323Z",
    "to":"5255123456***",
    "from":"{{sender_id}}",
    "error_code":"001",
    "info": {
      "message":"stat:UNDELIV err:001 text:- "
    },
    "text":"Hello World!"
}

This allows businesses to track delivery in real-time and take automated actions (e.g., retrying failed messages).


How to Retrieve SMS Details

You can retrieve SMS logs or message details using our API.

Example Request

curl --location 'https://api.dialogios.com/v1/accounts/{{account_sid}}/messages/{{message_sid}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {{base64(account_sid:account_token)}}'

Example Response

{
    "success": true,
    "edr_date": "2025.09.24 14:37:22",
    "cdr_delivery_time": "2025.09.24 14:37:28",
    "sender_name": "{{sender_id}}",
    "dnis": "5255123456***",
    "network": "TelCel/America Movil",
    "country": "Mexico",
    "text": "Hello World!",
    "status": "DELIVRD",
    "client_rate": 0.001,
    "part_amount": 3
}

This helps with billing, analytics, and troubleshooting.


Sending SMS via Node.js SDK

Our @dialogios/sdk simplifies SMS integration in Node.js.

Installation

npm install @dialogios/sdk

Example Usage

Send SMS message

import {
  Dialogios,
  type Credentials,
  type CreateSmsMessagePayload,
  type GetSmsMessagePayload,
} from '@dialogios/sdk'

// Required credentials account_sid, account_token
const dialogios = new Dialogios({
  account_sid: 'acs1e2e6c28-8631-4b96-8249-220624******',
  account_token: 'act18b99404-a653-445b-8885-4649e3******'
} as Credentials)

async function sendSms(params: CreateSmsMessagePayload) {
  return dialogios.createSmsMessage(params)
}

// Send SMS message
// Required properties: "from", "to", text
// All other properties are optional (such as "encoding", "callback_url")
const smsSent = await sendSms({
  from: "sender_id",
  to: "1234567890",
  text: "Hello World",
  encoding: "ucs2",
  callback_url: "https://requestcatcher.com"
})

console.log(`smsSent: ${JSON.stringify(smsSent)}`)

This makes it developer-friendly and reduces integration time significantly.


How to Retrieve SMS Details via Node.js SDK

You can retrieve SMS logs or message details using our SDK.

async function getSms(params: GetSmsMessagePayload) {
  return dialogios.getSmsMessage(params)
}

// Get SMS message details
// Required properties: "message_sid"
// Please note that after sending an SMS, the message details will only become available after a few minutes
const smsDetails = await getSms({
  message_sid: "639a083f-e0cc-17d7-9455-924452******",
})

console.log(`smsDetails: ${JSON.stringify(smsDetails)}`)

SMPP for High-Volume Messaging

For enterprises that need high-throughput SMS delivery (e.g., banking, telecom, governments), Dialogios also supports SMPP protocol.

Benefits of SMPP:

  • High TPS (transactions per second)

  • Direct carrier connections

  • Ideal for mission-critical alerts and bulk SMS

Our platform offers SMPP with failover routing, ensuring maximum reliability.


Why Choose Dialogios for SMS Messaging?

  • Multi-Channel Options – REST API, SMPP, or Node.js SDK on NPM

  • Global Reach – SMS delivery in 190+ countries

  • Scalable Infrastructure – From startups to enterprises

  • Advanced Security – TLS, Basic Auth, IP whitelisting

  • Real-Time Reporting – Message status, delivery receipts, analytics

  • Developer-Friendly – Clean API docs, SDKs, and 24/7 support


Conclusion: Power Your Apps with SMS API & SDK

Whether you’re building an app that needs OTP verification, running a marketing campaign, or sending transactional alerts, SMS APIs and SDKs are essential tools.

With Dialogios SMS API, SMPP, and Node.js SDK, you can:

  • Send SMS worldwide with low latency

  • Track delivery with callbacks and reporting

  • Integrate in minutes with our NPM SDK

  • Scale effortlessly as your business grows

Get started today. Sign up for Dialogios SMS API and start sending messages in minutes.