> ## Documentation Index
> Fetch the complete documentation index at: https://docs.marsmind.co/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> You can call the API independently through the following documents to implement dialogue capabilities and embed them in your own chat window. Suitable for users who need independent adaptation. Both secret and client need to be obtained by applying to MarsMind Intelligence.

## Request Parameters

### Main Structure

<ParamField body="client" type="string" required>
  Business identifier, please confirm with MarsMind Intelligence
</ParamField>

<ParamField body="signature" type="string" required>
  Signature, see algorithm below
</ParamField>

<ParamField body="timestamp" type="integer" required>
  Timestamp (Unix seconds)
</ParamField>

<ParamField body="message_info" type="object" required>
  Message details, see field definitions below
</ParamField>

### `message_info` Fields

<ParamField body="msg_id" type="string">
  Unique message ID, required in assist\_dialog scenario
</ParamField>

<ParamField body="group_id" type="string">
  Group chat ID, error 400 if both from\_user\_id and group\_id are empty
</ParamField>

<ParamField body="group_name" type="string">
  Group chat name
</ParamField>

<ParamField body="from_user_id" type="string" required>
  Sender ID
</ParamField>

<ParamField body="from_user_nickname" type="string">
  Sender nickname
</ParamField>

<ParamField body="to_user_id" type="string">
  Receiver ID
</ParamField>

<ParamField body="to_user_nickname" type="string">
  Receiver nickname
</ParamField>

<ParamField body="at_list" type="string[]">
  List of @ user IDs (only supported by auto\_dialog)
</ParamField>

<ParamField body="content" type="string">
  Message text content, at least one of content and files\_info is required
</ParamField>

<ParamField body="message_type" type="integer" required>
  1 = Normal message, 2 = Quoted message
</ParamField>

<ParamField body="event_type" type="string" required>
  auto\_dialog | assist\_dialog | website\_dialog | cmd\_dialog
</ParamField>

<ParamField body="from_user_type" type="integer">
  1=Robot bound account 2=Customer 3=Customer Service 4=Robot message. Required for auto\_dialog
</ParamField>

<ParamField body="create_timestamp" type="integer" required>
  Message creation time (Unix timestamp)
</ParamField>

<ParamField body="files_info" type="File[]">
  Attachment list, see table below. At least one of content and files\_info is required
</ParamField>

<ParamField body="quote" type="object">
  Quoted message object, must contain msg\_id, message\_type. Required if message\_type=2
</ParamField>

#### `files_info` Structure

<ParamField body="content" type="string" required>
  File address or base64 data
</ParamField>

<ParamField body="file_type" type="string" required>
  "image"/"document"/"voice"
</ParamField>

***

## Dialogue Scenario Description

### auto\_dialog (Automatic Dialogue)

* `event_type = auto_dialog`
* Provide `send_url`, MarsMind Intelligence automatically controls message logic
* Supports text, images, files (unique type per request)

**from\_user\_type filling suggestion:**

* Bound objects: Fill in 1 for all except the intelligent assistant's own messages
* Unbound objects: Fill in 2 for external customers, 3 for company personnel

***

### assist\_dialog (Assisted Dialogue)

* `event_type = assist_dialog`
* Return message processing results in real-time
* If parameters are consistent with auto\_dialog message, context will be reused

***

### website\_dialog (Website Dialogue)

* `event_type = website_dialog`
* Message returns results immediately and merges into context, send\_url not supported

***

### cmd\_dialog (Command Control)

* `event_type = cmd_dialog`
* content is specific command, currently supports:
  * `stop_auto_reply`: Stop automatic reply (only valid in auto\_dialog scenario)

***

## Call Example

### auto\_dialog

```bash theme={null}
curl -X POST http://127.0.0.1:7002/custom-im/chat-messages \
-H "Content-Type: application/json" \
-d '{
  "client": "test",
  "signature": "d97b383a532466b6c6c451e76a2ab57b",
  "timestamp": 1748584621,
  "message_info": {
    "content": "",
    "message_type": 1,
    "group_id": "98765@chatroom",
    "event_type": "auto_dialog",
    "from_user_id": "aa123",
    "from_user_type": 2,
    "msg_id": "9005",
    "create_timestamp": 1748584621,
    "files_info": [
      { "content": "https://example.com/img.png", "file_type": "image" }
    ]
  }
}'
```
