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.

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

HeaderRequiredDescription
x-api-keyYesYour API key for authentication
Content-TypeYesMust be 'application/json'

Request Chat Body Parameters

ParameterTypeRequiredDescription
assistant_idstringYesID of the assistant to use
messagesarrayYesArray of messages for the conversation
langstringYesLanguage code for the response
uuidstringNoUnique User ID for dashboard analytics

Response Chat Format

{
  "status": 200,
  "data": {
    // Response data
  }
}

Error Chat Response

{
  "status": 500,
  "message": "Internal Server Error"
}

Was this page helpful?