Developers

Connect your software to your Softrivo assistant.

A REST API, a Node.js SDK and signed webhooks. Your clinic system, CRM, stock system or website can read and book appointments, read leads and free times, list customers and conversations, send WhatsApp messages, connect a customer's WhatsApp number, keep the assistant's documents, service menu and listings current, and hear about every booking, lead and call as it happens.

Quick start

Create a key on the dashboard's Integrations page, install the SDK, and you are booking:

npm install @softrivo/sdk

import Softrivo from '@softrivo/sdk'
const softrivo = new Softrivo({ apiKey: process.env.SOFTRIVO_API_KEY })
const { data } = await softrivo.appointments.list({ status: 'pending' })
await softrivo.appointments.create({ phone: '60123456789', name: 'Aisyah', service: 'Scaling', date: '2026-12-01', time: '14:30' })

That is the whole setup. The SDK knows the base URL, retries on 429 and 5xx, adds an Idempotency-Key to every write, pages for you with for await, and throws a typed SoftrivoError. The same code works unchanged with a test key and a live key. Not on Node? Every example below is also in PHP and curl.

Authentication

Every request carries your key as a bearer token:

curl https://api.softrivo.com/api/v1/appointments \
  -H "Authorization: Bearer sk_live_YOUR_KEY"

API access is included in every Softrivo plan at no extra charge: keys, the SDK, webhooks and the sandbox come with your subscription. Keys start with sk_live_ (your business) or sk_test_ (your sandbox, see below). A key acts as you: keep it on your server, never in a web page or a mobile app, and revoke it from the Integrations page the moment it may have leaked. A dashboard login never works on the API, and a key never works on the dashboard.

Permissions

When you create a key you choose what it may do. A key with every permission ticked is a full-access key. A request outside the key's permissions answers 403 with code: "insufficient_scope" and required_scope naming the missing one.

PermissionWhat it allows
read:appointmentsRead appointments
write:appointmentsBook and change appointments
read:leadsRead leads
read:availabilitySee free times
read:customersRead customers
read:conversationsRead conversations
write:messagesSend WhatsApp messages
read:knowledgeRead knowledge files
write:knowledgeUpload and remove knowledge files
read:catalogRead services and listings
write:catalogChange services and listings
write:webhooksManage webhook endpoints
read:whatsappSee connected WhatsApp numbers and connect links
write:whatsappCreate WhatsApp connect links

Sandbox keys

An sk_test_ key works on a private sandbox copy of your business: its own appointments, leads, customers, files, services, listings and webhook endpoints, created the first time the key is used. The sandbox has no WhatsApp number, so nothing done with a test key reaches a customer: POST /messages answers 409 no_whatsapp_number there, and bookings alert nobody. Build and test against the sandbox, then swap the key. Sandbox data may be cleared by us at any time and is not backed up.

Requests, paging, idempotency

Base URL https://api.softrivo.com/api/v1. JSON in, JSON out. Every answer carries X-Request-Id; quote it when you ask us about a request.

Lists answer { data, limit, offset, next_cursor }, newest first. Pass cursor=<next_cursor> for the next page; null means there is no more. limit is 50 by default and 100 at most. Services and listings page by offset only (next_cursor is always null there).

Idempotency. Send Idempotency-Key: <any unique string> on a POST or PATCH and the first answer is replayed for 24 hours (Idempotent-Replayed: true), so a network retry can never book or send twice. The same key with a different request answers 422 idempotency_key_reused. The SDK sends one on every write.

Customer ids. A customer is their phone number with country code (60123456789). A customer who hides their number behind a WhatsApp username appears with a username id instead (for example MY.1453…); use the id the API returns, unchanged, wherever a customer is named.

Dates and times. Bookings take date as YYYY-MM-DD and time as 14:30 or 2:30 PM, in the branch's time zone. An exact date and time are always required: "tomorrow afternoon" is never accepted.

Errors are always { error, code, request_id }: error is a sentence for a person, code is stable for your program (the full list is below).

