BaleMessenger icon

BaleMessenger

Interact with Bale Messenger API

Overview

The node integrates with the Bale Messenger API to send various types of messages and perform chat-related actions. Specifically, for the Message resource and Send Document operation, it allows sending document files to a specified chat in Bale Messenger.

This is useful when you want to automate sending documents such as PDFs, Word files, or other file types directly into a chat, either by uploading new binary data or by referencing an existing file on Bale servers.

Practical examples:

  • Automatically sending invoices or reports as PDF documents to a customer support chat.
  • Sharing contracts or forms as documents in team chats.
  • Distributing manuals or guides as documents in group chats.

Properties

Name Meaning
Chat ID Unique identifier for the target chat where the document will be sent.
Binary Data Boolean flag indicating whether the document data should be taken from a binary field in the input.
Binary Property Name of the binary property containing the document data to upload (used if Binary Data is true).
File ID Identifier of a file already stored on Bale servers to send instead of uploading new data.
Reply Markup Additional interface options for the message; can be one of: Inline Keyboard, Reply Keyboard, Reply Keyboard Remove, or None.
Inline Keyboard Configuration for inline keyboard buttons that appear next to the message (if Reply Markup is Inline Keyboard).
Reply Keyboard Configuration for a custom reply keyboard with buttons (if Reply Markup is Reply Keyboard).
Reply Keyboard Remove Options to remove a custom keyboard from the client (if Reply Markup is Reply Keyboard Remove).
Reply To Message ID If replying to a specific message, the ID of that original message.
Caption Optional caption text to accompany the document, up to 1024 characters.
File Name Filename to assign to the uploaded document (used if Binary Data is true).

Output

The output JSON contains the response from the Bale Messenger API after sending the document. This typically includes metadata about the sent message such as message ID, chat ID, date, and document details.

If the node uploads binary data, the binary output is empty because the document is sent to Bale Messenger rather than passed downstream as binary data.

Example output structure (simplified):

{
  "message_id": 123,
  "chat": {
    "id": "chatId",
    "type": "private"
  },
  "date": 1610000000,
  "document": {
    "file_id": "file_id_string",
    "file_name": "example.pdf",
    "mime_type": "application/pdf",
    "file_size": 123456
  }
}

Dependencies

  • Requires an active Bale Messenger API token credential configured in n8n.
  • Uses the official Bale Messenger Bot API endpoint https://tapi.bale.ai/bot.
  • The node depends on the node-telegram-bot-api library adapted for Bale Messenger API calls.
  • For sending binary data, the input must contain the binary file under the specified binary property name.

Troubleshooting

  • Invalid Chat ID: Ensure the Chat ID is correct and the bot has permission to send messages to that chat.
  • File Not Found: When using File ID, verify the file exists on Bale servers and the ID is valid.
  • Binary Data Issues: If Binary Data is enabled but the binary property is missing or incorrectly named, the upload will fail.
  • Caption Length: Captions longer than 1024 characters may cause errors.
  • Reply Markup Misconfiguration: Incorrectly structured inline or reply keyboards can cause the API to reject the message.
  • API Errors: Network issues or invalid API tokens will result in errors; check credentials and connectivity.

Common error messages usually include details from the Bale API response. Review these messages to adjust parameters accordingly.

Links and References


This summary focuses on the Message resource and Send Document operation as requested.

Discussion