Mock a Telegram bot webhook
A POST mock that replies to a Telegram Update with a sendMessage call back to the same chat.
Telegram lets a webhook reply to an Update by returning a Bot API method call in the response body itself, instead of making a second outbound request. This template does that: it reads the chat ID from the incoming Update and replies with a sendMessage addressed back to the same chat, so you can see the round trip working before writing any bot code.
Accepts an incoming call and replies the way the service expects.
Response payload
{
"method": "sendMessage",
"chat_id": {{request.body.message.chat.id}},
"text": "Thanks, got it!"
}
Fields worth knowing
| Field | What it means |
|---|---|
| method | The Bot API method name that the webhook response itself performs. |
| chat_id | Taken from the incoming Update via {{request.body.message.chat.id}}. |
| text | The reply text; edit it to test a different bot response. |
Create the mock
curl -X POST https://quickmock.dev/api/mocks \
-H 'Content-Type: application/json' \
-d '{
"method": "POST",
"response_status": 200,
"content_type": "application/json",
"response_body": "{\"method\":\"sendMessage\",\"chat_id\":{{request.body.message.chat.id}},\"text\":\"Thanks, got it!\"}"
}'
Call it
curl -X POST -H 'Content-Type: application/json' -d '{"update_id":900000001,"message":{"message_id":42,"date":1717200000,"chat":{"id":987654321,"type":"private"},"text":"/start"}}' https://quickmock.dev/m/<slug>
What you get
POST a Telegram Update -> 200 {"method":"sendMessage","chat_id":987654321,"text":"Thanks, got it!"}
the webhook response itself is treated as a Bot API method call
How this differs from the real thing
Telegram's webhook secret token isn't checked — this mock replies to anyone who posts a matching Update, not only to Telegram's own servers.
Sources
FAQ
- How does replying in the response body work?
- Telegram reads a Bot API method name and its arguments from the webhook's own response, so a simple bot can answer without calling the API separately. It is the lowest-latency way to reply and the easiest to mock.
- Does it check the secret token?
- No. Telegram's webhook secret token is not verified, so the mock replies to anyone who posts a matching Update. Treat that check as your handler's job.
- Where does chat_id come from?
- From the incoming Update, via a request token that reads message.chat.id. If your test payload omits that path the token is left in the response verbatim instead of resolving, and because chat_id is unquoted the reply comes back as invalid JSON rather than an empty field. Worth seeing once: a real Update with an unexpected shape behaves the same way.
Ready to use it?
Pairs well with this guide: Echo the request back
Related templates
Last updated: 2026-10-17