BaleMessenger icon

BaleMessenger

Interact with Bale Messenger API

Overview

The node implements interaction with the Bale Messenger API, specifically focusing here on the Callback resource with the Answer Query operation. This operation allows the bot to send an answer to a callback query that was sent from an inline keyboard in a chat.

This is useful in scenarios where your bot presents interactive inline buttons to users, and you want to respond to their button presses with notifications or alerts without sending a new message. For example, after a user clicks a button, you can acknowledge the action by showing a notification or alert, optionally including text or opening a URL.

Practical examples:

  • Confirming a user's selection in a poll or quiz.
  • Showing an alert message when a user presses a button.
  • Redirecting the user to a URL after they interact with an inline button.

Properties

Name Meaning
Query ID Unique identifier for the callback query to be answered (required).
Reply Keyboard Adds a custom reply keyboard with rows of buttons. Each button sends its text as a message when pressed.
Reply Keyboard Remove Options to remove the custom keyboard, with flags to remove it and selectively force reply from users.
Additional Fields Optional parameters:
- 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 or alert (0-200 characters).
- URL URL to open in the user's client upon answering the query.

Output

The output JSON contains a single field:

  • successful: A boolean indicating whether the callback query was answered successfully.

If an error occurs during the operation, the output includes:

  • successful: false
  • errorMessage: The error message string.
  • errorDetails: Additional error data if available.

No binary data is output by this operation.

Example output on success:

{
  "successful": true
}

Example output on failure:

{
  "successful": false,
  "errorMessage": "Error message here",
  "errorDetails": {}
}

Dependencies

  • Requires an active Bale Messenger API token credential configured in n8n.
  • Uses the Bale Messenger API endpoint https://tapi.bale.ai/bot.
  • Relies on the axios library for HTTP requests.
  • No additional environment variables are required beyond the API token credential.

Troubleshooting

  • Invalid Query ID: If the provided Query ID is incorrect or expired, the API will fail to answer the callback query. Verify the correctness and freshness of the query ID.
  • API Authentication Errors: Ensure the API token credential is valid and has sufficient permissions.
  • Network Issues: Network connectivity problems can cause request failures; check network access to the Bale Messenger API endpoint.
  • Malformed Additional Fields: Providing invalid values in additional fields like cache_time or text exceeding length limits may cause errors.
  • Error Messages: The node logs detailed error information to the console. Review these logs to identify issues.
  • JSON Parsing Errors: Not applicable for this operation but relevant for related operations handling JSON input.

Links and References


This summary covers the static analysis of the node's execute method for the Callback resource and Answer Query operation only, based on the provided source code and property definitions.

Discussion