Skip to main content
GET
Get First Message

Overview

This endpoint retrieves the agent’s first/greeting message that should be displayed when starting a new chat. Use this to initialize your chat UI before the user sends their first message, providing a welcoming experience.

Authentication

string
required
Your eigi.ai API key. Must be prefixed with vk_.

Path Parameters

string
required
The unique identifier of the agent. Example: 68ea2517dbb84c09bae1ba0a

Response

string
A new session ID created for this chat. Use this for subsequent messages.
string
The agent’s greeting/welcome message configured in the agent settings.
string
The agent ID (same as the request parameter).

Examples

Get Agent’s First Message

Response Example

Typical Workflow

Here’s how to properly initialize a chat conversation:
1

Get First Message

Call this endpoint when a user opens your chat interface.
2

Display Greeting

Show the first_message to the user in your chat UI.
3

Store Session ID

Save the session_id for use in subsequent messages.
4

Continue Chat

When the user sends a message, use the stored session_id with the chat endpoint.

Complete Chat Flow Example

JavaScript

Error Responses

Example Error Response

Best Practices

Always Initialize First: Call this endpoint before displaying your chat UI to ensure a proper greeting and valid session.
Cache When Appropriate: If you’re opening multiple chats to the same agent, you can cache the first message content (but not the session ID).
Handle Errors Gracefully: Have a fallback greeting message in case this endpoint fails.

Authorizations

X-API-Key
string
header
required

API key for authentication. Get your API key from the eigi.ai Dashboard under Settings → API Keys.

Path Parameters

agent_id
string
required

The unique agent ID

Response

Successfully retrieved first message

session_id
string

New session ID for the chat

first_message
string

Agent's greeting message

agent_id
string

The agent ID