Skip to main content

messages.forwardMessages

Forwards messages by their IDs.

func (c *Client) MessagesForwardMessages(ctx context.Context, request *MessagesForwardMessagesRequest) (UpdatesClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesForwardMessages(ctx, &tg.MessagesForwardMessagesRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters

NameTypeRequiredDescription
SilentboolWhether to send messages silently (no notification will be triggered on the destination clients)
BackgroundboolWhether to send the message in background
WithMyScoreboolWhen forwarding games, whether to include your score in the game
DropAuthorboolWhether to forward messages without quoting the original author
DropMediaCaptionsboolWhether to strip captions from media
NoforwardsboolOnly for bots, disallows further re-forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled
AllowPaidFloodskipboolBots only: if set, allows sending up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance.
FromPeerInputPeerClassyesSource of messages
ID[]intyesIDs of messages
RandomID[]int64yesRandom ID to prevent resending of messages
ToPeerInputPeerClassyesDestination peer
TopMsgIDintDestination forum topic
ReplyToInputReplyToClassCan only contain an inputReplyToMonoForum, to forward messages to a monoforum topic (mutually exclusive with top_msg_id).
ScheduleDateintScheduled message date for scheduled messages
ScheduleRepeatPeriodintOnce sent, this message will be automatically re-scheduled to be re-sent again this many seconds in the future, see here » for more info on repeating scheduled messages.
SendAsInputPeerClassForward the messages as the specified peer
QuickReplyShortcutInputQuickReplyShortcutClassAdd the messages to the specified quick reply shortcut », instead.
Effectint64Specifies a message effect » to use for the message.
VideoTimestampintStart playing the video at the specified timestamp (seconds).
AllowPaidStarsint64For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message.
SuggestedPostSuggestedPostUsed to suggest a post to a channel, see here » for more info on the full flow.

Returns

UpdatesClass

Possible errors

CodeTypeDescription
406ALLOW_PAYMENT_REQUIREDThis peer only accepts paid messages »: this error is only emitted for older layers without paid messages support, so the client must be updated in order to use paid messages. .
400BROADCAST_PUBLIC_VOTERS_FORBIDDENYou can't forward polls with public voters.
400CHANNEL_INVALIDThe provided channel is invalid.
406CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
403CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
406CHAT_FORWARDS_RESTRICTEDYou can't forward messages from a protected chat.
403CHAT_GUEST_SEND_FORBIDDENYou join the discussion group before commenting, see here » for more info.
400CHAT_ID_INVALIDThe provided chat id is invalid.
400CHAT_RESTRICTEDYou can't send messages in this chat, you were restricted.
403CHAT_SEND_AUDIOS_FORBIDDENYou can't send audio messages in this chat.
403CHAT_SEND_DOCS_FORBIDDENYou can't send documents in this chat.
403CHAT_SEND_GAME_FORBIDDENYou can't send a game to this chat.
403CHAT_SEND_GIFS_FORBIDDENYou can't send gifs in this chat.
403CHAT_SEND_INLINE_FORBIDDENYou can't send inline messages in this group.
403CHAT_SEND_MEDIA_FORBIDDENYou can't send media in this chat.
403CHAT_SEND_PHOTOS_FORBIDDENYou can't send photos in this chat.
403CHAT_SEND_PLAIN_FORBIDDENYou can't send non-media (text) messages in this chat.
403CHAT_SEND_POLL_FORBIDDENYou can't send polls in this chat.
403CHAT_SEND_STICKERS_FORBIDDENYou can't send stickers in this chat.
403CHAT_SEND_VIDEOS_FORBIDDENYou can't send videos in this chat.
403CHAT_SEND_VOICES_FORBIDDENYou can't send voice recordings in this chat.
403CHAT_SEND_WEBPAGE_FORBIDDENYou can't send webpage previews to this chat.
403CHAT_WRITE_FORBIDDENYou can't write in this chat.
400GROUPED_MEDIA_INVALIDInvalid grouped media.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MEDIA_EMPTYThe provided media object is invalid.
400MESSAGE_IDS_EMPTYNo message ids were provided.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400MSG_ID_INVALIDInvalid message ID provided.
500NEED_DOC_INVALID
406PAYMENT_UNSUPPORTEDA detailed description of the error will be received separately as described here ».
406PEER_ID_INVALIDThe provided peer id is invalid.
403PREMIUM_ACCOUNT_REQUIREDA premium account is required to execute this action.
406PRIVACY_PREMIUM_REQUIREDYou need a Telegram Premium subscription to send a message to this user.
400QUICK_REPLIES_BOT_NOT_ALLOWEDQuick replies cannot be used by bots.
400QUICK_REPLIES_TOO_MUCHA maximum of appConfig.quick_replies_limit shortcuts may be created, the limit was reached.
400QUIZ_ANSWER_MISSINGYou can forward a quiz while hiding the original author only after choosing an option in the quiz.
500RANDOM_ID_DUPLICATEYou provided a random ID that was already used.
400RANDOM_ID_INVALIDA provided random ID is invalid.
400REPLY_MESSAGES_TOO_MUCHEach shortcut can contain a maximum of appConfig.quick_reply_messages_limit messages, the limit was reached.
400REPLY_TO_MONOFORUM_PEER_INVALIDThe specified inputReplyToMonoForum.monoforum_peer_id is invalid.
400SCHEDULE_BOT_NOT_ALLOWEDBots cannot schedule messages.
400SCHEDULE_DATE_TOO_LATEYou can't schedule a message this far in the future.
400SCHEDULE_TOO_MUCHThere are too many scheduled messages.
400SEND_AS_PEER_INVALIDYou can't send messages as the specified peer.
400SLOWMODE_MULTI_MSGS_DISABLEDSlowmode is enabled, you cannot forward multiple messages to this group.
400SUGGESTED_POST_PEER_INVALIDYou cannot send suggested posts to non-monoforum peers.
406TOPIC_CLOSEDThis topic was closed, you can't send messages to it anymore.
406TOPIC_DELETEDThe specified topic was deleted.
400USER_BANNED_IN_CHANNELYou're banned from sending messages in supergroups/channels.
403USER_IS_BLOCKEDYou were blocked by this user.
400USER_IS_BOTBots can't send messages to other bots.
403VOICE_MESSAGES_FORBIDDENThis user's privacy settings forbid you from sending voice messages.
400YOU_BLOCKED_USERYou blocked this user.

References