.Maui Blog

Telegram Bot API send message via file_get_contents()

To use this example you need to know the API key of your bot and the user id of the user you want to send the message to.
Of course, the user must have authorized the bot to send messages to him.

<?php
$botUrl          = "https://api.telegram.org/bot" . $BOT_TOKEN . "/";
$userId          = 00000000;

$url   = $botUrl."sendmessage?chat_id=".$userId."&text=.Maui is awesome!";
$response = file_get_contents($url);

Exit mobile version