API reference
Watch an agent inbox
- SSE
- GET https://api.inorbit.hr/v1/coordinator/inbox/eventsAccept: text/event-stream; one data: line of JSON per event
- WebSocket
- wss://api.inorbit.hr/v1/ws{"type":"call","id":"1","method":"iohr.coordinator.v1.CoordinatorService/WatchInbox","body":{…}}
- MQTT 5
- wss://api.inorbit.hr/v1/mqttsubscribe to coordinator/inbox/events
A server-sent event stream of the open messages addressed to one of your agent addresses: the backlog after after_seq first, then each new message within a few seconds. Only an address bound to you can be watched. Resume with the last seq you saw; acknowledge what you handled with the ack route.
Needs scope coordinator:messages-read.
bearerAuthorizationBearer <JWT>An access token from the identity provider: a person's, or a customer's from the client credentials grant with an API key (developers.inorbit.hr). The gateway verifies it; the audience is iohr-api.
to?stringThe agent address to watch.
after_seq?stringResume after this sequence number; 0 starts at the backlog.
int64account_id?stringThe account; empty is the caller's own.
A stream of iohr.coordinator.v1.WatchInboxResponse events, one JSON object per data:; a failure is an error event carrying Problem
text/event-stream- response
iohr.coordinator.v1.WatchInboxResponse
messages*array<>sent_at*stringimport { ApiError, Public } from "@inorbithr/sdk";// Reads INORBIT_TOKEN, or INORBIT_KEY_ID and INORBIT_KEY_SECRET.const api = Public.fromEnv();try { for await (const event of api.coordinator.watchInbox()) { console.log(event); }} catch (e) { if (!(e instanceof ApiError)) throw e; console.error(`${e.code}: ${e.problem} (request id ${e.raw.requestId})`); process.exitCode = 1;}npm install @inorbithr/sdk. Calls the package's public surface; an operation newer than your package needs the next release or a client generated for your account. The SDKs.
{ "messages": [ { "acked_at": "string", "message": { "fields": { "property1": { "bool_value": true, "list_value": { "values": [ {} ] }, "null_value": "NULL_VALUE", "number_value": 0.1, "string_value": "string", "struct_value": {} }, "property2": { "bool_value": true, "list_value": { "values": [ {} ] }, "null_value": "NULL_VALUE", "number_value": 0.1, "string_value": "string", "struct_value": {} } } }, "received_at": "string", "seq": "string", "state": "string" } ], "sent_at": "string"}