feat(Telegram Node): Add option to delete sent message on Send and Wait response - #36919
feat(Telegram Node): Add option to delete sent message on Send and Wait response#36919HSGamer wants to merge 4 commits into
Conversation
|
✅ CLA Check passed. All contributors on this PR have signed the n8n CLA — thank you! |
|
/cla-check |
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Architecture diagram
sequenceDiagram
participant Telegram as Telegram API
participant Node as Telegram Node (Execute)
participant Storage as Execution Metadata (customData)
participant Webhook as Telegram Webhook Handler
participant User as User (Chat/Browser)
Note over Node,Telegram: Phase 1: Sending Message & Setup
Node->>Telegram: POST /sendMessage
Telegram-->>Node: 200 OK (message_id, numeric chat_id)
opt NEW: Option "Delete Message on Response" enabled
Node->>Node: Extract message identity
Node->>Storage: NEW: set("tgDeleteTarget", {chatId, messageId})
end
Note over Node: Workflow enters Wait state
Note over User,Webhook: Phase 2: User Response & Cleanup
User->>Webhook: Interaction (Button tap / Link / Form POST)
Webhook->>Storage: NEW: get("tgDeleteTarget")
Storage-->>Webhook: stored identity (if exists)
alt NEW: Option enabled AND valid metadata exists
alt Response is Custom Form or Free Text
opt Method is GET (Form Rendering)
Note right of Webhook: Skip deletion to keep form link active
end
end
opt Method is POST or Callback (Response Completion)
Webhook->>Telegram: NEW: POST /deleteMessage (Best-effort)
Telegram-->>Webhook: Result (ignored by node)
end
else Option disabled OR no metadata
Webhook->>Telegram: CHANGED: POST /editMessageText (Standard behavior)
end
Webhook-->>User: Response UI / Redirect
Note over Webhook: Execution resumes in workflow
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
Hey @HSGamer, Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request. Before we can proceed, please ensure the following: • Your PR references the GitHub issue it fixes (or, for feature requests, a link to the corresponding community forum post). • Tests are included for any new functionality, logic changes or bug fixes. • The PR aligns with our contribution guidelines. Why the linked issue matters: Our teams pick up work from the issue, not from individual pull requests — the issue is what reaches them, with your PR linked to it. So please make sure the issue contains everything needed to judge the change: a clear problem description, reproduction steps, and the expected behaviour. If the issue is thin, add the missing context there rather than only in the PR description. Regarding new nodes: We no longer accept new nodes directly into the core codebase. Instead, we encourage contributors to follow our Community Node Submission Guide to publish nodes independently. If your node integrates with an AI service that you own or represent, please email nodes@n8n.io and we will be happy to discuss the best approach. About review timelines: While we plan to review it as soon as possible, we are currently unable to provide an exact timeframe. Our goal is to begin reviews within a month, but this may change depending on team priorities. We will reach out when the review begins. Please also note that other contributors may have opened pull requests for the same issue. We keep them all open so the reviewing team can choose the approach that fits best. Once the issue is resolved, the remaining pull requests are closed — this is not a judgement on the quality of your work, and we're grateful for it either way. Thank you again for contributing to n8n. |
1 similar comment
|
Hey @HSGamer, Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request. Before we can proceed, please ensure the following: • Your PR references the GitHub issue it fixes (or, for feature requests, a link to the corresponding community forum post). • Tests are included for any new functionality, logic changes or bug fixes. • The PR aligns with our contribution guidelines. Why the linked issue matters: Our teams pick up work from the issue, not from individual pull requests — the issue is what reaches them, with your PR linked to it. So please make sure the issue contains everything needed to judge the change: a clear problem description, reproduction steps, and the expected behaviour. If the issue is thin, add the missing context there rather than only in the PR description. Regarding new nodes: We no longer accept new nodes directly into the core codebase. Instead, we encourage contributors to follow our Community Node Submission Guide to publish nodes independently. If your node integrates with an AI service that you own or represent, please email nodes@n8n.io and we will be happy to discuss the best approach. About review timelines: While we plan to review it as soon as possible, we are currently unable to provide an exact timeframe. Our goal is to begin reviews within a month, but this may change depending on team priorities. We will reach out when the review begins. Please also note that other contributors may have opened pull requests for the same issue. We keep them all open so the reviewing team can choose the approach that fits best. Once the issue is resolved, the remaining pull requests are closed — this is not a judgement on the quality of your work, and we're grateful for it either way. Thank you again for contributing to n8n. |
|
This feature request doesn't appear to be linked to a forum post. We require that community PRs that add features are linked to a forum post to help us understand the context behind the change and spot duplicate solutions. If no post exists yet, please open one describing the problem you're trying to solve. This looks like a feature rather than a bug fix, and we track feature requests on our community forum rather than in GitHub issues. That's where the discussion and the votes live, and it's what we use to gauge how many people need something before it goes into the product. Could you link a forum post for this change in the PR description? Either:
To be upfront: linking a post doesn't guarantee this gets merged. A feature with little demand behind it may still be declined, and we'd rather tell you that before you spend more time on it. But without a post there's no context for the reviewing team to weigh it against, so we can't move it forward at all. Once the description links a forum post, this PR will automatically return to triage. |
Summary
When using Send and Wait for Response on Telegram, the bot's message tends to stick around long after it has served its purpose — once somebody has responded, you're left with stale buttons or a dead form link sitting in the chat.
This PR adds an Options → Delete Message on Response toggle to the operation. When enabled, the bot deletes its own message as soon as the user responds, regardless of how they did it:
Implementation-wise, the message identity (chat + message ID) is captured from the
sendMessageresponse and stored in execution metadata (customData), which is persisted while the execution waits and is available again when the webhook resumes the execution. That means no extra Telegram API calls at send time and no IDs embedded in signed URLs.Deletion is deliberately best-effort — if the
deleteMessagecall fails, the execution still resumes normally. Old executions that were already waiting before this change simply skip deletion (no stored metadata).How to test
You'll need a real Telegram bot credential and an instance reachable over public HTTPS for the resume webhook.
Related Linear tickets, Github issues, and Community forum posts
Both posts describe the same problem this solves: after someone responds to a Send and Wait message, the stale approval buttons/form stay in the chat forever, and users want the bot to clean up its own message.
Review / Merge checklist