Skip to content

Stream the journal entries after a given one

GET
/chats/{chat}/wal/since/{id}
curl --request GET \
--url https://chat.work.optidata.cloud/api/chats/36/wal/since/0 \
--header 'Authorization: Bearer <token>'

Every entry appended after {id}, oldest first, streamed as a single JSON document. This is the polling call of a journal follower: keep the highest id you have applied, ask for what came after it, apply the entries in order, and remember the new highest id.

The server caps how many entries one call returns. When you get a full batch, call again from the last id you received rather than assuming you are caught up.

chat
required
integer format: int64

Numeric id of the conversation.

id
required
integer format: int64

Id of the last journal entry you already hold. Use 0 to start from the beginning.

The journal entries appended after the given id.

Media typeapplication/json
object
entries
required
Array<object>

One append-only entry of a conversation’s change journal. event_class names the kind of change and event_json carries its payload; entries are applied in ascending id order.

object
id

Monotonic position in the journal. Pass it to since/{id}.

integer format: int64
chat_id
integer format: int64
message_id

The message the entry is about.

integer | null format: int64
guid
string | null
optiwork_session_id

The client session that caused the change. Compare it with your own to skip the echo of your own writes.

string | null
event_class

The kind of change this entry records.

string
event_json

The payload of the change.

object | string | null
created_at
string format: date-time
updated_at
string format: date-time
Examples
ExamplecaughtUp

Nothing new

{
"entries": []
}

Missing, malformed or expired authentication key.

Media typeapplication/json

Authentication failures — and a few permission denials — use an error key rather than message.

object
error
required
string
Examples
Examplemissing

No bearer token sent

{
"error": "JWT passport exception: Missing bearer token in request"
}

The caller is not a participant of the conversation, or lacks the role the operation requires.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Exampledenied
{
"message": "This action is unauthorized."
}

The resource does not exist, or does not belong to the given conversation.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplemissing
{
"message": "No query results for model [App\\Models\\Chat\\Chat] 99999999"
}

Rate limit exceeded. Retry after the window resets.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplethrottled
{
"message": "Too Many Attempts."
}