declineSuggestedPost
Returns: TrueOfficial docs ↗
Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success.
Parameters
chat_idIntegerRequiredUnique identifier for the target direct messages chat
message_idIntegerRequiredIdentifier of a suggested post message to decline
commentStringOptionalminLen 0maxLen 128Comment for the creator of the suggested post; 0-128 characters
Returns
On success, True is returned.
GramIO Usage
ts
// Decline a suggested post without a comment
await bot.api.declineSuggestedPost({
chat_id: -1001234567890,
message_id: 42,
comment: "",
});ts
// Decline with a reason for the post author
await bot.api.declineSuggestedPost({
chat_id: -1001234567890,
message_id: 42,
comment: "This content doesn't match our channel guidelines.",
});ts
// Moderate suggested posts via callback query from an admin panel
bot.on("callback_query", async (ctx) => {
const data = ctx.queryPayload;
if (typeof data === "string" && data.startsWith("decline:")) {
const messageId = Number(data.split(":")[1]);
await bot.api.declineSuggestedPost({
chat_id: -1001234567890,
message_id: messageId,
comment: "Declined by moderator.",
});
await ctx.answerCallbackQuery({ text: "Post declined." });
}
});Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: chat not found | chat_id is invalid or the bot has no access to this DM chat |
| 400 | Bad Request: message not found | The suggested post message doesn't exist or was already handled |
| 400 | Bad Request: comment is too long | comment exceeds 128 characters — shorten the message |
| 403 | Forbidden: not enough rights | Bot lacks can_manage_direct_messages right in the corresponding channel |
| 429 | Too Many Requests: retry after N | Rate limit hit — check retry_after, use auto-retry plugin |
Tips & Gotchas
- The
chat_idis the DM chat, not the channel. The bot must havecan_manage_direct_messagesin the channel, which grants it access to the associated direct messages chat. Thechat_idyou pass is the DM chat identifier, not the channel ID. commentis required but can be empty. Pass""to decline without leaving feedback for the post author. When declining with a reason, stay within the 128-character limit.- Pair with
approveSuggestedPostfor a moderation flow. Both methods work symmetrically — use one or the other depending on the admin decision. - The suggested post message stays visible until handled. Calling
declineSuggestedPostresolves the pending post request; the original message is not automatically deleted.
See Also
- approveSuggestedPost — approve the same suggested post instead
- deleteMessage — delete a message entirely