Commit c7438436 authored by MBoretto's avatar MBoretto

FIX set webhook bug

parent e5d6c3ad
......@@ -128,19 +128,26 @@ You must set a [WebHook](https://core.telegram.org/bots/api#setwebhook)
Create *set.php* (just edit *example-set.php*) and put into it:
```php
<?php
//Composer Loader
$loader = require __DIR__.'/vendor/autoload.php';
$API_KEY = 'your_bot_api_key';
$BOT_NAME = 'namebot';
$link = 'https://yourdomain/yourpath_to_hook.php';
try {
// create Telegram API object
$telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);
// set webhook
echo $telegram->setWebHook('https://yourdomain/yourpath_to_hook.php');
$result = $telegram->setWebHook($link);
if ($result->isOk()) {
echo $result->getDescription();
}
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
echo $e->getMessage();
}
```
And open your *set.php* via browser.
......
......@@ -4,12 +4,15 @@ $loader = require __DIR__.'/vendor/autoload.php';
$API_KEY = 'your_bot_api_key';
$BOT_NAME = 'namebot';
$link = 'https://yourdomain/yourpath_to_hook.php';
try {
// create Telegram API object
$telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);
// set webhook
echo $telegram->setWebHook('https://yourdomain/yourpath_to_hook.php');
$result = $telegram->setWebHook($link);
if ($result->isOk()) {
echo $result->getDescription();
}
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
echo $e->getMessage();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment