Assistant Chat Integration
In this guide, we will walk you through integrating the assistant chat functionality into your application using the Dacosoft Solution API. We'll cover how to send messages to an assistant and how to retrieve responses from the assistant using the Conversations API. By the end, you'll be able to set up a working chat interface where your users can interact with the assistant.
Before you can integrate the assistant chat, make sure you have your API key from the Dacosoft Solution dashboard. All requests require an 'x-api-key' header for authentication. This key must be associated with an enterprise plan or have API integration enabled.
Setting Up the Assistant Chat
The first step in integrating the assistant chat is to ensure you have access to the necessary API endpoint and permissions. Make sure your API key allows for assistant chat usage, and that you have the necessary integrations enabled in your Dacosoft Solution account.
Sample Request Structure for Sending Messages
When sending a request to the Dacosoft Solution API to send messages, you will need to send a JSON payload that contains the following parameters:
assistant_id
: The ID of the assistant you want to interact with.messages
: The messages sent by the user to the assistant.lang
: The language of the conversation.
Here's an example of how to structure your request:
{
"assistant_id": "aq23gk5vt25gk234v5k23gv52345v234",
"messages": ["Hello, how can I assist you today?"],
"lang": "en"
}
Integration
curl -X POST 'https://dacosoft.pro/api/chat-call' \
-H 'Content-Type: application/json' \
-H 'x-api-key: your-api-key' \
-d '{
"assistant_id": "your-assistant-id",
"messages": [],
"lang": "en"
}'
Request Chat Headers
Header | Required | Description |
---|---|---|
x-api-key | Yes | Your API key for authentication |
Content-Type | Yes | Must be 'application/json' |
Request Chat Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
assistant_id | string | Yes | ID of the assistant to use |
messages | array | Yes | Array of messages for the conversation |
lang | string | Yes | Language code for the response |
uuid | string | No | Unique User ID for dashboard analytics |
Response Chat Format
{
"status": 200,
"data": {
// Response data
}
}
Error Chat Response
{
"status": 500,
"message": "Internal Server Error"
}
Your account must have either an enterprise plan with API integration enabled to use the API.