Search code examples
djangotelegramtelegram-botpython-telegram-bot

Telegram BOT webook sending empty POST


I'm trying to get the payload of the webhook in a BOT in Django.

@csrf_exempt
def webhook(request):
    print(request.get_full_path())
    print(request.POST)
    print(request.GET)
    return HttpResponse("OK")

The webhook calls are working fine

{"ok":true,"result":{"url":"...","has_custom_certificate":false,"pending_update_count":0,"last_error_date":1516490058,"last_error_message":"Wrong response from the webhook: 503 Service Unavailable","max_connections":40}}

(last_error_message was solved)

<QueryDict: {}>
<QueryDict: {}>
[20/Jan/2018 23:16:17] "POST /webhook/secure/ HTTP/1.1" 200 2

But above text is what I'm getting in the POST and GET method each time I get a message. Always empty. Maybe I'm missing something in the Telegram part, since I've made a POST request to the same URL and it's printing correct information.


Solution

  • You have to POST testing data to your own server in order to know if there have something wrong.

    Here are some payloads you can execute by curl, or this Android application have webhook debugger for new developers.