Danh mục thao tác

Gửi tin nhắn

inbox.message.sendMCP:inbox_message_sendBộ công cụ: Hội thoại

Send a message on Zalo (text with mentions/styles, quote reply, images, files, video, voice file, sticker, contact card, bank card). Queued in conversation order through the account's own limits; returns operation/message/job ids immediately — call operations_wait for the Zalo result.

Cần Idempotency-Key
Xếp hàng theo hạn mức của tài khoản
Quyền: Nhắn tin

Gọi bằng REST v2

curl -X POST https://zl.builera.app/api/public/v2/ops/inbox.message.send \
  -H "Authorization: Bearer za_live_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"conversationId":"3f2b8c1e-5d4a-4e6b-9c7d-1a2b3c4d5e6f","text":"Chào anh, em gửi thông tin ạ"}'

Mỗi khoá/kết nối tối đa 300 lệnh đọc và 60 lệnh ghi mỗi phút. Gọi lại cùng Idempotency-Key trả đúng kết quả cũ, không làm lại.

Gọi qua MCP

{
  "method": "tools/call",
  "params": {
    "name": "inbox_message_send",
    "arguments": {
      "conversationId": "3f2b8c1e-5d4a-4e6b-9c7d-1a2b3c4d5e6f",
      "text": "Chào anh, em gửi thông tin ạ"
    }
  }
}

Thêm https://zl.builera.app/mcp vào ứng dụng AI rồi cho phép kết nối; AI chỉ thấy công cụ trong bộ bạn chọn.

Kết quả

HTTP 202
{ "status": "accepted", "operationId": "…", "jobId": "…", "data": { … } }

→ operations.wait (tối đa 20 giây) hoặc webhook để biết kết quả trên Zalo

Ví dụ đầu vào

{
  "conversationId": "3f2b8c1e-5d4a-4e6b-9c7d-1a2b3c4d5e6f",
  "text": "Chào anh, em gửi thông tin ạ"
}

Thay mã (id) mẫu bằng mã thật lấy từ các thao tác liệt kê/tìm kiếm.

Lược đồ đầu vào (JSON Schema)

{
  "type": "object",
  "properties": {
    "conversationId": {
      "type": "string",
      "format": "uuid",
      "description": "Conversation to send into (from inbox_conversations_list or inbox_conversation_open_contact)."
    },
    "kind": {
      "type": "string",
      "enum": [
        "text",
        "image",
        "video",
        "file",
        "sticker",
        "voice",
        "card",
        "link",
        "bank",
        "system"
      ],
      "default": "text",
      "description": "text, image, video, file, sticker, voice, card, bank or link."
    },
    "text": {
      "type": "string",
      "maxLength": 5000,
      "default": "",
      "description": "Message text or caption. Supports @mentions via `mentions`."
    },
    "attachments": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "file",
              "voice"
            ]
          },
          "storagePath": {
            "type": "string",
            "maxLength": 500
          },
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "size": {
            "type": "integer",
            "minimum": 0
          },
          "mime": {
            "type": "string",
            "maxLength": 120
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "durationMs": {
            "type": "integer"
          },
          "thumbStoragePath": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "kind",
          "storagePath",
          "name",
          "size",
          "mime"
        ],
        "additionalProperties": false
      },
      "maxItems": 10,
      "default": [],
      "description": "Files uploaded with media_upload_create (storagePath, name, size, mime, width/height for images)."
    },
    "quoteMessageId": {
      "type": "string",
      "format": "uuid",
      "nullable": true,
      "default": null,
      "description": "Reply to (quote) this message id."
    },
    "mentions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "uid": {
            "type": "string",
            "maxLength": 64
          },
          "pos": {
            "type": "integer",
            "minimum": 0
          },
          "len": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "uid",
          "pos",
          "len"
        ],
        "additionalProperties": false
      },
      "maxItems": 50,
      "default": []
    },
    "styles": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "start": {
            "type": "integer",
            "minimum": 0
          },
          "len": {
            "type": "integer",
            "minimum": 1
          },
          "st": {
            "type": "string",
            "enum": [
              "b",
              "i",
              "u",
              "s",
              "c_db342e",
              "c_f27806",
              "c_f7b503",
              "c_15a85f",
              "f_13",
              "f_18",
              "lst_1",
              "lst_2",
              "ind_$"
            ]
          },
          "indentSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          }
        },
        "required": [
          "start",
          "len",
          "st"
        ],
        "additionalProperties": false
      },
      "maxItems": 50,
      "default": [],
      "description": "Zalo text styles over ranges of `text`: b, i, u, s, colours c_db342e/c_f27806/c_f7b503/c_15a85f, sizes f_13/f_18; lst_1 bullet list, lst_2 numbered list, ind_$ indent (indentSize) need agent 1.4.0."
    },
    "urgency": {
      "anyOf": [
        {
          "type": "number",
          "enum": [
            0
          ]
        },
        {
          "type": "number",
          "enum": [
            1
          ]
        },
        {
          "type": "number",
          "enum": [
            2
          ]
        }
      ],
      "default": 0,
      "description": "0 normal, 1 important (Quan trọng), 2 urgent (Khẩn cấp). >0 needs agent 1.4.0."
    },
    "sticker": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "cateId": {
          "type": "integer"
        },
        "type": {
          "type": "integer"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "maxLength": 500
        }
      },
      "required": [
        "id",
        "cateId",
        "type"
      ],
      "additionalProperties": false,
      "nullable": true,
      "default": null
    },
    "card": {
      "type": "object",
      "properties": {
        "userId": {
          "type": "string",
          "maxLength": 64
        },
        "phone": {
          "type": "string",
          "maxLength": 20
        }
      },
      "required": [
        "userId"
      ],
      "additionalProperties": false,
      "nullable": true,
      "default": null
    },
    "bank": {
      "type": "object",
      "properties": {
        "binBank": {
          "type": "integer"
        },
        "numAccBank": {
          "type": "string",
          "maxLength": 40
        },
        "nameAccBank": {
          "type": "string",
          "maxLength": 120
        }
      },
      "required": [
        "binBank",
        "numAccBank",
        "nameAccBank"
      ],
      "additionalProperties": false,
      "nullable": true,
      "default": null
    },
    "runAt": {
      "type": "string",
      "format": "date-time",
      "nullable": true,
      "default": null,
      "description": "Schedule the send (ISO time). Must be in the future and within 90 days; cancel with operations_cancel."
    }
  },
  "required": [
    "conversationId"
  ],
  "additionalProperties": false
}

Cùng bộ công cụ