import { SoftrivoError } from '@softrivo/sdk'
try {
  await softrivo.appointments.create({ phone: '60123456789', date: '2026-12-01', time: '09:00' })
} catch (err) {
  if (err instanceof SoftrivoError) {
    err.status     // 409
    err.code       // 'slot_full'
    err.requestId  // quote this when asking for help
    err.details    // extra fields, for example { reason: 'slot_full' }
  }
}

In PHP a twelve-line helper gives you the same shape (the examples below use it):

<?php
// A tiny helper used by the PHP examples below (plain curl, no library needed).
function softrivo(string $method, string $path, ?array $body = null, array $headers = []): array {
    $ch = curl_init('https://api.softrivo.com/api/v1' . $path);
    $h = array_merge(['Authorization: Bearer ' . getenv('SOFTRIVO_API_KEY'), 'Accept: application/json'], $headers);
    if ($body !== null) { $h[] = 'Content-Type: application/json'; curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); }
    curl_setopt_array($ch, [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => $h, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30]);
    $raw = curl_exec($ch);
    $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
    curl_close($ch);
    $json = json_decode($raw, true) ?? [];
    if ($status >= 400) {
        // Every error is { error, code, request_id, ... }
        throw new RuntimeException(($json['code'] ?? 'http_error') . ': ' . ($json['error'] ?? $raw) . ' (request ' . ($json['request_id'] ?? '?') . ')', $status);
    }
    return $json;
}

Common flows

Book an appointment

Goes through the same path as a WhatsApp or phone booking: the double-booking guard applies, the owner gets the usual alert, and a customer's open future booking is moved instead of duplicated (then the answer is 200 with rescheduled: true). A full time answers 409 slot_full; check GET /availability first for branches with a booking calendar.

Node.js
const booking = await softrivo.appointments.create(
  { phone: '60123456789', name: 'Aisyah', service: 'Scaling', date: '2026-12-01', time: '14:30' },
  { idempotencyKey: `order-${order.id}` }   // optional: your own key; the SDK makes one otherwise
)
console.log(booking.data.id, booking.data.status, booking.rescheduled)
PHP
$booking = softrivo('POST', '/appointments', [
    'phone' => '60123456789', 'name' => 'Aisyah', 'service' => 'Scaling', 'date' => '2026-12-01', 'time' => '14:30',
], ['Idempotency-Key: order-' . $order->id]);
echo $booking['data']['id'], ' ', $booking['data']['status'];
curl
curl -X POST https://api.softrivo.com/api/v1/appointments \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1001" \
  -d '{"phone":"60123456789","name":"Aisyah","service":"Scaling","date":"2026-12-01","time":"14:30"}'

Sync customers and read a conversation

Node.js
// Every customer who wrote since 1 November, page after page
for await (const customer of softrivo.customers.list({ since: '2026-11-01' })) {
  console.log(customer.id, customer.name, customer.window_open, customer.lead?.score)
}
// The thread of one customer, newest first
const { data: messages } = await softrivo.conversations.messages('60123456789', { limit: 50 })
PHP
$cursor = null;
do {
    $page = softrivo('GET', '/customers?since=2026-11-01&limit=100' . ($cursor ? '&cursor=' . urlencode($cursor) : ''));
    foreach ($page['data'] as $customer) { /* $customer['id'], ['name'], ['window_open'] */ }
    $cursor = $page['next_cursor'];
} while ($cursor);
$thread = softrivo('GET', '/conversations/60123456789/messages?limit=50');
curl
curl "https://api.softrivo.com/api/v1/customers?since=2026-11-01&limit=100" -H "Authorization: Bearer sk_live_YOUR_KEY"
# then, with next_cursor from the answer:
curl "https://api.softrivo.com/api/v1/customers?limit=100&cursor=NEXT_CURSOR" -H "Authorization: Bearer sk_live_YOUR_KEY"

Send a WhatsApp message

Sent from your business number, inside the customer's 24-hour window (WhatsApp's rule for free text). window_open on the customer tells you in advance. The message is saved so the assistant sees it as context; the assistant keeps answering unless you pass handler: "human", which hands the customer to a person until you hand back with handler: "bot".

