Skip to main content

Request Parameters

Main Structure

ParameterTypeRequiredDescription
clientstringYesBusiness identifier, must be confirmed with MarsMind
signaturestringYesSignature, see algorithm below
timestampintYesTimestamp (Unix, seconds)
message_infoobjectYesMessage details, see fields below

message_info Fields

FieldTypeRequiredDescription
msg_idstringRequired for assist_dialogUnique message ID; mandatory in assist_dialog scenario
group_idstringDepends on scenarioGroup chat ID. If both from_user_id and group_id are empty → error 400
group_namestringNoGroup name
from_user_idstringYesSender ID
from_user_nicknamestringNoSender nickname
to_user_idstringNoReceiver ID
to_user_nicknamestringNoReceiver nickname
at_liststring[]NoList of mentioned users (@). Only supported in auto_dialog
contentstringRequired if no files_infoMessage text content
message_typeintYes1 = normal message, 2 = quoted message
event_typestringYesauto_dialog | assist_dialog | website_dialog | cmd_dialog
from_user_typeintRequired for auto_dialog1=bound account, 2=customer, 3=support agent, 4=AI message
create_timestampintYesMessage creation time (Unix timestamp)
files_infoFile[]Required if no contentFile attachments, see below
quoteobjectRequired if message_type=2Quoted message object, must include msg_id and message_type

files_info Structure

FieldTypeRequiredDescription
contentstring (URL/base64)YesFile URL or base64 data
file_type”image”/“document”/“voice”YesFile type

Conversation Scenarios

auto_dialog (Automatic Dialog)

  • event_type = auto_dialog
  • Provide send_url. MarsMind will control sending logic automatically.
  • Supports text, image, or file (only one type per request).
from_user_type Guidelines:
  • If bound to a specific account: all non-AI messages should use 1.
  • If not bound: external customer = 2, internal staff = 3.

assist_dialog (Assisted Dialog)

  • event_type = assist_dialog
  • Immediately returns the processed result.
  • If parameters match a previous auto_dialog message, the same context will be reused.

website_dialog (Web Dialog)

  • event_type = website_dialog
  • Message is processed immediately and appended to context.
  • send_url is not supported.

cmd_dialog (Command Control)

  • event_type = cmd_dialog
  • content should contain the command. Currently supported:
    • stop_auto_reply: stop auto-reply (only valid in auto_dialog).

Example Usage

auto_dialog

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" }
    ]
  }
}'