Actions23
- Chat Actions
- Callback Actions
- File Actions
- Message Actions
Overview
This node operation allows you to answer inline queries sent to a Telegram bot. Inline queries occur when users type a query in the message input field of any chat, and your bot can provide real-time results that the user can select from without sending a direct message to the bot.
The "Answer Inline Query" operation sends back a JSON-serialized array of results to Telegram, which are then displayed as selectable options to the user inline. This is useful for creating interactive bots that provide search results, media, or other dynamic content directly within the chat interface.
Practical examples:
- A GIF search bot that returns relevant animations based on user input.
- A product catalog bot that shows items matching the user's query.
- A location sharing bot that suggests nearby places inline.
Properties
Name | Meaning |
---|---|
Query ID | Unique identifier for the answered inline query. |
Results | A JSON-serialized array of results for the inline query. These results define what the user will see. |
Additional Fields | Optional parameters to customize the response: |
- Cache Time: Maximum time (in seconds) the result may be cached client-side. | |
- Show Alert: Whether to show an alert instead of a notification at the top of the chat screen. | |
- Text: Text of the notification shown to the user (0-200 characters). | |
- URL: URL that will be opened by the user's client. | |
Reply Keyboard | Adds a custom reply keyboard with rows and buttons (not typically used in inline query answers). |
Reply Keyboard Options | Options for the reply keyboard such as resizing, one-time display, and selective visibility. |
Reply Keyboard Remove | Option to remove the custom keyboard and selectively force reply from specific users. |
Note: The main required properties for this operation are Query ID and Results. The additional fields allow fine-tuning the user experience.
Output
The node outputs an array of JSON objects representing the response from the Telegram API after answering the inline query. The structure corresponds to Telegram's API response for the answerInlineQuery
method, typically including a boolean ok
status and any relevant metadata.
If the operation succeeds, the output confirms that the inline query was answered successfully. No binary data is produced by this operation.
Dependencies
- Requires a valid Telegram Bot API key credential configured in n8n.
- Uses Telegram's
answerInlineQuery
API endpoint. - The
results
property must be a correctly formatted JSON string representing an array of inline query results according to Telegram's API specification.
Troubleshooting
- Invalid JSON in Results: If the
results
property is not a valid JSON-serialized array, the Telegram API will reject the request. Ensure the JSON is well-formed and matches Telegram's expected format. - Missing Query ID: The
queryId
is mandatory. Omitting it will cause errors. - API Authentication Errors: Make sure the Telegram API key credential is correctly set up and has permissions to answer inline queries.
- Cache Time Misconfiguration: Setting an excessively high cache time might delay updates to inline query results.
- Show Alert Usage: If
show_alert
is true but notext
is provided, the user may see an empty alert or error.