Repository: TelegramBots/Telegram.Bot

Issue #1436: After upgrading to 22.4.*, cannot receive Updates correctly (webhook)
Created: 2024-11-13T14:44:38Z
Hello, I use C# library. And after updating, I realized that the controller of my application does not convert the updates.
The following example:
[HttpPost]
public async Task<IActionResult> Update([FromBody]Update update)
{
    return Ok();
}
After a lot of testing I found that the date value of a message does not convert correctly and neither does the value of Message.Entities Such as type, which is equal to bot_command, cannot be identified, and that is what caused the error.
I tried to convert the following json manually but I got the above errors:
{"update_id":29643942,
"message":{"message_id":16864,"from":{"id":221136,"is_bot":false,"first_name":"Test","username":"Test","language_code":"en"},"chat":{"id":222136,"first_name":"Test","username":"Test","type":"private"},"date":1731493308,"text":"/start","entities":[{"offset":0,"length":6,"type":"bot_command"}]}}
message date error.
message entities error (type).
The json above is the update that caused the error.

Duplicate issue #1453: CallbackQuery is null when deserializing webhook payload in .NET 8
Created: 2025-01-08T07:31:29Z
I'm encountering an issue where CallbackQuery is always null when receiving webhook updates from Telegram. The raw JSON payload contains valid CallbackQuery data, but the Telegram.Bot.Types.Update object fails to deserialize it correctly.

Environment:

.NET 8
Telegram.Bot versions tested: 22.0.0 to 22.3.0



Steps to Reproduce:

Set up a webhook endpoint using Telegram.Bot in a .NET 8 ASP.NET Core application.
Send a callback query via an inline keyboard.
Inspect the deserialized Update object—CallbackQuery is always null.

Example Raw Payload:
{
    "update_id": 5992343327,
    "callback_query": {
        "id": "1719723423499182764",
        "from": {
            "id": 12345678,
            "is_bot": false,
            "first_name": "",
            "last_name": "",
            "username": "",
            "language_code": "en"
        },
        "message": {
            "message_id": 123,
            "from": {
                "id": 123456778,
                "is_bot": true,
                "first_name": "name",
                "username": "username"
            },
            "chat": {
                "id": 12345678,
                "first_name": "",
                "last_name": "",
                "username": "",
                "type": "private"
            },
            "date": 1736320441,
            "text": "Choose Your country",
            "reply_markup": {
                "inline_keyboard": [
                    [
                        {
                            "text": "Germany",
                            "callback_data": "option_germany"
                        },
                        {
                            "text": "Sweden",
                            "callback_data": "option_sweden"
                        }
                    ]
                ]
            }
        },
        "chat_instance": "87643242397419503",
        "data": "option_sweden"
    }
}
Expected Behavior:
CallbackQuery should deserialize correctly and be accessible in the Update object.
Actual Behavior:
CallbackQuery is always null.
Notes:

This issue persists across all versions tested (22.0.0 to 22.3.0).
The webhook is set up correctly, and the allowed_updates array includes "callback_query".
Using custom classes for deserialization works correctly, confirming the payload itself is valid.

Let me know if additional details or a minimal reproducible example is needed.

Closing comment (2025-01-08T08:08:15Z): duplicate of #1436