Telegram Bots und Synology

https://localhost/telegram.php?user=1&pass=1&phone=010&body=Hello World&bot_token=TOKEN_API_STRING&chat_id=CHAT_OR_USER_ID

Die Chat ID beginnt mit einem minus zeichen userID’s sind ohne

Die User bzw Chat ID findet man dann wie folgt raus:

https://api.telegram.org/botTOKEN_API_STRING/getUpdates

telegram.php mit folgendem Inhalt auffüllen:

 

<?php
header("Content-Type: text/html; charset=utf-8");

define('BOT_TOKEN', $_GET["bot_token"]);
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');

// grab the chatID
$chatID = $_GET["chat_id"];

// compose reply
$reply = sendMessage();

// send reply
$sendto = API_URL."sendmessage?chat_id=".$chatID."&text=".$reply;
file_get_contents($sendto);

function sendMessage(){
$message = urlencode($_GET["body"]);
return $message;
}
?>

Speichere in deinen Favoriten diesen permalink.

Kommentare sind geschlossen.