Skip to navigation

Send AI chat methods

View as MarkdownOpen in Claude

Hold a text conversation with an AI agent. All six methods travel over this endpoint in a JSON-RPC 2.0 body. Put the method name in method and its arguments in params.

Your agent is an SWML document you serve, and config_url is where you serve it. A conversation is a series of turns addressed by an id you choose. A turn is one user message and the agent’s reply, including any tool calls made along the way. One request runs one turn.

Use this endpoint from a server when a text conversation should run against an AI agent’s SWML and return each turn synchronously. It is separate from the channel-based Chat service: Chat Tokens authorize Chat clients but do not create or advance AI conversations.

Methods

MethodDescription
create_conversationCreate a conversation, or reset an existing one
chatSend a message and receive the agent’s reply
end_conversationEnd the conversation and trigger post-processing
deleteRemove the conversation, with no post-processing
chat_logRead the conversation back
summarizeGenerate a summary on demand

Permissions

The API token used to authenticate must have the following scope(s) enabled to make a successful request: Chat.

Learn more about API scopes.

Authentication

AuthorizationBasic

SignalWire Basic Authentication using Project ID and API Token.

The client sends HTTP requests with the Authorization header containing the word Basic followed by a space and a base64-encoded string of project_id:token. The project ID will be used as the username and the API token as the password.

Example:

Authorization: Basic base64(project_id:token)

Request

This endpoint expects an object.
create_conversationobjectRequired
OR
chatobjectRequired
OR
end_conversationobjectRequired
OR
deleteobjectRequired
OR
chat_logobjectRequired
OR
summarizeobjectRequired

Response

The request has succeeded.
create_conversation resultobject
OR
chat resultobject
OR
end_conversation resultobject
OR
delete resultobject
OR
chat_log resultobject
OR
summarize resultobject

The result of requesting a summary. A generated summary is returned in summary. If summary generation fails after the request succeeds, the reason can be returned in error; this is not a JSON-RPC error and carries no code.

OR
Errorobject

A JSON-RPC method failure returned under HTTP 200. After confirming the HTTP status, inspect the envelope for this error member.

Errors

400
Bad Request Error
401
Unauthorized Error
502
Bad Gateway Error