مستندات API

راهنمای کامل برای استفاده از API های پلتفرم ایجنت هوشمند

v1.0
POST

/stream-chat-with-assistant/

Initiates or continues a chat session with streaming responses. For a new conversation, omit the thread_id to create a new thread. The server will return a thread_id in the first response chunk, which should be used in subsequent requests to continue the conversation. The server streams multiple JSON responses as they become available. Each response is a separate JSON object that can contain different types of data (thread_id, text, or products).

📤 درخواست

JSON
{
  "assistant_id": "string",
  "thread_id": "string (optional - omit for new conversation, include for continuing a thread)",
  "message": "string"
}

📥 پاسخ

JSON
{
  "Stream Response Format": "Multiple JSON objects are streamed, each can be one of the following types:",
  "Type 1: Thread ID": {
    "thread_id": "string (conversation thread identifier)"
  },
  "Type 2: Message": {
    "text": "string (assistant's response text)"
  },
  "Type 3: Products": {
    "products": [
      {
        "price": "number (product price)",
        "url": "string (product URL)",
        "image": "string (product image URL)",
        "name": "string (product name)"
      }
    ]
  },
  "Type 4: Wait Status": {
    "wait": "boolean (assistant is processing, e.g. searching products)"
  },
  "Type 5: Suggestions": {
    "suggestions": "string[] (suggested follow-up messages)"
  }
}

📝 یادداشت‌ها

The response is streamed as separate JSON objects

Each JSON object can contain thread_id, text, products, wait, or suggestions

Multiple text responses may be streamed for a single message

Product recommendations and suggestions are optional and may not be present in all responses

💻 نمونه کدها

BASH
curl -X POST "https://api.mori.style/stream-chat-with-assistant/" \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"assistant_id": "123", "message": "Hello"}'
GET

/bot-sharing-data/{sharing_id}

Retrieves shared bot data using a sharing ID. The sharing ID can be found in the dashboard.

📤 درخواست

JSON
{
  "sharing_id": "string (path parameter)"
}

📥 پاسخ

JSON
{
  "data": {
    "route": "string (demo_route or standard_route)",
    "bot_name": "string",
    "suggestedReply": "string[]",
    "wellcomeMessage": "string",
    "bot_image": "string (URL)",
    "assistant_id": "string",
    "currency": "string",
    "isRTL": "boolean",
    "texts": "object (language profile data)"
  }
}

📝 یادداشت‌ها

Returns 404 if bot profile is not found

💻 نمونه کدها

BASH
curl "https://api.mori.style//bot-sharing-data/abc123" \
  -H "accept: application/json"
POST

/chat-with-assistant/

Initiates or continues a chat session without streaming. For a new conversation, omit the thread_id to create a new thread. The server will return a thread_id in the response, which should be used in subsequent requests to continue the conversation. Returns a complete response at once.

📤 درخواست

JSON
{
  "assistant_id": "string",
  "thread_id": "string (optional - omit for new conversation, include for continuing a thread)",
  "message": "string"
}

📥 پاسخ

JSON
{
  "response": {
    "response": [
      {
        "sender": "string (message sender)",
        "text": "string (assistant's response text)",
        "products": [
          {
            "price": "number (product price)",
            "url": "string (product URL)",
            "image": "string (product image URL)",
            "name": "string (product name)"
          }
        ],
        "suggestions": "string[] (suggested follow-up messages, optional)"
      }
    ]
  },
  "thread_id": "string (conversation thread identifier)"
}

📝 یادداشت‌ها

response.response is an array of messages; a single request may return multiple messages

products and suggestions are optional and may not be present in every message

💻 نمونه کدها

BASH
curl -X POST "https://api.mori.style/chat-with-assistant/" \
  -H "accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"assistant_id": "123", "message": "Hello"}'