Skip to content

Delivers a complete Update on inbound telegram simulation, relates #3 - #4

Merged
reiarseni merged 1 commit into
mainfrom
fix/3-update-telegram-incompleto
Aug 14, 2026
Merged

reiarseni merged 1 commit into
mainfrom
fix/3-update-telegram-incompleto

Conversation

@reiarseni

Copy link
Copy Markdown
Owner

Inbound simulation existed so an app could be driven through its real bot
client, but the delivered body was only {"message": {"chat": {"id"}, "text"}}.
Clients do not read that dict directly: python-telegram-bot calls
Update.de_json, which needs update_id and, inside message, message_id,
date, chat and from. Without them it raises KeyError: 'date' and the
app answers 500 to the webhook it had just received, so the feature could not
be used for what it exists for.

Found while testing a production app whose Telegram linking flow (/start <code>) runs over this exact path.

Changes

  • client/sendMessage now delivers a complete Update built by
    inbound_update(): incremental update_id, message_id, date, a from
    object carrying the simulated username, and a chat with its type.
  • Test covering the delivered payload field by field.

Closes #3

How to test

uv run pytest tests/test_telegram.py -q

Register an app plus a telegram webhook, POST to /telegram/client/sendMessage
and check the recorded delivery: the payload now parses with
telegram.Update.de_json instead of raising.

Change type

fix, test

Checklist

  • CI green
  • Tested locally
  • Self-review done

The webhook body carried only chat.id and text, so any client parsing it
with Update.de_json raised on the missing date and answered 500 to the
event it had just received. It now carries update_id, message_id, date,
from and a typed chat, like the real API sends.

Closes #3
@reiarseni
reiarseni merged commit 5b57b82 into main Aug 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Inbound telegram webhook delivers an incomplete Update

1 participant