Skip to main content

Create a Conversation

Overview

To start chatting with your assistant you need a Conversation to send messages to.
In this guide we will show you how to create a new conversation.

Prerequisites

  • apiKey: The API key you want to use to create a conversation. (Get Assistant API Key)
  • assistantId: The ID of the assistant you want to create a conversation for.

Request

Endpoint

Make a POST request to the following endpoint:

https://api.pupau.ai/chat-bots/:assistantId/conversations

Request Headers

Api-Key: <apiKey>

Request Body

{
"title": "A New Conversation with Your Assistant",
"data": {},
"source" : "INTEGRATION"
}
  • title: An initial title for the conversation. After the first message is sent, this will be automatically updated to a contextually relevant title based on the conversation content.
  • data: Is an object that can be used to store any useful data for user recognition in integrations with authenticated user areas.
  • source: The source of the conversation, always use "INTEGRATION".

Response

In the response you will receive a JSON object. Inside this object there are various fields, but the two key fields are:

  • id: The ID of the conversation (will be referred to as conversationId in the next steps)
  • token: A token that you will use to send messages in this conversation (will be referred to as conversationToken in the next steps)

Here's an example of the response:

{
"title": "My Conversation",
"source": "INTEGRATION",
"data": {},
"userId": "user1",
"chatBotId": "botId",
"token": "token1",
"lastQueryTimestamp": "2025-01-07T12:00:00.000Z",
"visibility": "USER",
"createdBy": null,
"updatedBy": null,
"queryCount": 0,
"marketplaceId": null,
"id": "conv1",
"createdAt": "2025-01-07T12:00:00.000Z",
"updatedAt": "2025-01-07T12:00:00.000Z",
"status": "OPEN"
}