docs/agents/custom-code-agent/building-blocks/edit-sent-messages.mdx
ctx.reply() returns a ReplyHandle so that you can edit the message you just sent on the provider. This is useful when you post "Processing..." and replace it with the final text.
That is not a reply type; it updates a message you already sent.
| Capability | Slack | Teams | Telegram | ||
|---|---|---|---|---|---|
| Message edits in place | Yes | Yes | Yes | Yes | No |
| Plan card via edit-in-place | Native plan card | Markdown edit-in-place | No | Markdown edit-in-place | No |
| Outbound file attachments on edit | Yes | Yes | Not yet | Not yet | Not yet |
See Channels overview for the full matrix.
The following example sends a placeholder message, does work, then updates the same message in place:
const sentMessage = await ctx.reply('Processing...');
// ... do some work ...
await sentMessage.edit('Done! Here are your results.');
You can attach files when editing plain text or markdown content. Outbound files are delivered on Slack and Microsoft Teams; other channels do not support them yet. See Sending attachments.
await sentMessage.edit('Updated report attached.', {
files: [{ filename: 'report.pdf', url: 'https://example.com/report.pdf' }],
});
Edits update the existing platform message rather than posting a new one. Not every provider supports message editing. See Channels overview and the Channel support strip above.