Developing a Bot for Automatic Customer Question Responses on Marketplaces
Sellers on Ozon, Wildberries, Yandex.Market receive dozens of standard questions daily: "is it in stock", "what size", "when will it arrive". A bot with LLM processing answers standard questions in seconds and escalates non-standard ones to a manager.
Architecture
Marketplace API (polling / webhook)
↓
Question Classifier
↙ ↘
Template answer LLM generation
(FAQ database) (OpenAI / Claude)
↓ ↓
Auto-Reply Manager Review
↓
Marketplace API → Send Reply
Getting Questions via Marketplace API
# Ozon Seller API — getting new questions
import httpx
class OzonQAClient:
def __init__(self, client_id: str, api_key: str):
self.headers = {
'Client-Id': client_id,
'Api-Key': api_key,
}
def get_unanswered_questions(self) -> list:
resp = httpx.post(
'https://api-seller.ozon.ru/v1/qa/list',
headers=self.headers,
json={'status': 'without_answer', 'page_size': 50}
)
return resp.json().get('result', {}).get('questions', [])
def reply(self, question_id: str, answer_text: str) -> bool:
resp = httpx.post(
'https://api-seller.ozon.ru/v1/qa/answer/seller',
headers=self.headers,
json={'question_id': question_id, 'text': answer_text}
)
return resp.status_code == 200
Classification and Response Generation
from openai import OpenAI
client = OpenAI()
FAQ_CONTEXT = """
You are a marketplace seller assistant. Knowledge base:
- Delivery: 3-7 days across the country, via CDEK or Russian Post
- Warranty: 12 months on all products
- Returns: within 14 days
- Payment: card, SBP, cash on delivery
"""
def generate_answer(question: str, product_info: dict) -> dict:
system_prompt = FAQ_CONTEXT + f"\n\nProduct: {product_info['name']}\n{product_info['description']}"
response = client.chat.completions.create(
model='gpt-4o-mini',
messages=[
{'role': 'system', 'content': system_prompt},
{'role': 'user', 'content': question},
],
temperature=0.3,
)
answer = response.choices[0].message.content
# Determine confidence via separate request
confidence = classify_confidence(question, answer)
return {
'answer': answer,
'confidence': confidence, # 0.0 — 1.0
'auto_send': confidence >= 0.85
}
Escalation to Manager
Questions with low bot confidence go to review:
if not result['auto_send']:
# Send to manager in Telegram with buttons
await telegram.send_message(
chat_id=MANAGER_CHAT,
text=f"❓ Question about product \"{product['name']}\"\n\n"
f"Question: {question}\n\n"
f"Suggested answer:\n{result['answer']}",
reply_markup=InlineKeyboardMarkup([[
InlineKeyboardButton("✅ Send", callback_data=f"approve:{question_id}"),
InlineKeyboardButton("✏️ Edit", callback_data=f"edit:{question_id}"),
]])
)
Timeline
Bot with LLM answers for one marketplace, Telegram escalation: 5–8 business days.







