Skip to main content
Documentation

Comms

comms.resolve_contact

Find the customer a number belongs to, and whether we may message them
Read-onlyRead budget

REST

Shipping
POST /api/v1/comms/resolve_contact

MCP tool

Live
comms.resolve_contact

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

Operating contract

THE FIRST CALL WHEN SOMETHING COMES IN. A number just rang, or a text just landed, and this answers the three things needed before anything else happens: who is it, is there an open thread, and are we allowed to write back.

IT IS THE VARIANT-TOLERANT MATCH, which is what makes it different from customers.find_by_contact — and both exist on purpose. That one is an EXACT match on the normalised value and is the right call before customers.create, because a fuzzy match there would merge two people. This one tries every shape the same number is stored in across a shop's history — +14035550134, 14035550134, 4035550134, (403) 555-0134, 403-555-0134 — because an imported book and a decade of hand-typed rows do not agree on a format, and a call from a customer the shop has had for five years must still find them.

texting_blocked IS THE FIELD TO ACT ON. True means a STOP or a staff block is on file and comms.send_message will refuse — so do not draft a text, and do not treat the later refusal as an error to retry. comms.send_email may still be right if there is an address.

conversation is the customer's most recent open thread, or null when they have never had one. Pass it to comms.list_messages to read the history before replying, and to comms.send_message to land the reply in the same place instead of opening a second thread beside it.

found: null is a normal answer meaning nobody on file matches — a genuinely new caller. customers.create is what turns them into a record; do not invent one from a number alone unless the shop asked you to.

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.

Input

FieldTypeDescription
phonestringmax 40 chars

A phone number in any format — the `from` on a call or a message.

emailstringmax 200 chars

An email address, matched case-insensitively.

Output

FieldTypeDescription
foundobject | null

found.customer_idstring

found.namestring | null

found.phonestring | null

found.emailstring | null

matched_onstring | null

One of: phone, email
texting_blockedboolean

marketing_consentboolean

conversationstring | 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/resolve_contact \
  -H "Authorization: Bearer $SERVICEVIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

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

// 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/resolve_contact",
    headers={"Authorization": f"Bearer {os.environ['SERVICEVIN_API_KEY']}"},
    json={},
    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.resolve_contact",
    "arguments": {}
  }
}

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.