Conversations

Get conversation by ID

get

Fetches a conversation by its unique ID. The response includes the conversation details.

Authorizations
Path parameters
idstringRequired

The ID of the conversation to retrieve.

Example: 5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b
Responses
200
Successfully retrieved the conversation.
application/json
get
GET /external/conversations/{id} HTTP/1.1
Host: api.raia2.com
Agent-Secret-Key: YOUR_API_KEY
Accept: */*
{
  "id": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
  "conversationUserId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
  "title": "Conversation Title",
  "score": 4,
  "summary": "This is a summary of the conversation.",
  "threadId": "thread_h435hi34h5i43i5",
  "metadata": {
    "customData": {
      "key1": "value1",
      "key2": "value2"
    }
  },
  "aiCallId": "call_h435hi34h5i43i5"
}

Start a new conversation

post

Start a new conversation using either an email, SMS or voice as the communication method. The response includes the conversation ID.

Authorizations
Body
one ofOptional
or
or
Responses
201
Successfully start a new conversation.
application/json
post
POST /external/conversations/start HTTP/1.1
Host: api.raia2.com
Agent-Secret-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 392

{
  "firstName": "John",
  "lastName": "Doe",
  "context": "Support",
  "conversationContext": "Support",
  "source": "webchat",
  "fkId": "123456",
  "fkUserId": "123456",
  "customData": {
    "key1": "value1",
    "key2": "value2"
  },
  "channel": "email",
  "email": "test@test.com",
  "emailSubject": "New Conversation",
  "emailIntroduction": "New Conversation",
  "includeSignatureInEmail": false,
  "phoneNumber": "+1234567890",
  "resetConversation": false
}
{
  "conversationId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b"
}

Get conversation messages

get

Fetches all messages associated with a specific conversation ID.

Authorizations
Path parameters
idstringRequired

The ID of the conversation to retrieve messages for.

Example: 5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b
Responses
200
Successfully retrieved conversation messages.
application/json
get
GET /external/conversations/{id}/messages HTTP/1.1
Host: api.raia2.com
Agent-Secret-Key: YOUR_API_KEY
Accept: */*
{
  "messages": [
    {
      "id": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
      "message": "Hello, how can I help you?",
      "rawMessage": "Raw message example",
      "conversationId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
      "senderRole": "conversation_user",
      "conversationMessageId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
      "source": "api"
    }
  ]
}

Send a message to an agent

post

Send a new message to an agent using conversationId.

Authorizations
Path parameters
idstringRequired

The ID of the conversation to send a message to.

Example: 5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b
Body
messagestringRequired

The message that the user sends to the AI agent

Example: How does quantum entanglement work?
contextstringOptional

Context of the message

Example: User is asking about quantum physics.
Responses
201
Response from the agent.
application/json
post
POST /external/conversations/{id}/messages HTTP/1.1
Host: api.raia2.com
Agent-Secret-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 99

{
  "message": "How does quantum entanglement work?",
  "context": "User is asking about quantum physics."
}
{
  "id": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
  "message": "Hello, how can I help you?",
  "rawMessage": "Raw message example",
  "conversationId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
  "senderRole": "conversation_user",
  "conversationMessageId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
  "source": "api"
}

Create a new conversation

post

Creates a new conversation . The response includes the conversation ID.

Authorizations
Body
conversationUserIdstringRequired

Conversation user ID

Example: 5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b
titlestring · max: 255Optional

Conversation title

Example: New Conversation Title
contextstring · max: 256000Optional

Conversation context

Example: New conversation context
customDataobjectOptional

Conversation custom data

Example: {"key1":"value1","key2":"value2"}
Responses
201
Successfully created a new conversation.
application/json
post
POST /external/conversations HTTP/1.1
Host: api.raia2.com
Agent-Secret-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 178

{
  "conversationUserId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
  "title": "New Conversation Title",
  "context": "New conversation context",
  "customData": {
    "key1": "value1",
    "key2": "value2"
  }
}
{
  "id": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
  "conversationUserId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b",
  "title": "Conversation Title",
  "score": 4,
  "summary": "This is a summary of the conversation.",
  "threadId": "thread_h435hi34h5i43i5",
  "metadata": {
    "customData": {
      "key1": "value1",
      "key2": "value2"
    }
  },
  "aiCallId": "call_h435hi34h5i43i5"
}

Delete all user conversations in current agent

delete

Delete all conversations associated with specified user in current agent.

Authorizations
Body
conversationUserIdstringRequired

Conversation user ID

Example: 5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b
Responses
204
Successfully delete all user conversations in current agent.
delete
DELETE /external/conversations HTTP/1.1
Host: api.raia2.com
Agent-Secret-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 61

{
  "conversationUserId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b"
}

No content