TelegramPHP Documentation

InlineApi

This file is generated from spec/openapi.json (Bot API 10.3) by tools/generate.php.

Do not edit it by hand - run composer spec:build instead.

Inline mode, callback queries, and Mini App queries - everything the bot answers rather than initiates.

Mixed into Telegram through Methods. Every method is named exactly as the Bot API names it, takes exactly the fields the Bot API documents (use named arguments for the optional ones), and resolves with the hydrated result.

Tags
link
https://core.telegram.org/bots/api
since

v10.3

Table of Contents

Methods

answerCallbackQuery()  : PromiseInterface<string|int, bool>
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
answerGuestQuery()  : PromiseInterface<string|int, SentGuestMessage>
Use this method to reply to a received guest message. On success, a SentGuestMessage object is returned.
answerInlineQuery()  : PromiseInterface<string|int, bool>
Use this method to send answers to an inline query. On success, True is returned.
answerWebAppQuery()  : PromiseInterface<string|int, SentWebAppMessage>
Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.
savePreparedInlineMessage()  : PromiseInterface<string|int, PreparedInlineMessage>
Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
savePreparedKeyboardButton()  : PromiseInterface<string|int, PreparedKeyboardButton>
Stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton object.
sendChatJoinRequestWebApp()  : PromiseInterface<string|int, bool>
Use this method to process a received chat join request query by showing a Mini App to the user before deciding the outcome. Call answerChatJoinRequestQuery to resolve the join request query based on the user interaction with the Mini App. Returns True on success.

Methods

answerCallbackQuery()

Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.

public answerCallbackQuery(string $callback_query_id[, string|null $text = null ][, bool|null $show_alert = null ][, string|null $url = null ][, int|null $cache_time = null ]) : PromiseInterface<string|int, bool>
Parameters
$callback_query_id : string

Unique identifier for the query to be answered

$text : string|null = null

Optional. Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters.

$show_alert : bool|null = null

Optional. If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to False.

$url : string|null = null

Optional. URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.

$cache_time : int|null = null

Optional. The maximum amount of time in seconds that the result of the callback query may be cached client-side. Defaults to 0.

Tags
link
https://core.telegram.org/bots/api#answercallbackquery
Return values
PromiseInterface<string|int, bool>

answerGuestQuery()

Use this method to reply to a received guest message. On success, a SentGuestMessage object is returned.

public answerGuestQuery(string $guest_query_id, InlineQueryResult|array<string|int, mixed> $result) : PromiseInterface<string|int, SentGuestMessage>
Parameters
$guest_query_id : string

Unique identifier for the query to be answered

$result : InlineQueryResult|array<string|int, mixed>

A JSON-serialized object describing the message to be sent

Tags
link
https://core.telegram.org/bots/api#answerguestquery
Return values
PromiseInterface<string|int, SentGuestMessage>

answerInlineQuery()

Use this method to send answers to an inline query. On success, True is returned.

public answerInlineQuery(string $inline_query_id, array<int, InlineQueryResult|array<string|int, mixed>> $results[, int|null $cache_time = null ][, bool|null $is_personal = null ][, string|null $next_offset = null ][, InlineQueryResultsButton|array<string|int, mixed>|null $button = null ]) : PromiseInterface<string|int, bool>

No more than 50 results per query are allowed.

Parameters
$inline_query_id : string

Unique identifier for the answered query

$results : array<int, InlineQueryResult|array<string|int, mixed>>

A JSON-serialized Array of results for the inline query

$cache_time : int|null = null

Optional. The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.

$is_personal : bool|null = null

Optional. Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.

$next_offset : string|null = null

Optional. Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.

$button : InlineQueryResultsButton|array<string|int, mixed>|null = null

Optional. A JSON-serialized object describing a button to be shown above inline query results

Tags
link
https://core.telegram.org/bots/api#answerinlinequery
Return values
PromiseInterface<string|int, bool>

answerWebAppQuery()

Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.

public answerWebAppQuery(string $web_app_query_id, InlineQueryResult|array<string|int, mixed> $result) : PromiseInterface<string|int, SentWebAppMessage>
Parameters
$web_app_query_id : string

Unique identifier for the query to be answered

$result : InlineQueryResult|array<string|int, mixed>

A JSON-serialized object describing the message to be sent

Tags
link
https://core.telegram.org/bots/api#answerwebappquery
Return values
PromiseInterface<string|int, SentWebAppMessage>

savePreparedInlineMessage()

Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.

public savePreparedInlineMessage(int $user_id, InlineQueryResult|array<string|int, mixed> $result[, bool|null $allow_user_chats = null ][, bool|null $allow_bot_chats = null ][, bool|null $allow_group_chats = null ][, bool|null $allow_channel_chats = null ]) : PromiseInterface<string|int, PreparedInlineMessage>
Parameters
$user_id : int

Unique identifier of the target user that can use the prepared message

$result : InlineQueryResult|array<string|int, mixed>

A JSON-serialized object describing the message to be sent

$allow_user_chats : bool|null = null

Optional. Pass True if the message can be sent to private chats with users

$allow_bot_chats : bool|null = null

Optional. Pass True if the message can be sent to private chats with bots

$allow_group_chats : bool|null = null

Optional. Pass True if the message can be sent to group and supergroup chats

$allow_channel_chats : bool|null = null

Optional. Pass True if the message can be sent to channel chats

Tags
link
https://core.telegram.org/bots/api#savepreparedinlinemessage
Return values
PromiseInterface<string|int, PreparedInlineMessage>

savePreparedKeyboardButton()

Stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton object.

public savePreparedKeyboardButton(int $user_id, KeyboardButton|array<string|int, mixed> $button) : PromiseInterface<string|int, PreparedKeyboardButton>
Parameters
$user_id : int

Unique identifier of the target user that can use the button

$button : KeyboardButton|array<string|int, mixed>

A JSON-serialized object describing the button to be saved. The button must be of the type request_users, request_chat, or request_managed_bot.

Tags
link
https://core.telegram.org/bots/api#savepreparedkeyboardbutton
Return values
PromiseInterface<string|int, PreparedKeyboardButton>

sendChatJoinRequestWebApp()

Use this method to process a received chat join request query by showing a Mini App to the user before deciding the outcome. Call answerChatJoinRequestQuery to resolve the join request query based on the user interaction with the Mini App. Returns True on success.

public sendChatJoinRequestWebApp(string $chat_join_request_query_id, string $web_app_url) : PromiseInterface<string|int, bool>
Parameters
$chat_join_request_query_id : string

Unique identifier of the join request query

$web_app_url : string

An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps

Tags
link
https://core.telegram.org/bots/api#sendchatjoinrequestwebapp
Return values
PromiseInterface<string|int, bool>
On this page

Search results