giftPremiumSubscription

Raw MD
Gifts a Telegram Premium subscription to the given user

Gifts a Telegram Premium subscription to the given user. Returns True on success.

Parameters

ParameterTypeRequiredDescription
user_idIntegerYesUnique identifier of the target user who will receive a Telegram Premium subscription
month_countIntegerYesNumber of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12
star_countIntegerYesNumber of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months
textStringOptionalText that will be shown along with the service message about the subscription; 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 giftPremiumSubscription 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('giftPremiumSubscription', [
    'user_id' => $userId,
    'month_count' => 'value',
    'star_count' => '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.