💬 SMS

Overview

SMS notifications provide instant, direct communication with your users. NotificationAPI makes it easy to send personalized SMS messages with features like proper phone number formatting, delivery tracking, and global reach.

This guide covers everything you need to know about sending SMS notifications, from basic setup to advanced features.

Requirements

  • No setup required
TIP

You DON’T need another 3rd-party like Twilio. Through our partnerships, we allocate and manage any required telecom infrastructure for you.

Step 1: Create your account and first notification

  • Create your NotificationAPI account and complete the onboarding. Sign up for free.
  • In the dashboard, create your first notification and enable the SMS channel.
  • Note the notification’s Type (e.g., welcome_sms). You’ll use this later in the send step.

Step 2: Install the SDK

In the dashboard send step, the first thing you’ll need to do is install the SDK. Select the appropriate language and follow the instructions.

Install the node package using one of the following package managers:

npm install notificationapi-node-server-sdk
yarn add notificationapi-node-server-sdk
pnpm add notificationapi-node-server-sdk
pip install notificationapi_python_server_sdk
composer require notificationapi/notificationapi-php-server-sdk
go get github.com/notificationapi-com/notificationapi-go-server-sdk
dotnet add package NotificationAPI --version 0.5.0

Add the following dependencies to your pom.xml file:

<dependencies>
    <dependency>
        <groupId>com.notificationapi</groupId>
        <artifactId>notificationapi-java-server-sdk</artifactId>
        <version>0.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.14</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.15.2</version>
    </dependency>
</dependencies>

Add the NotificationAPI class to your application - see the full Ruby implementation.

Step 3: Send an SMS Notification

The next part of the send step is to send the notification from your backend. Here’s how to send an SMS notification by passing the SMS content directly:

TIP

Replace the type value (e.g., welcome_sms) with the notification Type you noted in Step 1, and replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with the values from the code sample in your NotificationAPI dashboard.

import notificationapi from 'notificationapi-node-server-sdk';

// Initialize (default US region)
// For CA region: add 'https://api.ca.notificationapi.com' after CLIENT_SECRET
// For EU region: add 'https://api.eu.notificationapi.com' after CLIENT_SECRET
notificationapi.init('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');

// Send SMS notification (direct content)
notificationapi.send({
  type: 'welcome_sms',
  to: {
    id: 'user123',
    number: '+16175551212' // Replace using format [+][country code][area code][local number]
  },
  sms: {
    message: 'Welcome to Acme Corp! Thanks for joining.'
  }
});
import asyncio
from notificationapi_python_server_sdk import notificationapi

# Initialize (default US region)
notificationapi.init("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")

async def send_sms():
    await notificationapi.send({
        "type": "welcome_sms",
        "to": {
            "id": "user123",
            "number": "+16175551212"  # Replace using format [+][country code][area code][local number]
        },
        "sms": {
            "message": "Welcome to Acme Corp! Thanks for joining."
        }
    })

# Run the async function
asyncio.run(send_sms())
use NotificationAPI\NotificationAPI;

// Initialize
$notificationapi = new NotificationAPI('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');

// Send SMS notification (direct content)
$notificationapi->send([
    "type" => "welcome_sms",
    "to" => [
        "id" => "user123",
        "number" => "+16175551212"  // Replace using format [+][country code][area code][local number]
    ],
    "sms" => [
        "message" => "Welcome to Acme Corp! Thanks for joining."
    ]
]);
package main

import (
    notificationapi "github.com/notificationapi-com/notificationapi-go-server-sdk"
)

func main() {
    // Initialize
    notificationapi.Init("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", "https://api.notificationapi.com")

    // Send SMS notification (direct content)
    notificationapi.Send(
        notificationapi.SendRequest{
            Type: "welcome_sms",
            To: notificationapi.User{
                Id:     "user123",
                Number: "+16175551212",  // Replace using format [+][country code][area code][local number]
            },
            Sms: map[string]interface{}{
                "message": "Welcome to Acme Corp! Thanks for joining.",
            },
        },
    )
}
using NotificationApi.Server;
using NotificationApi.Server.Models;

// Initialize
var notificationApi = new NotificationApiServer("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");

// Create user
var user = new NotificationUser("user123")
{
    TelephoneNumber = "+16175551212"  // Replace using format [+][country code][area code][local number]
};

// Send SMS notification (direct content)
await notificationApi.Send(new SendNotificationData("welcome_sms", user)
{
    Type = "welcome_sms",
    To = user,
    Sms = new Dictionary<string, object>
    {
        { "message", "Welcome to Acme Corp! Thanks for joining." }
    }
});
package com.example;

import com.notificationapi.NotificationApi;
import com.notificationapi.model.*;

