Skip to main content
POST
Invoke (Stream)
Send customer input to a Connectly AI agent and receive the agent’s reply as a streaming NDJSON response. Each line of the response body is a complete, self-contained JSON event. You must initialise a session and obtain a sessionId before calling this endpoint.
The response body is NDJSON — one JSON object per line. Do not call response.json() on the raw response; it will throw a parse error. See NDJSON streaming for the correct approach.

Endpoint

Request body

string
required
Your Connectly business identifier.
string
required
The unique identifier for the customer in this conversation.
string
required
The session ID returned by the init endpoint.
string
Optional override to target a specific agent within your configuration.
array
required
The list of events to pass to the agent. Include all events since the last call — for example, if an automated welcome message was sent, include it as an assistant messageEvent so the agent has full context.Each element is an object containing exactly one event key:

Response

A 200 status with a streaming NDJSON body. Read the response line by line; each line is a self-contained JSON event from the agent.

Example

See NDJSON streaming for a complete parsing guide.