Skip to content

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_idIntegerRequired
Unique identifier for the target direct messages chat
message_idIntegerRequired
Identifier of a suggested post message to decline
commentStringOptionalminLen 0maxLen 128
Comment 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

CodeErrorCause
400Bad Request: chat not foundchat_id is invalid or the bot has no access to this DM chat
400Bad Request: message not foundThe suggested post message doesn't exist or was already handled
400Bad Request: comment is too longcomment exceeds 128 characters — shorten the message
403Forbidden: not enough rightsBot lacks can_manage_direct_messages right in the corresponding channel
429Too Many Requests: retry after NRate limit hit — check retry_after, use auto-retry plugin

Tips & Gotchas

  • The chat_id is the DM chat, not the channel. The bot must have can_manage_direct_messages in the channel, which grants it access to the associated direct messages chat. The chat_id you pass is the DM chat identifier, not the channel ID.
  • comment is 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 approveSuggestedPost for 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 declineSuggestedPost resolves the pending post request; the original message is not automatically deleted.

See Also