Home Features API Hub API SMS

SMS API — Send & Receive on Local Virtual Numbers

Send outbound SMS and receive inbound messages via webhook on SMS-enabled local virtual numbers in supported countries. No separate SMS platform needed.

How SMS Works with PBXme

PBXme virtual numbers that are SMS-enabled can both send and receive text messages.

Code Samples

All endpoints use HTTP POST. Authenticate first to get your account_token.

// Requires: npm install node-fetch form-data
const fetch = require("node-fetch");
const FormData = require("form-data");

const BASE = "https://newsip.pbxme.com/api";

// ── Step 1: Login ───────────────────────────────────────────
async function login() {
  const f = new FormData();
  f.append("username", "YOUR_USERNAME");
  f.append("password", "YOUR_PASSWORD");
  const r = await fetch(`${BASE}/login`, { method:"POST", body:f });
  return (await r.json()).account_token;
}

// ── Step 2: Send outbound SMS ───────────────────────────────
async function sendSMS(token, from, to, message) {
  const f = new FormData();
  f.append("token",   token);
  f.append("from",    from);     // your SMS-enabled DID number
  f.append("to",      to);       // recipient in E.164 format
  f.append("message", message);
  const r = await fetch(`${BASE}/sms/send`, { method:"POST", body:f });
  return r.json();
}

// ── Step 3: Run ─────────────────────────────────────────────
(async () => {
  const token = await login();
  const result = await sendSMS(
    token,
    "+447911123456",   // your UK virtual number
    "+19175550100",    // recipient
    "Hello from PBXme SMS API!"
  );
  console.log("SMS sent:", result);
})();

// ── Receive inbound SMS (Express.js webhook handler) ────────
// Configure your webhook URL in the PBXme dashboard or via API
// PBXme sends HTTP POST to your URL with the SMS payload
const express = require("express");
const app = express();
app.use(express.urlencoded({ extended: true }));

app.post("/sms/webhook", (req, res) => {
  const { from, to, message, timestamp } = req.body;
  console.log(`SMS from ${from} to ${to}: "${message}"`);
  res.status(200).send("OK");
});

app.listen(3000);
# Step 1 — Login and capture token
TOKEN=$(curl -s -X POST https://newsip.pbxme.com/api/login \
  -d "username=YOUR_USERNAME" \
  -d "password=YOUR_PASSWORD" \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['account_token'])")

# Step 2 — Send outbound SMS
curl -s -X POST https://newsip.pbxme.com/api/sms/send \
  -d "token=$TOKEN" \
  -d "from=+447911123456" \
  -d "to=+19175550100" \
  -d "message=Hello from PBXme SMS API"
# Step 3 — Check SMS sending history
curl -s -X POST https://newsip.pbxme.com/api/sms/history \
  -d "token=$TOKEN"

More API Guides

FAQ — SMS API

Yes, on SMS-enabled virtual numbers. When ordering, look for numbers with the SMS or Mobile voice+SMS DID type. These numbers can both send outbound and receive inbound SMS messages.

When someone sends an SMS to your virtual number, PBXme delivers it in real time via an HTTP POST webhook to a URL you configure. The payload includes the sender’s number, your number, the message text, and a timestamp.

SMS support varies by country and number type. Use the DID Type List API endpoint to check which DID types (including Mobile SMS and Mobile voice+SMS) are available in your target country before provisioning.

Start Sending SMS via API Today

Get your free API key and send your first SMS in minutes.

    Sales, click to chat