Developing a Telegram Bot for New Order Notifications
A Telegram bot for order notifications — one of the fastest tools to implement that immediately delivers tangible results: managers get notifications instantly, without email and without needing to keep the admin panel open.
What the Bot Sends
Typical message for new order:
🛒 New Order #4821
Customer: Ivan Petrov
Phone: +7 (916) 123-45-67
Email: [email protected]
Products:
• iPhone 15 Pro 256GB × 1 — $1,299
• MagSafe Case × 2 — $55
Total: $1,409
Payment: Credit card ✅
Delivery: DHL, Moscow, Tverskaya St, 1
🔗 Open in CRM
PHP (Laravel) Implementation
class TelegramOrderNotifier
{
private string $botToken;
private array $chatIds;
public function notify(Order $order): void
{
$message = $this->buildMessage($order);
foreach ($this->chatIds as $chatId) {
Http::post("https://api.telegram.org/bot{$this->botToken}/sendMessage", [
'chat_id' => $chatId,
'text' => $message,
'parse_mode' => 'HTML',
'reply_markup' => json_encode([
'inline_keyboard' => [[
['text' => '📋 Open Order', 'url' => route('admin.orders.show', $order)]
]]
])
]);
}
}
private function buildMessage(Order $order): string
{
$items = $order->items->map(fn($item) =>
"• {$item->product->name} × {$item->quantity} — " .
number_format($item->total, 0, '.', ' ') . ' ₽'
)->implode("\n");
return <<<HTML
🛒 <b>New Order #{$order->number}</b>
<b>Customer:</b> {$order->customer_name}
<b>Phone:</b> {$order->phone}
{$items}
<b>Total:</b> {$order->formatted_total}
HTML;
}
}
Bot is invoked from Observer or Event Listener when order is created.
Notifications to Multiple Recipients
The chat_id list is stored in configuration and can include personal chats of managers and group chats of departments. For each product group — separate list of recipients.
Timeline: 1–2 business days.







