forwardMessage
Use this method to forward messages of any kind
Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target bot, supergroup or channel in the format @username |
message_thread_id | Integer | Optional | Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only |
direct_messages_topic_id | Integer | Optional | Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat |
from_chat_id | Integer or String | Yes | Unique identifier for the chat where the original message was sent (or username of the target bot, supergroup or channel in the format @username) |
video_start_timestamp | Integer | Optional | New start timestamp for the forwarded video in the message |
disable_notification | Boolean | Optional | Sends the message silently. Users will receive a notification with no sound. |
protect_content | Boolean | Optional | Protects the contents of the forwarded message from forwarding and saving |
message_effect_id | String | Optional | Unique identifier of the message effect to be added to the message; only available when forwarding to private chats |
suggested_post_parameters | SuggestedPostParameters | Optional | A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only |
message_id | Integer | Yes | Message identifier in the chat specified in from_chat_id |
Example
PHP — Call forwardMessage on Botlify Cloud
<?php
// ── Botlify Cloud .env — auto-injected, never hardcode secrets ──
$BOT_TOKEN = getenv('BOT_TOKEN'); // Telegram bot token from @BotFather
$ADMIN_CHAT_ID = getenv('ADMIN_CHAT_ID'); // Your numeric admin Telegram user ID
$BOT_USERNAME = getenv('BOT_USERNAME'); // Bot username without @
$resp = bot('forwardMessage', [
'chat_id' => $chatId,
'from_chat_id' => $userId,
'message_id' => $messageId,
]);
if ($resp['ok'] ?? false) {
$result = $resp['result']; // handle the response
}Botlify Cloud Runtime
Credentials are auto-injected in
Credentials are auto-injected in
.env — always load them with getenv(): BOT_TOKEN, ADMIN_CHAT_ID, BOT_USERNAME. Main database: database.db (SQLite, WAL mode). Runtime errors: error.log. Quick test: send to $ADMIN_CHAT_ID. Full details: Runtime Reference.