Node.js
import { SoftrivoError } from '@softrivo/sdk'
try {
  await softrivo.messages.send({ to: '60123456789', text: 'Your results are ready. Reply here with any question.' })
} catch (err) {
  if (err instanceof SoftrivoError && err.code === 'window_closed') {
    // The customer has not written in 24 h: wait for their next message, or use a template from the dashboard.
  } else throw err
}
PHP
try {
    softrivo('POST', '/messages', ['to' => '60123456789', 'text' => 'Your results are ready. Reply here with any question.']);
} catch (RuntimeException $e) {
    if (str_starts_with($e->getMessage(), 'window_closed')) { /* wait for the customer's next message */ }
    else throw $e;
}
curl
curl -X POST https://api.softrivo.com/api/v1/messages \
  -H "Authorization: Bearer sk_live_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"to":"60123456789","text":"Your results are ready. Reply here with any question."}'

Keep the assistant's documents current

Upload the price list, FAQ or policy the assistant should answer from. A file whose name has the same base as an existing one (price_list_v2.pdf after price_list_v1.pdf) replaces it.

Node.js
import { readFile } from 'node:fs/promises'
const file = await softrivo.knowledge.uploadFile({ filename: 'price_list.pdf', content: await readFile('./price_list.pdf') })
// file.data.status === 'processing'; poll until 'ready'
const ready = await softrivo.knowledge.get(file.data.id)
PHP
$file = softrivo('POST', '/knowledge/files', [
    'filename' => 'price_list.pdf',
    'content_base64' => base64_encode(file_get_contents('price_list.pdf')),
]);
$status = softrivo('GET', '/knowledge/files/' . $file['data']['id'])['data']['status']; // processing, ready, error
curl
curl -X POST https://api.softrivo.com/api/v1/knowledge/files \
  -H "Authorization: Bearer sk_live_YOUR_KEY" \
  -F "file=@price_list.pdf"

Connect a WhatsApp number

Your key can connect numbers, but your app never runs the Facebook popup. You make a one-time link, the business owner opens it on a Softrivo page and finishes Meta signup there with no login, and you read the result or call waitForConnection. With an sk_test_ key the link is a sandbox link: the page shows a "Simulate" button and connects no real number, so you can build the whole flow first. A link is single-use and expires (60 minutes by default); the connect endpoints answer 503 not_enabled only before the feature is switched on.

Node.js
// 1. Make a one-time link and send it to the business owner.
const link = await softrivo.whatsapp.createConnectLink({ returnUrl: 'https://yourapp.com/done' })
// link.url  ->  https://app.softrivo.com/connect-link#t=…   send this to the owner

// 2. Wait for them to finish (polls until done, fails or times out).
const session = await softrivo.whatsapp.waitForConnection(link.id, { timeoutMs: 15 * 60000 })
console.log('connected:', session.result.phone_number)

// 3. The connected numbers.
const numbers = await softrivo.whatsapp.numbers()
PHP
$link = softrivo('POST', '/whatsapp/connect-sessions', ['return_url' => 'https://yourapp.com/done']);
// send $link['data']['url'] to the business owner, then poll:
$session = softrivo('GET', '/whatsapp/connect-sessions/' . $link['data']['id']);
// $session['data']['status'] is pending, completed, failed or expired
$numbers = softrivo('GET', '/whatsapp/numbers');
curl
curl -X POST https://api.softrivo.com/api/v1/whatsapp/connect-sessions -H "Authorization: Bearer sk_live_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"return_url":"https://yourapp.com/done"}'
# send data.url to the owner, then GET /whatsapp/connect-sessions/{id} for the status

Service menu and listings

The assistant quotes prices only from your service menu, and offers only listings from your stock, by ref code. Archiving (DELETE) sets active: false; nothing is ever hard-deleted.

