Skip to main content
This guide walks through every step required to interact with the Session Thread API. It assumes no prior knowledge and shows how to obtain credentials, create threads, send messages, and process streaming events.

1. Obtain credentials

  1. Sign in to the Envole dashboard.
  2. Navigate to API Keys and create a new key.
  3. Choose or generate a unique identifier for the end user. This value will be sent in the required X-Envole-User-Id header on every request.
  4. Store both values in environment variables:
All API calls must include two headers:
  • Authorization: Bearer <API_KEY>
  • X-Envole-User-Id: <user-id>

2. Start a session

Create a thread for your assistant. Replace placeholders with your real values.
The response includes an id field representing the thread identifier used in subsequent calls.

3. Post a message and stream events

Messages are sent to the thread and responses are streamed back using Server‑Sent Events. The request body now uses a content array where each item describes a piece of the message, such as text or files.

TypeScript / JavaScript

Python

4. Understanding events

Each data: line is a complete SseEvent object:
Events such as AGENT_RESPONSE_CHUNK, AGENT_RESPONSE_COMPLETE, TOOL_EXECUTION_APPROVAL_REQUEST, and the many NOTIFICATION_* types are documented in the Streaming reference. With these steps you can programmatically interact with your assistant and handle its streaming responses end‑to‑end.

What’s Next?

Sub Assistant Nodes

Learn how nodes define your sub-assistant’s workflows