Hi.
I'm recently tried to use webhook to get update from telegram. my program work correctly whit getUpdates().
but when i set webhook i got
"Wrong response from the webhook: 400 Bad Request"
error when try to check status of webhook by getWebhookInfo method.
here is my code:
$telegram->commandsHandler(true)
when is used below code in getUpdates mod every thing was fine.
$telegram->commandsHandler(false)
And is should say i use https and my ssl is ok.
This is answer of getWebhookInfo to me.
{
"ok": true,
"result": {
"url": "https://telbit.ir/api/bot/<token>",
"has_custom_certificate": false,
"pending_update_count": 13,
"last_error_date": 1476344420,
"last_error_message": "Wrong response from the webhook: 400 Bad Request"
}
}
When you get a webhook request, you need to respond with 200 status code or just return 'ok' or something. That gives confirmation to Telegram that your server accepted their update.
How to respond with 200 status or return ok?
@AntoLuMeju99 In your webhook route set http status code 200 in all cases.
What u mean?
Route::post('/YourSecretPathToTheWebhookURI/webhook', function () {
$update = Telegram::commandsHandler(true);
return 'ok';
});
Mby ..Csrf verification need turn off for route
пт, 17 мая 2019 г., 15:33 Xibel notifications@github.com:
Route::post('/YourSecretPathToTheWebhookURI/webhook', function () {
$update = Telegram::commandsHandler(true);
return 'ok';
});—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/irazasyed/telegram-bot-sdk/issues/266?email_source=notifications&email_token=ACG4GNITE5X7X7C57T2XJL3PV2QYFA5CNFSM4CSWKYMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVUT7MY#issuecomment-493436851,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACG4GNMO6MQC46ASHYYR62TPV2QYFANCNFSM4CSWKYMA
.
Most helpful comment
When you get a webhook request, you need to respond with 200 status code or just return 'ok' or something. That gives confirmation to Telegram that your server accepted their update.