Node.js
await softrivo.services.create({ name: 'Scaling and polishing', duration_minutes: 30, price: 120 })
const listing = await softrivo.listings.create({ title: 'Cheras condo, 3 bed', ref_code: 'KL-102', price: '450k', bedrooms: 3, area: 'Cheras' })
await softrivo.listings.update(listing.id, { status: 'sold' })
PHP
softrivo('POST', '/services', ['name' => 'Scaling and polishing', 'duration_minutes' => 30, 'price' => 120]);
$listing = softrivo('POST', '/listings', ['title' => 'Cheras condo, 3 bed', 'ref_code' => 'KL-102', 'price' => '450k', 'bedrooms' => 3, 'area' => 'Cheras']);
softrivo('PATCH', '/listings/' . $listing['data']['id'], ['status' => 'sold']);
curl
curl -X POST https://api.softrivo.com/api/v1/services -H "Authorization: Bearer sk_live_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Scaling and polishing","duration_minutes":30,"price":120}'

Webhooks

Softrivo sends a POST to your URL for appointment.created, appointment.updated (confirmed, declined, cancelled, moved or edited), lead.created and call.completed. Add endpoints on the Integrations page or by API; the signing secret is shown once, when the endpoint is created.

Node.js
const { data: endpoint, secret } = await softrivo.webhooks.create({
  url: 'https://example.com/softrivo',
  events: ['appointment.created', 'appointment.updated', 'lead.created', 'call.completed'],
})
// Store `secret` now (for example SOFTRIVO_WEBHOOK_SECRET): it is never shown again.
await softrivo.webhooks.test(endpoint.id)   // one signed ping to your URL
PHP
$made = softrivo('POST', '/webhooks', ['url' => 'https://example.com/softrivo', 'events' => ['appointment.created', 'lead.created']]);
$secret = $made['secret']; // store it now; never shown again
softrivo('POST', '/webhooks/' . $made['data']['id'] . '/test');
curl
curl -X POST https://api.softrivo.com/api/v1/webhooks -H "Authorization: Bearer sk_live_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/softrivo","events":["appointment.created","lead.created"]}'

Receive and verify

Each delivery carries X-Softrivo-Event, X-Softrivo-Delivery (unique; use it to skip a repeat) and X-Softrivo-Signature: sha256= followed by the HMAC-SHA256 hex of the raw body, keyed with your secret. Verify it against the raw body before trusting anything, reply with any 2xx within 10 seconds, and do your work after replying. If we get no 2xx we try again after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours.

Node.js
import express from 'express'
import { verifyWebhookSignature } from '@softrivo/sdk'

const app = express()
app.post('/softrivo', express.raw({ type: 'application/json' }), (req, res) => {
  // Use the raw body exactly as received, never a re-serialised object.
  if (!verifyWebhookSignature(req.body, req.get('X-Softrivo-Signature'), process.env.SOFTRIVO_WEBHOOK_SECRET)) {
    return res.sendStatus(401)
  }
  const event = JSON.parse(req.body)        // { id, event, created_at, data }
  // req.get('X-Softrivo-Delivery') is unique per delivery: use it to skip a repeat.
  if (event.event === 'appointment.created') { /* event.data.id, .phone, .date, .time ... */ }
  res.sendStatus(200)                        // any 2xx within 10 seconds
})
PHP
<?php
$raw = file_get_contents('php://input');
$given = $_SERVER['HTTP_X_SOFTRIVO_SIGNATURE'] ?? '';
$expected = 'sha256=' . hash_hmac('sha256', $raw, getenv('SOFTRIVO_WEBHOOK_SECRET'));
if (!hash_equals($expected, $given)) { http_response_code(401); exit; }
$event = json_decode($raw, true);           // ['id', 'event', 'created_at', 'data']
$deliveryId = $_SERVER['HTTP_X_SOFTRIVO_DELIVERY'] ?? null; // unique per delivery
if ($event['event'] === 'appointment.created') { /* $event['data']['id'], ['phone'], ['date'], ['time'] */ }
http_response_code(200);
curl
# What a delivery looks like on the wire
POST /softrivo HTTP/1.1
Content-Type: application/json
X-Softrivo-Event: appointment.created
X-Softrivo-Delivery: 7c0cfd65-066a-4fb7-9a9f-3fdda05b99bb
X-Softrivo-Signature: sha256=3f2a...  (HMAC-SHA256 hex of the raw body, keyed with your secret)

