Product Review Monitoring Bot Development
Reviews on Yandex.Market, Ozon, Wildberries, Otzovik, Google Maps and other platforms influence purchasing decisions long before a user visits your site. Timely response to negative reviews reduces reputational damage; worked-out negativity often converts to a loyal customer.
Bot Task
- Scan product/company pages on external platforms
- Detect new reviews (positive and negative)
- Notify team about new reviews immediately
- Store review history for analytics
- Calculate rating trends across platforms
Data Schema
CREATE TABLE review_sources (
id BIGSERIAL PRIMARY KEY,
platform VARCHAR(50) NOT NULL, -- 'yandex_market', 'ozon', 'google', 'otzovik'
product_id BIGINT REFERENCES products(id),
external_url TEXT NOT NULL,
external_id VARCHAR(255), -- Card ID on platform
scrape_config JSONB,
is_active BOOLEAN DEFAULT TRUE,
UNIQUE(platform, external_url)
);
CREATE TABLE reviews (
id BIGSERIAL PRIMARY KEY,
source_id BIGINT REFERENCES review_sources(id),
external_id VARCHAR(255), -- Review ID on platform
author VARCHAR(255),
rating SMALLINT, -- 1–5
text TEXT,
pros TEXT,
cons TEXT,
published_at TIMESTAMP,
discovered_at TIMESTAMP DEFAULT NOW(),
sentiment VARCHAR(20), -- 'positive', 'negative', 'neutral' (ML)
is_notified BOOLEAN DEFAULT FALSE,
UNIQUE(source_id, external_id)
);
CREATE INDEX idx_reviews_rating ON reviews(source_id, rating);
CREATE INDEX idx_reviews_notified ON reviews(source_id) WHERE is_notified = FALSE;
Platform Adapters
Each platform is a separate adapter with parsing implementation.
Yandex.Market (API):
class YandexMarketReviewAdapter implements ReviewAdapterInterface
{
// Yandex.Market provides API for partners to get reviews
public function fetchReviews(ReviewSource $source): array
{
$modelId = $source->external_id;
$response = Http::withHeaders([
'Authorization' => 'Bearer ' . config('services.yandex_market.token'),
])->get("https://api.partner.market.yandex.ru/v2/models/{$modelId}/reviews", [
'count' => 30,
'page' => 1,
]);
return collect($response->json('result.reviews', []))
->map(fn($r) => new ReviewDTO(
externalId: (string) $r['id'],
author: $r['author']['name'] ?? 'Anonymous',
rating: (int) $r['grade'],
text: $r['text'] ?? '',
pros: $r['pros'] ?? null,
cons: $r['cons'] ?? null,
publishedAt: Carbon::parse($r['date']),
))
->toArray();
}
}
Ozon HTML Parsing:
class OzonReviewAdapter implements ReviewAdapterInterface
{
public function fetchReviews(ReviewSource $source): array
{
// Ozon loads reviews via XHR, so browser is needed
$data = $this->playwright->evaluate($source->external_url, <<<JS
await page.waitForSelector('[data-widget="webReviewProductScore"]', {timeout: 10000});
const items = document.querySelectorAll('[data-widget="webSingleReview"]');
return Array.from(items).map(el => ({
id: el.dataset.reviewId,
rating: parseInt(el.querySelector('[data-rating]')?.dataset.rating) || 0,
text: el.querySelector('.review-text')?.textContent?.trim() || '',
pros: el.querySelector('.pros')?.textContent?.trim() || null,
cons: el.querySelector('.cons')?.textContent?.trim() || null,
author: el.querySelector('.author-name')?.textContent?.trim() || 'Anonymous',
date: el.querySelector('time')?.getAttribute('datetime'),
}));
JS);
return collect($data)->map(fn($r) => new ReviewDTO(
externalId: $r['id'],
author: $r['author'],
rating: $r['rating'],
text: $r['text'],
pros: $r['pros'],
cons: $r['cons'],
publishedAt: $r['date'] ? Carbon::parse($r['date']) : now(),
))->toArray();
}
}
Review Sentiment Analysis
class SentimentAnalyzer
{
private array $negativeKeywords = [
'defect', 'broken', 'not working', 'return', 'fraud',
'disappointed', 'terrible', 'nightmare', 'junk', 'trash',
];
private array $positiveKeywords = [
'excellent', 'great', 'satisfied', 'recommend', 'exceeded',
'fast', 'quality', 'thank you',
];
public function analyze(ReviewDTO $review): string
{
if ($review->rating <= 2) return 'negative';
if ($review->rating >= 4) return 'positive';
// For rating 3—text analysis
$text = mb_strtolower($review->text . ' ' . $review->cons);
foreach ($this->negativeKeywords as $kw) {
if (str_contains($text, $kw)) return 'negative';
}
return 'neutral';
}
}
For accurate sentiment analysis—OpenAI integration:
public function analyzeWithAI(string $text): string
{
$response = $this->openai->chat()->create([
'model' => 'gpt-4o-mini',
'messages' => [
['role' => 'system', 'content' => 'Determine review sentiment. Answer with one word: positive, negative or neutral.'],
['role' => 'user', 'content' => $text],
],
'max_tokens' => 10,
]);
return in_array($response->choices[0]->message->content, ['positive', 'negative', 'neutral'])
? $response->choices[0]->message->content
: 'neutral';
}
Notifications
class ReviewNotifier
{
public function notifyNew(Review $review): void
{
$emoji = match ($review->sentiment) {
'positive' => '⭐',
'negative' => '🚨',
default => '💬',
};
$stars = str_repeat('★', $review->rating) . str_repeat('☆', 5 - $review->rating);
$text = "{$emoji} *New review* — {$review->source->platform}\n"
. "{$stars} {$review->rating}/5\n"
. "*{$review->author}*\n\n"
. mb_substr($review->text, 0, 300)
. (mb_strlen($review->text) > 300 ? '...' : '') . "\n\n"
. "[Open review]({$review->source->external_url})";
$chatId = $review->sentiment === 'negative'
? config('telegram.urgent_reviews_chat')
: config('telegram.reviews_chat');
$this->telegram->sendMessage([
'chat_id' => $chatId,
'text' => $text,
'parse_mode' => 'Markdown',
]);
$review->update(['is_notified' => true]);
}
}
Rating Analytics
// Aggregate rating across platforms for last 30 days
SELECT
rs.platform,
COUNT(*) AS total_reviews,
ROUND(AVG(r.rating), 2) AS avg_rating,
COUNT(*) FILTER (WHERE r.rating <= 2) AS negative_count,
COUNT(*) FILTER (WHERE r.rating >= 4) AS positive_count
FROM reviews r
JOIN review_sources rs ON r.source_id = rs.id
WHERE r.published_at >= NOW() - INTERVAL '30 days'
GROUP BY rs.platform
ORDER BY avg_rating;
Check Schedule
// Fast platforms with API—every hour
$schedule->command('reviews:check --platform=yandex_market')->hourly();
// Parsing via browser—every 4 hours (resource-intensive)
$schedule->command('reviews:check --platform=ozon')->everyFourHours();
$schedule->command('reviews:check --platform=wildberries')->everyFourHours();
// Weekly summary report with rating trend
$schedule->job(new WeeklyReviewsReportJob)->weekly()->mondays()->at('09:00');
Timeline
- Data schema + basic adapter (HTML parsing): 1–2 days
- Yandex.Market API adapter: 0.5 days
- Playwright adapters for Ozon/WB: 1–2 days
- SentimentAnalyzer + Telegram notifications: 1 day
- Rating analytics dashboard in admin: 1 day
Total: 4–5 working days.







