git clone https://github.com/jeremy5189/SITCON-TelegramBot.git
cd SITCON-TelegramBot
cp config.sample.php config.php
Make sure that hook.php is pubicly availabe on the web. (e.g. https://example.com/hook.php)
- Message http://telegram.me/BotFather to create a new bot
- Get your token, name and write it to
config.php
php hook.php
chmod 777 bot.log
tail -f bot.log
The log will contain timestamp and webhook data from telegram api.
- Send a post request to
https://api.telegram.org/bot{TOKEN}/setWebhook?url={YOUR_WEBHOOK_URL}
- You must include your server SSL crt file (not private key) in a POST field
certificate
(POST type = file) - If correct, telegram should response
{
"ok": true,
"result": true,
"description": "Webhook was set"
}