DEF STUDIO srl

Adding a chat to a Telegraph Bot

Associating one or more chats to a bot, it is enabled to send messages to that chat and interacting with commands

Note

To get the chat_id issue the /chatid command inside the chat after having set up a webhook for your bot.

through an artisan command

php artisan telegraph:new-chat {bot_id}

the bot_id argument is mandatory if you have created more than one bot

programmatically

If you are implementing a custom bot creation logic, you can create a new chat using the TelegraphChat model:

/** @var TelegraphChat $chat */
$chat = $telegraph_bot->chats()->create([
    'chat_id' => $chat_id,
    'name' => $chat_name,
]);
Suggest a change
Last updated 02 December 2024