westacks / telebot

Easy way to create Telegram bots in PHP
https://westacks.github.io/telebot/
MIT License
282 stars 44 forks source link

Wrong response from the webhook: 403 Forbidden #100

Closed NihilIF closed 8 months ago

NihilIF commented 8 months ago

I need help with this error. I want to use commands with my bot. I followed all the documentation but I still get 403 error on my webhook. I use Laravel 8

for example my StarCommand

<?php

namespace App\Console\Commands\Telegram;

use WeStacks\TeleBot\Handlers\CommandHandler;

class StartCommand extends CommandHandler { protected static $aliases = ['/start']; protected static $description = 'Send "/start" to recive a message';

public function handle()
{
    return $this->sendMessage([
        'parse_mode' => 'HTML',
        'text' => mb_convert_encoding('Hello, How are you?', 'UTF-8', mb_list_encodings())
    ]);
}

}

Then in the terminal I use the commands:

php artisan telebot:command --setup

php artisan telebot:webhook --setup

but the webhook gives me: "last_error_message": "Wrong response from the webhook: 403 Forbidden",

please help me

punyflash commented 8 months ago

This error is happening because server responds with status 403 when sending data to your server. Please check out if your config is correct to pass those checks:

https://github.com/westacks/telebot-laravel/blob/6714b42d4c0c39e0dbbe4bfe70aebefdf8f33458/src/Requests/UpdateRequest.php#L29-L56

Also, please create issues in repository that related to your problem. In your case, you have issue with Laravel adapter, not core library.