Home API Hub API SMS

API Reference

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. Outbound SMS is sent via API call. Inbound SMS is delivered to a webhook URL you configure on your number — your server receives an HTTP POST with the message content and sender details in real time.

📤

Outbound SMS

Send SMS from your virtual number to any mobile phone worldwide via a single API call. Useful for notifications, OTP codes, and automated messaging.

📥

Inbound SMS via Webhook

When someone texts your virtual number, PBXme sends an HTTP POST to your configured webhook URL with the full message payload — no polling needed.

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"

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.

    Sales, click to chat