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
NoteTo get the chat_id, send
/chatidin the chat after setting the webhook for the bot. If you are testing locally, make sure the tunnel URL is still active and matches the URL fromphp artisan telegraph:debug-webhook {bot_id}. If/chatiddoes not answer, see Troubleshooting Telegraph onboarding.
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
If you are setting up your first bot from installation to the first message, use Build your first Telegram bot with Telegraph.
programmatically
If you are implementing a custom bot creation logic, you can create a new chat from a TelegraphBot model:
use DefStudio\Telegraph\Models\TelegraphBot; $bot = TelegraphBot::query()->firstOrFail(); $chat = $bot->chats()->create([ 'chat_id' => '123456789', 'name' => 'Personal chat', ]);