Skip to main content
Documentation

Comms

comms.search_messages

Search message text across every conversation in this shop
Read-onlyRead budget

REST

Shipping
POST /api/v1/comms/search_messages

MCP tool

Live
comms.search_messages

Exposed on: REST API · Shop MCP server · Claude connector · Dash (in-app copilot) · Zapier. Part of the Comms domain.

Operating contract

Full-text-ish search over message bodies, newest first, across the whole shop or inside one thread. This is how 'did we ever tell them the ceramic price' gets answered without reading two hundred threads.

IT SEARCHES WHAT WAS TYPED, NOT WHAT WAS SAID. A call's transcript is not a message row and does not appear here; comms.get_call_transcript reads those, one call at a time. A shop asking 'did we promise them a discount' may need both, and answering from messages alone will confidently miss a phone call.

Narrow with conversation when you already know the thread — it is much cheaper and the results are in context. Narrow with customer_id to search everything one person ever sent, across every thread they have had.

Each result carries its conversation, so comms.list_messages on that id gives you what came before and after. A match on its own is a sentence without a conversation around it.

TRUNCATION: total is how many messages match and omitted how many are not in this response. Search hits are ordered newest-first, so an omitted above zero means there are OLDER matches you have not seen — which is usually where the original promise was made. Call again with offset set to next_offset.

Who may call it

Permission
inbox.accessThe caller must hold Inbox at the ACT level. A read-only dashboard grant on the same section is refused.
Plan
Every planNo plan gate. Available on every Service VIN plan.
Retries
naturalNaturally idempotent — running it twice leaves the same world as running it once. A retrying integration needs no key.
Rate class
readCounted against the read budget — the widest of the four.

Partial answers

omitted is how many matching records are not in the response, and 0 is a real answer meaning you have all of them. Continue with next_offset.

Do not summarise from a truncated response

When `omitted` is not 0 there are OLDER matches than these — results are newest-first. Call again with `offset` set to `next_offset` before concluding something was never said.

Input

FieldTypeDescription
qrequiredstringmax 120 chars, min 2 chars

Text to look for in message bodies. At least two characters.

conversationstringuuid

Only inside this thread, as returned by comms.list_conversations.

customer_idstringuuid

Only this customer's messages, as returned by customers.list.

limitinteger1–100

How many messages to return, 1-100. Defaults to 25.

Default: 25
offsetintegermin 0

How many to skip. Pass the previous response's next_offset to continue.

Default: 0

Output

FieldTypeDescription
itemsobject[]

items[].idstring

items[].conversationstring

items[].customer_idstring | null

items[].channelstring

items[].directionstring

items[].bodystring | null

items[].statusstring

items[].created_atstring

totalnumber

omittednumber

next_offsetnumber | null

Examples

Built from this capability's own schema — required fields and the ones carrying a default, and nothing invented. Paste one and it validates.

curl
export SERVICEVIN_API_KEY=svk_live_…

curl -X POST https://www.servicevin.com/api/v1/comms/search_messages \
  -H "Authorization: Bearer $SERVICEVIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"q":"hend","limit":25,"offset":0}'

TypeScript (fetch)
const res = await fetch("https://www.servicevin.com/api/v1/comms/search_messages", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SERVICEVIN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "q": "hend",
    "limit": 25,
    "offset": 0
  }),
});

// Success and failure are both envelopes. Switch on error.code, never
// on error.message — the codes are stable, the messages are for people.
const payload = await res.json();
if (!res.ok) throw new Error(payload.error.code);
const data = payload.data;

Python (requests)
import os, requests

res = requests.post(
    "https://www.servicevin.com/api/v1/comms/search_messages",
    headers={"Authorization": f"Bearer {os.environ['SERVICEVIN_API_KEY']}"},
    json={
    "q": "hend",
    "limit": 25,
    "offset": 0
},
    timeout=30,
)
payload = res.json()
if not res.ok:
    raise RuntimeError(payload["error"]["code"])
data = payload["data"]

MCP tools/call — https://www.servicevin.com/api/mcp
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "comms.search_messages",
    "arguments": {
      "q": "hend",
      "limit": 25,
      "offset": 0
    }
  }
}

Refusals

The four gates run in this order on every surface, and the order is not arbitrary — see Authentication.

StatusCodeWhen
404not_foundThe id is unknown, or the feature is not enabled for this account. Deliberately the same answer for both.
403forbiddenThis login does not hold inbox.access.
422validation_errorAn argument was wrong. The message names the field.
429rate_limitedToo many read calls. Back off and retry.
500internal_errorSomething failed on our side. Nothing was changed.