Inbox API
Sits on top of Conversations and powers the human-agent surface — who is currently viewing what, internal notes, saved filtered views, conversation routing, and quick-reply macros. Base path:/api/v1/inbox
Authentication: API key (X-API-Key) or session JWT. The dashboard uses a Clerk session, and server-to-server callers can use an API key against the same endpoints.
Using the SDKs
Node.js SDK
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
// Create a saved view — a persistent, filterable inbox section
const view = await orbit.inbox.savedViews.create({
name: "Unanswered on SMS",
filters: { channel: "sms", unread: true },
shared: false,
});
const views = await orbit.inbox.savedViews.list();
console.log(view.data.id, views.data.length);
from orbit_sdk import OrbitClient
client = OrbitClient.from_env() # reads ORBIT_API_KEY
view = client.request("POST", "/inbox/saved-views", json_body={
"name": "Unanswered on SMS",
"filters": {"channel": "sms", "unread": True},
})
print(view["data"]["id"])
client.request() escape hatch above. See the Python SDK.
Returns the typed ApiResponse envelope. See the SDK index at SDK quickstart.
Programmatic reply, read, and triage
Most of an inbox automation is one loop: read the open queue, send a reply (or close, tag, assign), and move on. The endpoints below are the conversation lifecycle — they belong to the Conversations API, which is the canonical reference for each lifecycle action — and they are the three calls a CCaaS builder touches first. All six SDK languages below run the same sequence against the same conversation id. The Node SDK wraps this whole page (inbox.savedViews, inbox.notes, inbox.views, inbox.routingRules, inbox.macros); the other five SDKs reach it through their generic escape-hatch request methods shown here.
cURL
# 1. Read the open SMS queue (unfiltered open conversations, newest first)
curl "https://api.orbit.devotel.io/api/v1/conversations?statuses=open&limit=25" \ \
-H "X-API-Key: $ORBIT_API_KEY"
# 2. Reply in the conversation's inbound channel
curl -X POST "https://api.orbit.devotel.io/api/v1/conversations/conv_9f3a2b/reply" \
-H "X-API-Key: $ORBIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"body": "We re-issued the refund — the funds will land within 5 business days."}'
# 3. Triage: close the conversation, or tag/assign it for follow-up
curl -X POST "https://api.orbit.devotel.io/api/v1/conversations/conv_9f3a2b/close" \
-H "X-API-Key: $ORBIT_API_KEY"
Node.js SDK
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
// 1. Read the open queue
const open = await orbit.request("GET", "/conversations?statuses=open&limit=25");
// 2. Reply in the conversation's inbound channel
const reply = await orbit.request("POST", "/conversations/conv_9f3a2b/reply", {
body: "We re-issued the refund — the funds will land within 5 business days.",
});
// 3. Triage: close it (swap in /tags or /assign for the other cleanup paths)
const closed = await orbit.request("POST", "/conversations/conv_9f3a2b/close");
console.log(closed.data.status); // 'closed'
Python
# pip install devotel-orbit-sdk
from orbit_sdk import OrbitClient
client = OrbitClient.from_env() # reads ORBIT_API_KEY
# 1. Read the open queue
open_q = client.request("GET", "/conversations?statuses=open&limit=25")
# 2. Reply in the conversation's inbound channel
reply = client.request(
"POST",
"/conversations/conv_9f3a2b/reply",
json_body={"body": "We re-issued the refund — the funds will land within 5 business days."},
)
# 3. Triage: close it (swap in /tags or /assign for the other cleanup paths)
closed = client.request("POST", "/conversations/conv_9f3a2b/close")
print(closed["data"]["status"]) # 'closed'
Go
// go get github.com/devotel/orbit-go — module path, not yet on a public proxy
package main
import (
"context"
"fmt"
"os"
"github.com/devotel/orbit-go/orbit"
)
func main() {
client := orbit.NewClientFromAPIKey(os.Getenv("ORBIT_API_KEY"))
ctx := context.Background()
// 1. Read the open queue
var openQueue map[string]any
err := client.Request(ctx, "GET", "/conversations?statuses=open&limit=25", nil, nil, &openQueue, "")
if err != nil {
panic(err)
}
// 2. Reply in the conversation's inbound channel
var reply map[string]any
err = client.Request(ctx, "POST", "/conversations/conv_9f3a2b/reply", nil, map[string]any{
"body": "We re-issued the refund — the funds will land within 5 business days.",
}, &reply, "")
if err != nil {
panic(err)
}
// 3. Triage: close it (swap in /tags or /assign for the other cleanup paths)
var closed map[string]any
err = client.Request(ctx, "POST", "/conversations/conv_9f3a2b/close", nil, nil, &closed, "")
if err != nil {
panic(err)
}
fmt.Println(closed["data"].(map[string]any)["status"]) // 'closed'
}
Ruby
# Ruby SDK ships vendored from source (see /sdks/ruby).
require "orbit_sdk"
client = OrbitSdk::Client.from_env
# 1. Read the open queue
open_queue = client.request("GET", "/conversations?statuses=open&limit=25")
# 2. Reply in the conversation's inbound channel
reply = client.request(
"POST",
"/conversations/conv_9f3a2b/reply",
json_body: { body: "We re-issued the refund — the funds will land within 5 business days." }
)
# 3. Triage: close it (swap in /tags or /assign for the other cleanup paths)
closed = client.request("POST", "/conversations/conv_9f3a2b/close")
puts closed.fetch("data").fetch("status") # 'closed'
PHP
<?php
// PHP SDK ships vendored from source (see /sdks/php).
use Devotel\Orbit\OrbitClient;
$client = OrbitClient::fromEnv();
// 1. Read the open queue
$openQueue = $client->request("GET", "/conversations?statuses=open&limit=25");
// 2. Reply in the conversation's inbound channel
$reply = $client->request("POST", "/conversations/conv_9f3a2b/reply", null, [
"body" => "We re-issued the refund — the funds will land within 5 business days.",
]);
// 3. Triage: close it (swap in /tags or /assign for the other cleanup paths)
$closed = $client->request("POST", "/conversations/conv_9f3a2b/close");
echo $closed["data"]["status"] . PHP_EOL; // 'closed'
{
"data": {
"id": "msg_4c1b9a2f",
"conversation_id": "conv_9f3a2b",
"direction": "outbound",
"channel": "sms",
"body": "We re-issued the refund — the funds will land within 5 business days.",
"status": "queued",
"created_at": "2026-08-24T09:48:07Z"
},
"meta": { "request_id": "req_01J8ZR…", "timestamp": "2026-08-24T09:48:07Z" }
}
statuses/channels/assignee parameters mirror the saved-view filter AST documented under Saved views below, so whatever your team views in the dashboard you can reproduce as an automatable queue.
Live presence
Used by the inbox UI to show “X is viewing” + typing indicators. Heartbeat the viewing endpoint roughly every 20 seconds while the conversation is open. The server holds presence for a 30-second TTL, so a 20-second cadence keeps it alive with margin — heartbeating at the full 30 seconds races the TTL and intermittently drops your own presence.| Method | Path | Purpose |
|---|---|---|
POST | /api/v1/inbox/{conversationId}/viewing | Heartbeat — register caller as viewing |
DELETE | /api/v1/inbox/{conversationId}/viewing | Unregister (tab close / route away) |
GET | /api/v1/inbox/{conversationId}/viewers | Who is currently viewing |
POST | /api/v1/inbox/{conversationId}/typing | Toggle the caller’s typing state |
Example — heartbeat a conversation every 20 seconds
1. Register as viewing (send on open, then repeat every ~20 s):curl -X POST https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/viewing \
-H "X-API-Key: dv_live_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "session_id": "tab_a1B2c3D4" }'
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
const { data } = await orbit.request("POST", "/inbox/conv_9f3a2b/viewing", {
session_id: "tab_a1B2c3D4",
});
console.log("TTL seconds:", data.ttl_seconds);
import os
import requests
r = requests.post(
"https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/viewing",
headers={
"X-API-Key": os.environ["ORBIT_API_KEY"],
"Content-Type": "application/json",
},
json={"session_id": "tab_a1B2c3D4"},
)
print("TTL seconds:", r.json()["data"]["ttl_seconds"])
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("POST",
"https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/viewing",
bytes.NewReader([]byte(`{ "session_id": "tab_a1B2c3D4" }`)))
req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("status:", resp.StatusCode)
}
require "net/http"
require "uri"
uri = URI("https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/viewing")
req = Net::HTTP::Post.new(uri)
req["X-API-Key"] = ENV["ORBIT_API_KEY"]
req["Content-Type"] = "application/json"
req.body = '{ "session_id": "tab_a1B2c3D4" }'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code
<?php
$ch = curl_init("https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/viewing");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("ORBIT_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{ "session_id": "tab_a1B2c3D4" }');
echo curl_exec($ch);
{
"data": {
"viewing": true,
"ttl_seconds": 30,
"beacon_token": "eyJhbGciOi…",
"beacon_ctx": "eyJvcmdJZCI6…",
"beacon_ttl_seconds": 3600
},
"meta": { "request_id": "req_01J8XA…", "timestamp": "2026-08-24T09:42:11Z" }
}
ttl_seconds: 30 is the caveat from above, verbatim: refresh well inside 30 seconds — the dashboard heartbeats at 20 seconds so a slow call still lands before the TTL expires. session_id is optional; pass it when a user can have several tabs open so each tab registers its own presence row.
2. Read the current viewers:
curl https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/viewers \
-H "X-API-Key: dv_live_sk_your_key_here"
{
"data": {
"viewers": ["user_2hF9kLmWq3vX8yZ0aBcD1eF2g", "user_4jK8nPxRs5wB1cZ2bDdE3fG4h"]
},
"meta": { "request_id": "req_01J8XB…", "timestamp": "2026-08-24T09:42:12Z" }
}
curl -X POST https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/typing \
-H "X-API-Key: dv_live_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "typing": true, "session_id": "tab_a1B2c3D4" }'
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
await orbit.request("POST", "/inbox/conv_9f3a2b/typing", {
typing: true,
session_id: "tab_a1B2c3D4",
});
import os
import requests
requests.post(
"https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/typing",
headers={
"X-API-Key": os.environ["ORBIT_API_KEY"],
"Content-Type": "application/json",
},
json={"typing": True, "session_id": "tab_a1B2c3D4"},
)
package main
import (
"bytes"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("POST",
"https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/typing",
bytes.NewReader([]byte(`{ "typing": true, "session_id": "tab_a1B2c3D4" }`)))
req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
}
require "net/http"
require "uri"
uri = URI("https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/typing")
req = Net::HTTP::Post.new(uri)
req["X-API-Key"] = ENV["ORBIT_API_KEY"]
req["Content-Type"] = "application/json"
req.body = '{ "typing": true, "session_id": "tab_a1B2c3D4" }'
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
<?php
$ch = curl_init("https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/typing");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("ORBIT_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{ "typing": true, "session_id": "tab_a1B2c3D4" }');
curl_exec($ch);
{
"data": { "typing": true },
"meta": { "request_id": "req_01J8XD…", "timestamp": "2026-08-24T09:42:14Z" }
}
DELETE /{conversationId}/viewing unregisters immediately rather than waiting out the 30-second TTL.
Internal notes
Team-only notes attached to a conversation. Never visible to the contact; surfaced inline with messages in the inbox UI.| Method | Path | Purpose |
|---|---|---|
POST | /api/v1/inbox/{conversationId}/internal-notes | Post an internal note |
GET | /api/v1/inbox/{conversationId}/internal-notes | List internal notes (newest first) |
Example — post a note with a mention
curl -X POST https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/internal-notes \
-H "X-API-Key: dv_live_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"content": "Customer says the refund never arrived — @Priya, can you re-issue it? Their order number is #4120.",
"mentions": ["user_4jK8nPxRs5wB1cZ2bDdE3fG4h"]
}'
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
const { data } = await orbit.request("POST", "/inbox/conv_9f3a2b/internal-notes", {
content: "Customer says the refund never arrived — @Priya, can you re-issue it? Their order number is #4120.",
mentions: ["user_4jK8nPxRs5wB1cZ2bDdE3fG4h"],
});
console.log("Note id:", data.id);
import os
import requests
r = requests.post(
"https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/internal-notes",
headers={
"X-API-Key": os.environ["ORBIT_API_KEY"],
"Content-Type": "application/json",
},
json={
"content": "Customer says the refund never arrived — @Priya, can you re-issue it? Their order number is #4120.",
"mentions": ["user_4jK8nPxRs5wB1cZ2bDdE3fG4h"],
},
)
print("Note id:", r.json()["data"]["id"])
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := `{
"content": "Customer says the refund never arrived — @Priya, can you re-issue it? Their order number is #4120.",
"mentions": ["user_4jK8nPxRs5wB1cZ2bDdE3fG4h"]
}`
req, _ := http.NewRequest("POST",
"https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/internal-notes",
bytes.NewReader([]byte(body)))
req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("status:", resp.StatusCode)
}
require "net/http"
require "json"
require "uri"
uri = URI("https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/internal-notes")
req = Net::HTTP::Post.new(uri)
req["X-API-Key"] = ENV["ORBIT_API_KEY"]
req["Content-Type"] = "application/json"
req.body = {
content: "Customer says the refund never arrived — @Priya, can you re-issue it? Their order number is #4120.",
mentions: ["user_4jK8nPxRs5wB1cZ2bDdE3fG4h"],
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)["data"]["id"]
<?php
$ch = curl_init("https://api.orbit.devotel.io/api/v1/inbox/conv_9f3a2b/internal-notes");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("ORBIT_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"content" => "Customer says the refund never arrived — @Priya, can you re-issue it? Their order number is #4120.",
"mentions" => ["user_4jK8nPxRs5wB1cZ2bDdE3fG4h"],
]));
echo curl_exec($ch);
mentions carries the user ids your typeahead resolved while composing; each mentioned user gets a Notification Center entry. Response (201):
{
"data": {
"id": "note_71c0d4e2",
"conversation_id": "conv_9f3a2b",
"author_user_id": "user_2hF9kLmWq3vX8yZ0aBcD1eF2g",
"content": "Customer says the refund never arrived — @Priya, can you re-issue it? Their order number is #4120.",
"mentions": ["user_4jK8nPxRs5wB1cZ2bDdE3fG4h"],
"created_at": "2026-08-24T09:45:02Z",
"updated_at": null
},
"meta": { "request_id": "req_01J8Y2…", "timestamp": "2026-08-24T09:45:02Z" }
}
Saved views
Personal or team-wide filtered views over the conversation list — “My open WhatsApp conversations”, “VIP escalations”, “Stale > 4h”, etc.| Method | Path | Purpose |
|---|---|---|
GET | /api/v1/inbox/views | List personal + team views |
POST | /api/v1/inbox/views | Create a view |
PATCH | /api/v1/inbox/views/{id} | Rename, reorder, or re-filter |
DELETE | /api/v1/inbox/views/{id} | Delete |
Example — create a team view with filters
curl -X POST https://api.orbit.devotel.io/api/v1/inbox/views \
-H "X-API-Key: dv_live_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Support team — open WhatsApp",
"scope": "team",
"filters": {
"channels": ["whatsapp"],
"statuses": ["open", "pending"],
"assignee": "team_support"
},
"sort_key": "-last_message_at",
"is_pinned": true,
"color": "#25D366"
}'
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
const { data } = await orbit.request("POST", "/inbox/views", {
name: "Support team — open WhatsApp",
scope: "team",
filters: {
channels: ["whatsapp"],
statuses: ["open", "pending"],
assignee: "team_support",
},
sort_key: "-last_message_at",
is_pinned: true,
color: "#25D366",
});
console.log("View id:", data.id);
import os
import requests
r = requests.post(
"https://api.orbit.devotel.io/api/v1/inbox/views",
headers={
"X-API-Key": os.environ["ORBIT_API_KEY"],
"Content-Type": "application/json",
},
json={
"name": "Support team — open WhatsApp",
"scope": "team",
"filters": {
"channels": ["whatsapp"],
"statuses": ["open", "pending"],
"assignee": "team_support",
},
"sort_key": "-last_message_at",
"is_pinned": True,
"color": "#25D366",
},
)
print("View id:", r.json()["data"]["id"])
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := `{
"name": "Support team — open WhatsApp",
"scope": "team",
"filters": {
"channels": ["whatsapp"],
"statuses": ["open", "pending"],
"assignee": "team_support"
},
"sort_key": "-last_message_at",
"is_pinned": true,
"color": "#25D366"
}`
req, _ := http.NewRequest("POST",
"https://api.orbit.devotel.io/api/v1/inbox/views",
bytes.NewReader([]byte(body)))
req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("status:", resp.StatusCode)
}
require "net/http"
require "json"
require "uri"
uri = URI("https://api.orbit.devotel.io/api/v1/inbox/views")
req = Net::HTTP::Post.new(uri)
req["X-API-Key"] = ENV["ORBIT_API_KEY"]
req["Content-Type"] = "application/json"
req.body = {
name: "Support team — open WhatsApp",
scope: "team",
filters: {
channels: ["whatsapp"],
statuses: ["open", "pending"],
assignee: "team_support",
},
sort_key: "-last_message_at",
is_pinned: true,
color: "#25D366",
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)["data"]["id"]
<?php
$ch = curl_init("https://api.orbit.devotel.io/api/v1/inbox/views");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("ORBIT_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"name" => "Support team — open WhatsApp",
"scope" => "team",
"filters" => [
"channels" => ["whatsapp"],
"statuses" => ["open", "pending"],
"assignee" => "team_support",
],
"sort_key" => "-last_message_at",
"is_pinned" => true,
"color" => "#25D366",
]));
echo curl_exec($ch);
filters object is the shared inbox filter AST — channels, statuses, assignee, tags, unread, search, date ranges, and more; every field is optional and combines conjunctively. scope: "team" requires owner/admin; "personal" (default) is visible only to you. Response (201):
{
"data": {
"id": "d1b2f3a4-8c1d-4e2f-9b0a-5d6e7f8a9b0c",
"name": "Support team — open WhatsApp",
"scope": "team",
"filters": {
"channels": ["whatsapp"],
"statuses": ["open", "pending"],
"assignee": "team_support"
},
"sort_key": "-last_message_at",
"is_default": false,
"is_pinned": true,
"color": "#25D366",
"created_at": "2026-08-24T09:47:20Z",
"updated_at": "2026-08-24T09:47:20Z"
},
"meta": { "request_id": "req_01J902…", "timestamp": "2026-08-24T09:47:20Z" }
}
Routing rules
Auto-assign incoming conversations to agents or teams based on channel, contact, content, or time. Rules are evaluated in priority order; first match wins.| Method | Path | Purpose |
|---|---|---|
GET | /api/v1/inbox/routing-rules | List rules |
POST | /api/v1/inbox/routing-rules | Create a rule |
PATCH | /api/v1/inbox/routing-rules/{id} | Update name, priority, condition, action |
DELETE | /api/v1/inbox/routing-rules/{id} | Delete a rule |
POST | /api/v1/inbox/routing-rules/test | Dry-run a rule against a sample conversation |
Example — create a rule, then dry-run it
Create (owner/admin only — routing writes are team-wide):curl -X POST https://api.orbit.devotel.io/api/v1/inbox/routing-rules \
-H "X-API-Key: dv_live_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Refund keywords → refunds team",
"conditions": {
"channel": ["whatsapp", "sms"],
"keyword": ["refund", "charged twice", "money back"],
"time_of_day": { "outside_hours": false, "days": [1, 2, 3, 4, 5], "start": "09:00", "end": "18:00" }
},
"action": { "type": "assign_team", "target_id": "team_refunds" },
"schedule": null
}'
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
const { data } = await orbit.request("POST", "/inbox/routing-rules", {
name: "Refund keywords → refunds team",
conditions: {
channel: ["whatsapp", "sms"],
keyword: ["refund", "charged twice", "money back"],
time_of_day: { outside_hours: false, days: [1, 2, 3, 4, 5], start: "09:00", end: "18:00" },
},
action: { type: "assign_team", target_id: "team_refunds" },
schedule: null,
});
console.log("Rule id:", data.id);
import os
import requests
r = requests.post(
"https://api.orbit.devotel.io/api/v1/inbox/routing-rules",
headers={
"X-API-Key": os.environ["ORBIT_API_KEY"],
"Content-Type": "application/json",
},
json={
"name": "Refund keywords → refunds team",
"conditions": {
"channel": ["whatsapp", "sms"],
"keyword": ["refund", "charged twice", "money back"],
"time_of_day": {"outside_hours": False, "days": [1, 2, 3, 4, 5], "start": "09:00", "end": "18:00"},
},
"action": {"type": "assign_team", "target_id": "team_refunds"},
"schedule": None,
},
)
print("Rule id:", r.json()["data"]["id"])
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := `{
"name": "Refund keywords → refunds team",
"conditions": {
"channel": ["whatsapp", "sms"],
"keyword": ["refund", "charged twice", "money back"],
"time_of_day": { "outside_hours": false, "days": [1, 2, 3, 4, 5], "start": "09:00", "end": "18:00" }
},
"action": { "type": "assign_team", "target_id": "team_refunds" },
"schedule": null
}`
req, _ := http.NewRequest("POST",
"https://api.orbit.devotel.io/api/v1/inbox/routing-rules",
bytes.NewReader([]byte(body)))
req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("status:", resp.StatusCode)
}
require "net/http"
require "json"
require "uri"
uri = URI("https://api.orbit.devotel.io/api/v1/inbox/routing-rules")
req = Net::HTTP::Post.new(uri)
req["X-API-Key"] = ENV["ORBIT_API_KEY"]
req["Content-Type"] = "application/json"
req.body = {
name: "Refund keywords → refunds team",
conditions: {
channel: ["whatsapp", "sms"],
keyword: ["refund", "charged twice", "money back"],
time_of_day: { outside_hours: false, days: [1, 2, 3, 4, 5], start: "09:00", end: "18:00" },
},
action: { type: "assign_team", target_id: "team_refunds" },
schedule: nil,
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)["data"]["id"]
<?php
$ch = curl_init("https://api.orbit.devotel.io/api/v1/inbox/routing-rules");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("ORBIT_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"name" => "Refund keywords → refunds team",
"conditions" => [
"channel" => ["whatsapp", "sms"],
"keyword" => ["refund", "charged twice", "money back"],
"time_of_day" => ["outside_hours" => false, "days" => [1, 2, 3, 4, 5], "start" => "09:00", "end" => "18:00"],
],
"action" => ["type" => "assign_team", "target_id" => "team_refunds"],
"schedule" => null,
]));
echo curl_exec($ch);
conditions + action shape is strict (unknown fields are rejected with VALIDATION_ERROR). keyword entries are plain substrings, or /regex/ patterns — regexes that risk ReDoS are rejected at save time. time_of_day narrows the match to a weekly window (here: weekdays 09:00–18:00); omit it to match around the clock. Action types: assign_user, assign_team, assign_round_robin, assign_skill_based, set_tag, set_priority, trigger_agent.
Response (201):
{
"data": {
"id": "9c8b7a6d-5e4f-3c2d-1b0a-9e8d7c6b5a4f",
"name": "Refund keywords → refunds team",
"priority": 1,
"enabled": true,
"conditions": {
"channel": ["whatsapp", "sms"],
"keyword": ["refund", "charged twice", "money back"],
"time_of_day": { "outside_hours": false, "days": [1, 2, 3, 4, 5], "start": "09:00", "end": "18:00" }
},
"action": { "type": "assign_team", "target_id": "team_refunds" },
"schedule": null,
"created_by": "user_2hF9kLmWq3vX8yZ0aBcD1eF2g",
"created_at": "2026-08-24T09:50:04Z",
"updated_at": "2026-08-24T09:50:04Z"
},
"meta": { "request_id": "req_01J93K…", "timestamp": "2026-08-24T09:50:04Z" }
}
curl -X POST https://api.orbit.devotel.io/api/v1/inbox/routing-rules/test \
-H "X-API-Key: dv_live_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"rule_id": "9c8b7a6d-5e4f-3c2d-1b0a-9e8d7c6b5a4f",
"sample_conversation": {
"channel": "whatsapp",
"body": "Hi, I was charged twice — looking for a refund please.",
"now": "2026-08-24T09:50:30Z"
}
}'
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
const { data } = await orbit.request("POST", "/inbox/routing-rules/test", {
rule_id: "9c8b7a6d-5e4f-3c2d-1b0a-9e8d7c6b5a4f",
sample_conversation: {
channel: "whatsapp",
body: "Hi, I was charged twice — looking for a refund please.",
now: "2026-08-24T09:50:30Z",
},
});
console.log(data.matched, data.action?.type);
import os
import requests
r = requests.post(
"https://api.orbit.devotel.io/api/v1/inbox/routing-rules/test",
headers={
"X-API-Key": os.environ["ORBIT_API_KEY"],
"Content-Type": "application/json",
},
json={
"rule_id": "9c8b7a6d-5e4f-3c2d-1b0a-9e8d7c6b5a4f",
"sample_conversation": {
"channel": "whatsapp",
"body": "Hi, I was charged twice — looking for a refund please.",
"now": "2026-08-24T09:50:30Z",
},
},
)
print(r.json()["data"]["matched"])
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := `{
"rule_id": "9c8b7a6d-5e4f-3c2d-1b0a-9e8d7c6b5a4f",
"sample_conversation": {
"channel": "whatsapp",
"body": "Hi, I was charged twice — looking for a refund please.",
"now": "2026-08-24T09:50:30Z"
}
}`
req, _ := http.NewRequest("POST",
"https://api.orbit.devotel.io/api/v1/inbox/routing-rules/test",
bytes.NewReader([]byte(body)))
req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("status:", resp.StatusCode)
}
require "net/http"
require "json"
require "uri"
uri = URI("https://api.orbit.devotel.io/api/v1/inbox/routing-rules/test")
req = Net::HTTP::Post.new(uri)
req["X-API-Key"] = ENV["ORBIT_API_KEY"]
req["Content-Type"] = "application/json"
req.body = {
rule_id: "9c8b7a6d-5e4f-3c2d-1b0a-9e8d7c6b5a4f",
sample_conversation: {
channel: "whatsapp",
body: "Hi, I was charged twice — looking for a refund please.",
now: "2026-08-24T09:50:30Z",
},
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)["data"]["matched"]
<?php
$ch = curl_init("https://api.orbit.devotel.io/api/v1/inbox/routing-rules/test");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("ORBIT_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"rule_id" => "9c8b7a6d-5e4f-3c2d-1b0a-9e8d7c6b5a4f",
"sample_conversation" => [
"channel" => "whatsapp",
"body" => "Hi, I was charged twice — looking for a refund please.",
"now" => "2026-08-24T09:50:30Z",
],
]));
echo curl_exec($ch);
{
"data": {
"matched": true,
"detected_language": "en",
"org_timezone": "UTC",
"action": { "type": "assign_team", "target_id": "team_refunds" }
},
"meta": { "request_id": "req_01J94R…", "timestamp": "2026-08-24T09:50:30Z" }
}
rule (an inline create-style body) instead of rule_id to preview a rule before saving it. When matched is false, action comes back null — so a false verdict reads as { "matched": false, "action": null }.
Macros
Saved quick replies with optional variables, attachments, and post-actions (close, tag, assign).| Method | Path | Purpose |
|---|---|---|
GET | /api/v1/inbox/macros | List personal + shared macros |
POST | /api/v1/inbox/macros | Create a macro |
GET | /api/v1/inbox/macros/popular | Most-used macros for this user |
PATCH | /api/v1/inbox/macros/{id} | Update a macro |
DELETE | /api/v1/inbox/macros/{id} | Delete a macro |
POST | /api/v1/inbox/conversations/{convId}/run-macro | Apply a macro to a conversation |
Example — create a macro, then run it
Create with a mustache variable and a follow-up step:curl -X POST https://api.orbit.devotel.io/api/v1/inbox/macros \
-H "X-API-Key: dv_live_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Refund acknowledgement",
"shortcut": "refund-ack",
"is_shared": true,
"steps": [
{
"type": "send_message",
"config": { "body": "Hi {{contact.first_name}}, we received your refund request {{extra.order_id}} — the funds will reach your account within 5 business days." }
},
{ "type": "add_tag", "config": { "tags": ["refund-in-progress"] } },
{ "type": "set_status", "config": { "status": "pending" } }
]
}'
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
const { data } = await orbit.request("POST", "/inbox/macros", {
name: "Refund acknowledgement",
shortcut: "refund-ack",
is_shared: true,
steps: [
{
type: "send_message",
config: { body: "Hi {{contact.first_name}}, we received your refund request {{extra.order_id}} — the funds will reach your account within 5 business days." },
},
{ type: "add_tag", config: { tags: ["refund-in-progress"] } },
{ type: "set_status", config: { status: "pending" } },
],
});
console.log("Macro id:", data.id);
import os
import requests
r = requests.post(
"https://api.orbit.devotel.io/api/v1/inbox/macros",
headers={
"X-API-Key": os.environ["ORBIT_API_KEY"],
"Content-Type": "application/json",
},
json={
"name": "Refund acknowledgement",
"shortcut": "refund-ack",
"is_shared": True,
"steps": [
{"type": "send_message", "config": {"body": "Hi {{contact.first_name}}, we received your refund request {{extra.order_id}} — the funds will reach your account within 5 business days."}},
{"type": "add_tag", "config": {"tags": ["refund-in-progress"]}},
{"type": "set_status", "config": {"status": "pending"}},
],
},
)
print("Macro id:", r.json()["data"]["id"])
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
body := `{
"name": "Refund acknowledgement",
"shortcut": "refund-ack",
"is_shared": true,
"steps": [
{ "type": "send_message", "config": { "body": "Hi {{contact.first_name}}, we received your refund request {{extra.order_id}} — the funds will reach your account within 5 business days." } },
{ "type": "add_tag", "config": { "tags": ["refund-in-progress"] } },
{ "type": "set_status", "config": { "status": "pending" } }
]
}`
req, _ := http.NewRequest("POST",
"https://api.orbit.devotel.io/api/v1/inbox/macros",
bytes.NewReader([]byte(body)))
req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("status:", resp.StatusCode)
}
require "net/http"
require "json"
require "uri"
uri = URI("https://api.orbit.devotel.io/api/v1/inbox/macros")
req = Net::HTTP::Post.new(uri)
req["X-API-Key"] = ENV["ORBIT_API_KEY"]
req["Content-Type"] = "application/json"
req.body = {
name: "Refund acknowledgement",
shortcut: "refund-ack",
is_shared: true,
steps: [
{ type: "send_message", config: { body: "Hi {{contact.first_name}}, we received your refund request {{extra.order_id}} — the funds will reach your account within 5 business days." } },
{ type: "add_tag", config: { tags: ["refund-in-progress"] } },
{ type: "set_status", config: { status: "pending" } },
],
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)["data"]["id"]
<?php
$ch = curl_init("https://api.orbit.devotel.io/api/v1/inbox/macros");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("ORBIT_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"name" => "Refund acknowledgement",
"shortcut" => "refund-ack",
"is_shared" => true,
"steps" => [
["type" => "send_message", "config" => ["body" => "Hi {{contact.first_name}}, we received your refund request {{extra.order_id}} — the funds will reach your account within 5 business days."]],
["type" => "add_tag", "config" => ["tags" => ["refund-in-progress"]]],
["type" => "set_status", "config" => ["status" => "pending"]],
],
]));
echo curl_exec($ch);
{
"data": {
"id": "4f3e2d1c-0b9a-6d5c-4e3f-2a1b0c9d8e7f",
"name": "Refund acknowledgement",
"shortcut": "refund-ack",
"is_shared": true,
"usage_count": 0,
"created_at": "2026-08-24T09:52:11Z",
"updated_at": "2026-08-24T09:52:11Z"
},
"meta": { "request_id": "req_01J96P…", "timestamp": "2026-08-24T09:52:11Z" }
}
{{extra.*}} variables:
curl -X POST https://api.orbit.devotel.io/api/v1/inbox/conversations/conv_9f3a2b/run-macro \
-H "X-API-Key: dv_live_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "macroId": "4f3e2d1c-0b9a-6d5c-4e3f-2a1b0c9d8e7f", "variables": { "order_id": "#4120" } }'
import { Orbit } from "@devotel-orbit/node";
const orbit = new Orbit({ apiKey: process.env.ORBIT_API_KEY! });
const { data } = await orbit.request("POST", "/inbox/conversations/conv_9f3a2b/run-macro", {
macroId: "4f3e2d1c-0b9a-6d5c-4e3f-2a1b0c9d8e7f",
variables: { order_id: "#4120" },
});
console.log(`${data.completed_steps}/${data.total_steps} steps completed`);
import os
import requests
r = requests.post(
"https://api.orbit.devotel.io/api/v1/inbox/conversations/conv_9f3a2b/run-macro",
headers={
"X-API-Key": os.environ["ORBIT_API_KEY"],
"Content-Type": "application/json",
},
json={"macroId": "4f3e2d1c-0b9a-6d5c-4e3f-2a1b0c9d8e7f", "variables": {"order_id": "#4120"}},
)
print(f"{r.json()['data']['completed_steps']}/{r.json()['data']['total_steps']} steps completed")
package main
import (
"bytes"
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("POST",
"https://api.orbit.devotel.io/api/v1/inbox/conversations/conv_9f3a2b/run-macro",
bytes.NewReader([]byte(`{ "macroId": "4f3e2d1c-0b9a-6d5c-4e3f-2a1b0c9d8e7f", "variables": { "order_id": "#4120" } }`)))
req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("status:", resp.StatusCode)
}
require "net/http"
require "json"
require "uri"
uri = URI("https://api.orbit.devotel.io/api/v1/inbox/conversations/conv_9f3a2b/run-macro")
req = Net::HTTP::Post.new(uri)
req["X-API-Key"] = ENV["ORBIT_API_KEY"]
req["Content-Type"] = "application/json"
req.body = { macroId: "4f3e2d1c-0b9a-6d5c-4e3f-2a1b0c9d8e7f", variables: { order_id: "#4120" } }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)["data"]
puts "#{data['completed_steps']}/#{data['total_steps']} steps completed"
<?php
$ch = curl_init("https://api.orbit.devotel.io/api/v1/inbox/conversations/conv_9f3a2b/run-macro");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("ORBIT_API_KEY"),
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"macroId" => "4f3e2d1c-0b9a-6d5c-4e3f-2a1b0c9d8e7f",
"variables" => ["order_id" => "#4120"],
]));
echo curl_exec($ch);
{
"data": {
"run_log_id": "macro_run_7c91ad",
"completed_steps": 3,
"total_steps": 3,
"failed_step": null,
"error": null,
"rolled_back_steps": 0
},
"meta": { "request_id": "req_01J98W…", "timestamp": "2026-08-24T09:52:19Z" }
}
{{contact.first_name}} resolve from the conversation’s contact; anything you pass in variables is exposed to the template as {{extra.<key>}}. On a partial failure the run returns HTTP 207 and failed_step reports the 1-based index of the step that threw.
See also
- Conversations API — the lifecycle this surface decorates