Skip to main content

Example Workflow

  1. Open a WebSocket connection.
  2. Send a structured interactObject payload.
  3. Listen for responses and process different event types.
  4. Close the WebSocket when done.
By following this guide, users can seamlessly integrate the continueInteract WebSocket into their applications for real-time communication.

WebSocket Endpoint

The WebSocket connection URL is generated based on the region:
Where <server-region> is either:
  • eu for the European Union
  • na for the North America

Connecting to the WebSocket

Upon opening the connection, send a JSON payload to start interacting with the AI agent:

Sending Data

To send a message, structure the request as follows:

Receiving Messages

Responses from the WebSocket arrive as message stream. To listen for incoming messages from the WebSocket:

Closing the Connection

To handle WebSocket closure:

Handling Errors

To manage errors gracefully:

Response Structure

Messages received from the WebSocket follow this structure:

Conclusion

This document outlines the setup, usage, and integration of the Interact WebSocket. Developers can follow these instructions to integrate real-time AI interactions into their applications using WebSockets.