مستندات API
راهنمای کامل برای استفاده از API های پلتفرم ایجنت هوشمند
v1.0/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).
📤 درخواست
{
"assistant_id": "string",
"thread_id": "string (optional - omit for new conversation, include for continuing a thread)",
"message": "string"
}📥 پاسخ
{
"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
💻 نمونه کدها
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"}'import requests
response = requests.post(
f"https://api.mori.style/stream-chat-with-assistant/",
headers={
"accept": "application/json",
"Content-Type": "application/json"
},
json={
"assistant_id": "123",
"message": "Hello"
}
)
print(response.json())const axios = require('axios');
async function chatWithAssistant() {
try {
const response = await axios.post(
'https://api.mori.style/stream-chat-with-assistant/',
{
assistant_id: '123',
message: 'Hello'
},
{
headers: {
'accept': 'application/json',
'Content-Type': 'application/json'
}
}
);
console.log(response.data);
} catch (error) {
console.error('Error:', error.message);
}
}
chatWithAssistant();/bot-sharing-data/{sharing_id}
Retrieves shared bot data using a sharing ID. The sharing ID can be found in the dashboard.
📤 درخواست
{
"sharing_id": "string (path parameter)"
}📥 پاسخ
{
"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
💻 نمونه کدها
curl "https://api.mori.style//bot-sharing-data/abc123" \
-H "accept: application/json"import requests
response = requests.get(
f"https://api.mori.style/bot-sharing-data/abc123",
headers={
"accept": "application/json"
}
)
print(response.json())const axios = require('axios');
async function getBotSharingData() {
try {
const response = await axios.get(
'https://api.mori.style/bot-sharing-data/abc123',
{
headers: {
'accept': 'application/json'
}
}
);
console.log(response.data);
} catch (error) {
console.error('Error:', error.message);
}
}
getBotSharingData();/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.
📤 درخواست
{
"assistant_id": "string",
"thread_id": "string (optional - omit for new conversation, include for continuing a thread)",
"message": "string"
}📥 پاسخ
{
"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
💻 نمونه کدها
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"}'import requests
response = requests.post(
f"https://api.mori.style/chat-with-assistant/",
headers={
"accept": "application/json",
"Content-Type": "application/json"
},
json={
"assistant_id": "123",
"message": "Hello"
}
)
print(response.json())const axios = require('axios');
async function chatWithAssistant() {
try {
const response = await axios.post(
'https://api.mori.style/chat-with-assistant/',
{
assistant_id: '123',
message: 'Hello'
},
{
headers: {
'accept': 'application/json',
'Content-Type': 'application/json'
}
}
);
console.log(response.data);
} catch (error) {
console.error('Error:', error.message);
}
}
chatWithAssistant();