{"id":"7c0cfd65-...","event":"appointment.created","created_at":"2026-11-21T02:00:00.000Z",
 "data":{"id":"...","status":"pending","customer_name":"Aisyah","phone":"60123456789","service":"Scaling",
         "date":"2026-12-01","time":"2:30 PM","scheduled_at":"2026-12-01T06:30:00.000Z","location_id":null,"notes":null}}
The URL must be https on a public host (no private addresses). Payloads only ever gain fields; your code should ignore fields it does not know. The exact shapes are in the API reference under Webhooks.

Every endpoint

All under https://api.softrivo.com/api/v1. Request and response fields are in the API reference (OpenAPI 3.1 at openapi.json).

Appointments

MethodPathPermissionWhat it does
GET/appointmentsread:appointmentsList, newest first. Filters: status, location_id, from, to.
POST/appointmentswrite:appointmentsBook: phone, date (YYYY-MM-DD), time, name?, service?, location_id?, notes?. 201, or 200 with rescheduled: true when the customer's open booking was moved.
GET/appointments/{id}read:appointmentsOne appointment.
PATCH/appointments/{id}write:appointmentsstatus (confirmed, declined, cancelled), or date + time to move it, name, service, notes.

Leads

MethodPathPermissionWhat it does
GET/leadsread:leadsList, newest first. Filters: since, score (hot, warm, cold), status.

Availability

MethodPathPermissionWhat it does
GET/availabilityread:availabilityFree times for a branch with a booking calendar: location_id?, days (1 to 31), from. Otherwise configured: false.

Customers

MethodPathPermissionWhat it does
GET/customersread:customersEveryone who has messaged you, newest first, with their latest lead and window_open. Filters: since, handler, location_id.
GET/customers/{id}read:customersOne customer. The id is the phone number with country code, or the WhatsApp username id from the list.

Conversations

MethodPathPermissionWhat it does
GET/conversations/{id}/messagesread:conversationsThe customer's thread, newest first: from (customer, bot, owner), text, media, created_at.

Messages

MethodPathPermissionWhat it does
POST/messageswrite:messagesSend a WhatsApp text: to, text, handler? (human hands the chat to a person; bot hands back). Inside the customer's 24-hour window only.

Knowledge files

MethodPathPermissionWhat it does
GET/knowledge/filesread:knowledgeThe documents the assistant answers from, with their status.
POST/knowledge/fileswrite:knowledgeUpload a pdf, docx, xlsx, xls or txt (multipart file, or JSON filename + content_base64), location_id?. Processed in the background; a same-named newer version replaces the old one.
GET/knowledge/files/{id}read:knowledgeOne file: status processing, ready or error.
DELETE/knowledge/files/{id}write:knowledgeRemove the file and what was learned from it.

Services

MethodPathPermissionWhat it does
GET/servicesread:catalogYour service menu (the only place the assistant quotes prices from). Filters: active, location_id.
POST/serviceswrite:catalogname, duration_minutes?, price?, price_note?, active?, sort?, location_id?.
GET/services/{id}read:catalogOne service.
PATCH/services/{id}write:catalogAny subset of the fields.
DELETE/services/{id}write:catalogArchive (active: false). Never a hard delete.

Listings

MethodPathPermissionWhat it does
GET/listingsread:catalogProperty or vehicle stock the assistant offers by ref code. Filters: status, kind, location_id, q.
POST/listingswrite:catalogtitle, kind?, ref_code?, status?, price? (650000 or "650k"), price_period?, area, project, property_type, bedrooms, bathrooms, size_sqft, make, model, variant, year, mileage_km, condition, description, url, agent_id?, location_id?.
GET/listings/{id}read:catalogOne listing.
PATCH/listings/{id}write:catalogAny subset, for example status: sold.
DELETE/listings/{id}write:catalogArchive (active: false).

Webhooks