public class Example {
    public static void main(String[] args) {
        NotificationApi api = new NotificationApi(
            "YOUR_CLIENT_ID",
            "YOUR_CLIENT_SECRET"
        );

        // Create user
        User user = new User("user123")
            .setEmail("user@example.com")
            .setNumber("+16175551212"); // Replace using format [+][country code][area code][local number]

        // Create and send notification request
        NotificationRequest request = new NotificationRequest("welcome_sms", user)
            .setSms(new SmsOptions()
                .setMessage("Welcome to Acme Corp! Thanks for joining.")
            );

        System.out.println("Sending notification request...");
        String response = api.send(request);
        System.out.println("Response: " + response);
    }
}
# Initialize
notificationapi = NotificationAPI.new("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")

# Send SMS notification (direct content)
notificationapi.send({
  type: 'welcome_sms',
  to: {
    id: 'user123',
    number: '+16175551212'  # Replace using format [+][country code][area code][local number]
  },
  sms: {
    message: 'Welcome to Acme Corp! Thanks for joining.'
  }
})

You’re All Set!

🎉 Congrats! You’re now sending notifications!

If you’d like to send using templates configured in the Dashboard, check out our Templating guide and Backend Integration, or learn more about SMS best practices below.

TIP

SMS messages are limited to 800 ASCII characters. Design concise templates that convey essential information clearly.

Phone Number Formatting

Proper phone number formatting is crucial for SMS delivery. Always use the international E.164 format with a plus sign and country code.

E.164 Format (Required)

Use the E.164 format for all phone numbers:

// ✅ Correct E.164 format examples
notificationapi.send({
  type: 'order_update',
  to: {
    id: 'user456',
    number: '+16175551212' // US number
  },
  parameters: {
    orderNumber: 'ORD-123',
    status: 'shipped'
  }
});

// More E.164 examples
const phoneNumbers = [
  '+16175551212', // United States
  '+447911123456', // United Kingdom
  '+33123456789', // France
  '+81901234567', // Japan
  '+5511987654321', // Brazil
  '+4917612345678', // Germany
  '+61412345678' // Australia
];
WARNING

Always use E.164 format (+[country code][phone number]) for reliable SMS delivery worldwide.

When sending notifications, format the phone numbers with a + and country code, for example, +16175551212 (E.164 standard). We accept unformatted US/Canada numbers, e.g., (415) 555-1212, 415-555-1212, or 4155551212.

Sender Phone Numbers

Free Accounts:

  • +16504472976
  • For countries where a “name” shows instead of a phone number, the default sender ID is NOTIAPI.
  • Dedicated phone number
  • By default, from the +1 (650) area code but can be changed to other area codes, short codes, or toll-free numbers
  • For countries where a “name” shows instead of a phone number, we can modify the sender ID.

See more sender options and details here: Sender phone numbers.

SMS Best Practices

1. Message Length and Content

Character Limits:

  • SMS limit: 800 ASCII characters maximum
  • Recommended: Keep messages under 160 characters for single SMS segments
  • Long messages: Automatically split into multiple segments
  • Avoid spam: Don’t send excessive messages
  • Opt-in required: Ensure users have consented to SMS notifications
  • Opt-out mechanism: Include unsubscribe instructions when required
  • Regulatory compliance: Follow local regulations (TCPA in US, GDPR in EU)
  • Record keeping: Maintain consent records
  • Avoid spam: Don’t send excessive messages

A2P 10DLC Registration (US)

See the dedicated guide: A2P 10DLC Registration

SMS Responses and Two-Way Communication

NotificationAPI supports receiving and processing SMS replies:

Setting Up SMS Responses

You can receive and process responses to your SMS notifications through a webhook. When recipients reply to your SMS notifications, we can forward these responses to your specified endpoint.

SMS responses are an enterprise and paid account feature that requires a dedicated phone number.

To set up a webhook for SMS responses, please reach out to our support team through the chat icon in the lower right corner of the webpage. Our team will help you configure the webhook endpoint and ensure you’ve got everything you need to receive responses.

  1. Webhook configuration: Contact support to set up response webhooks
  2. Response handling: Process incoming SMS replies in your application
  3. Auto-responses: Set up automated replies for common responses

Your Own Telecom Team

Imagine having your own “Telecom” team:

  • Regulatory Compliance: More and more countries and telecom companies are joining forces to prevent SMS spam. We help our customers navigate these regulations and stay compliant, by registering your numbers, submitting necessary documentations, verifying your business in different juristictions, applying for elevated access, and more.

  • Delivery Monitoring: We also monitor your SMS delivery rates and will reach out to you directly if we detect an alarming rate of failure. You can also rely on our team for best practices, reviewing your SMS content, or to help you troubleshoot a delivery issue.

  • Transferring existing numbers: We can also navigate the transfer of any existing numbers to our care, so your team can focus on your software and core product.

Tracking and Analytics

NotificationAPI automatically tracks SMS metrics:

  • Delivery status: Successfully delivered messages
  • Failed deliveries: Numbers that couldn’t receive messages

View all analytics in your dashboard under Logs and Insights.

Events Webhook

Following are the events that you can receive via Events Webhook:

  • Failures
  • Unsubscribes

Need more help?

If you need help, reach out through our live chat or Slack community.