Telegram Integration (Notifications and Bots)

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Telegram Messenger Integration with Website (Notifications, Bots)

Telegram Bot API is one of the most convenient tools for notifications and automation. Free, fast, doesn't require sender name registration. Covers most tasks: admin notifications, service messages to users, interactive bots for processing requests.

Telegram Chat Notifications (Simplest Scenario)

Quick way to receive notifications about orders or events on your site — send to Telegram chat via Bot API:

class TelegramNotifier
{
    public function send(string $message, string $parseMode = 'HTML'): void
    {
        Http::post("https://api.telegram.org/bot{$this->token}/sendMessage", [
            'chat_id'    => config('services.telegram.chat_id'),
            'text'       => $message,
            'parse_mode' => $parseMode
        ]);
    }
}

// Usage
$telegram->send(
    "🛒 <b>New order #{$order->id}</b>\n"
    . "Amount: {$order->total} ₽\n"
    . "Customer: {$order->customer_name}"
);

For group notifications: the bot must be added to the group and have permission to send messages. chat_id for a group is a negative number.

Webhook for Incoming Messages

To make the bot respond to user messages, a webhook is needed:

// Register webhook
Http::post("https://api.telegram.org/bot{$token}/setWebhook", [
    'url'            => 'https://yoursite.com/webhooks/telegram',
    'allowed_updates' => ['message', 'callback_query']
]);

// Handler
Route::post('/webhooks/telegram', function (Request $request) {
    $update = $request->json()->all();

    if (isset($update['message'])) {
        $chatId = $update['message']['chat']['id'];
        $text   = $update['message']['text'];

        dispatch(new ProcessTelegramMessageJob($chatId, $text));
    }

    if (isset($update['callback_query'])) {
        // Inline button clicked
        $callbackData = $update['callback_query']['data'];
        dispatch(new ProcessTelegramCallbackJob($update['callback_query']));
    }

    return response('OK');
});

Inline Keyboards for Interactivity

Http::post("https://api.telegram.org/bot{$token}/sendMessage", [
    'chat_id' => $chatId,
    'text'    => "Request #{$applicationId} received. What to do?",
    'reply_markup' => json_encode([
        'inline_keyboard' => [[
            ['text' => '✅ Accept', 'callback_data' => "accept_{$applicationId}"],
            ['text' => '❌ Reject', 'callback_data' => "reject_{$applicationId}"]
        ]]
    ])
]);

Manager clicks button in Telegram → bot receives callback_query → updates request status on site → sends confirmation.

Telegram Login Widget

Website authentication via Telegram:

<script async src="https://telegram.org/js/telegram-widget.js?22"
    data-telegram-login="YourBotName"
    data-size="large"
    data-auth-url="https://yoursite.com/auth/telegram/callback"
    data-request-access="write">
</script>
// Verify signature
public function callback(Request $request): void
{
    $checkHash = $request->hash;
    $authData = $request->except('hash');
    ksort($authData);

    $dataCheckString = implode("\n", array_map(
        fn($k, $v) => "{$k}={$v}",
        array_keys($authData), $authData
    ));

    $secretKey = hash('sha256', config('services.telegram.bot_token'), true);
    $hash = hash_hmac('sha256', $dataCheckString, $secretKey);

    if (!hash_equals($hash, $checkHash)) {
        abort(403, 'Invalid Telegram signature');
    }

    // User authorization
}

Service Notifications to Users

To send notifications to specific users, save their chat_id — it's passed on first bot interaction. User starts dialog with bot, bot saves chat_id linked to site account.

Integration timeframe: 2–3 days for a bot with notifications, inline buttons, and Telegram Login.