MethodPathPermissionWhat it does
GET/webhookswrite:webhooksYour endpoints (never the secret).
POST/webhookswrite:webhooksurl (https, public host), events?, description?. The signing secret comes back in this answer only.
GET/webhooks/{id}write:webhooksOne endpoint.
PATCH/webhooks/{id}write:webhooksurl, events, active, description.
DELETE/webhooks/{id}write:webhooksRemove it.
POST/webhooks/{id}/testwrite:webhooksOne signed ping, sent now.
GET/webhooks/{id}/deliverieswrite:webhooksRecent deliveries and their outcome.

WhatsApp

MethodPathPermissionWhat it does
POST/whatsapp/connect-sessionswrite:whatsappCreate a one-time link the business owner opens to connect a WhatsApp number through Meta signup, with no Softrivo login: location_id?, return_url?, expires_in_minutes?. The url carries the token and is shown this once.
GET/whatsapp/connect-sessions/{id}read:whatsappThe link's status (pending, completed, failed, expired) and, once done, the connected number's safe details.
GET/whatsapp/numbersread:whatsappThe business's connected numbers (never a token, WABA id or phone number id).

Error codes

StatuscodeWhat to do
400validation_errorA field is missing or wrong; error says which. Fix the request. Do not retry as is.
401missing_api_keyNo Authorization header. Send Authorization: Bearer sk_live_… from your server.
401invalid_api_keyThe key is wrong or revoked. Create a new one on the Integrations page.
403insufficient_scopeThe key lacks the permission in required_scope. Create a key with it.
404not_foundNo such record for your business. Check the id (another business's records are 404, never 403).
409slot_fullThat time is fully booked. Offer another time (GET /availability).
409closedThe branch is closed at that time.
409window_closedThe customer has not written in the last 24 hours, so WhatsApp allows no free text. Wait for their next message (window_open on the customer) or use an approved template from the dashboard.
409no_whatsapp_numberNo number is connected, or this is a sandbox key (a sandbox has no number by design).
409duplicate_ref_codeAnother listing already uses this ref_code.
413file_too_largeFiles are 25 MB at most.
403storage_limitThe plan's storage is full (used_kb, limit_kb). Remove files or upgrade.
422idempotency_key_reusedThe same Idempotency-Key was sent with a different request. Use a new key for a new request.
400idempotency_key_invalidThe key is over 255 characters.
400limit_reachedThe ceiling for this resource (10 webhook endpoints, 300 services, 2000 listings).
429rate_limitedOver the key's limit. Wait for RateLimit-Reset seconds and retry (the SDK does).
502send_failedWhatsApp did not accept the message. Retry later; if it persists, message us with the request_id.
503not_enabledThe feature is not switched on for this business yet (migration_pending: true). Message us.
503api_not_enabledThe API is not switched on for this account yet. Message us.
503sandbox_unavailableTest keys are not available yet. Message us.
500server_errorOur fault. Retry after a moment (the SDK does); quote the request_id if it persists.

Rate limits

120 requests a minute per key, unless we agree otherwise. Every answer carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds). Over the limit answers 429 rate_limited; wait for the reset and retry. The SDK retries 429 and 5xx on its own (twice by default, honouring Retry-After). Other ceilings: 10 webhook endpoints, 300 services, 2,000 listings, 25 MB per file, and a storage allowance per plan.

SDK and tools

  • Node.js SDK: npm install @softrivo/sdk. TypeScript types for every call, no runtime dependencies, Node 18+, ESM and CommonJS. MIT licensed.
  • API reference: https://api.softrivo.com/api/v1/docs, generated from the OpenAPI document at https://api.softrivo.com/api/v1/openapi.json. Import it into Postman, Insomnia or Bruno to try every call.
  • Other languages: the API is plain HTTPS and JSON; the PHP and curl examples on this page cover every pattern. Message us if you want an SDK for your stack.

Things change only by addition: fields and endpoints are added, never removed or renamed, inside /api/v1.

Contact

Building an integration?

Tell us what you are connecting. We answer developer questions within one working day and can set up a sandbox walkthrough.

WhatsApp us