core icon indicating copy to clipboard operation
core copied to clipboard

Error 409 Conflict

Open nicktan147 opened this issue 10 years ago • 3 comments

When I try to run getUpdatesCLI.php, I received this error

exception 'Longman\TelegramBot\Exception\TelegramException' with message 'Client error: `POST https://api.telegram.org/bot183556241:AAHmVl68cfxjKhOrB0sDJuX9FndSb67U5OA/getUpdates` resulted in a `409 Conflict` response:
{"ok":false,"error_code":409,"description":"Conflict: another webhook is active"}

Any reason why?

UPDATE: I managed to resolved that issue, but I have successfully setup Let's encrypt and https is up. I don't seems to receive any successful message as mentioned on FAQ section?

Here is my code:-

require '../vendor/autoload.php';

$API_KEY = 'SOMEKEYHERE';
$BOT_NAME = 'SOMEBOTHERE';

$hook_url = 'https://example.com/path/to/hook.php';

try {
    // Create Telegram API object
    $telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);

    // Set webhook
    $result = $telegram->setWebHook($hook_url,'');
    if ($result->isOk()) {
        echo $result->getDescription();
    }
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
    echo $e;
}

nicktan147 avatar Jul 05 '16 10:07 nicktan147

Passing an empty string as the 2nd parameter of setWebHook isn't necessary.

What is the output of your script? Just empty?

P.S. I have modified your $BOT_NAME and set $hook_url to a dummy one, since this location should stay secret!!

noplanman avatar Jul 05 '16 14:07 noplanman

Hmmm I think I will close this temporary. It call using CLI, it will return empty. If i do it using browser with full link by copy and pasting replacing it works fine. On Jul 5, 2016 10:42 PM, "Armando Lüscher" [email protected] wrote:

What is the output of your script? Just empty?

P.S. I have modified your hook URL to a dummy one, since this location should stay secret!!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akalongman/php-telegram-bot/issues/245#issuecomment-230498654, or mute the thread https://github.com/notifications/unsubscribe/AHZ6nqXSasS69Vk6_FcjuMPKqmC0943qks5qSm1ygaJpZM4JE-to .

nicktan147 avatar Jul 05 '16 16:07 nicktan147

Ok, that's strange. CLI should output the same thing as calling it through the browser.

I'll close here now, open again if needed!

noplanman avatar Jul 05 '16 17:07 noplanman