sendGift

Raw MD
Sends a gift to the given user or channel chat

Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.

Parameters

ParameterTypeRequiredDescription
user_idIntegerOptionalRequired if chat_id is not specified. Unique identifier of the target user who will receive the gift.
chat_idInteger or StringOptionalRequired if user_id is not specified. Unique identifier for the chat or username of the channel (in the format @username) that will receive the gift.
gift_idStringYesIdentifier of the gift; limited gifts can't be sent to channel chats
pay_for_upgradeBooleanOptionalPass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
textStringOptionalText that will be shown along with the gift; 0-128 characters
text_parse_modeStringOptionalMode for parsing entities in the text. See formatting options for more details. Entities other than "bold", "italic", "underline", "strikethrough", "spoiler", "custom_emoji", and "date_time" are ignored.
text_entitiesArray of MessageEntityOptionalA JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than "bold", "italic", "underline", "strikethrough", "spoiler", "custom_emoji", and "date_time" are ignored.

Example

PHP — Call sendGift 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('sendGift', [
    'gift_id' => 'value',
]);

if ($resp['ok'] ?? false) {
    $result = $resp['result']; // handle the response
}
Botlify Cloud Runtime
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.