Lola Message Composer icon

Lola Message Composer

Lola Message Composer, a node to compose a message structure to send to Lola Assistant

Lola Message Composer

AI-generated

Overview

The Lola Message Composer node is designed to create a structured message object for sending to the Lola Assistant. It allows you to compose messages from various sources (such as Telegram, WhatsApp, Chatwoot Omnichannel, or custom parameters) and supports features like language detection, message typing (text, image, etc.), and user/chat identification. This node is particularly useful in workflows where you need to standardize incoming messages before processing them with Lola Assistant or other downstream systems.

Practical examples:

  • Standardizing messages from different chat platforms before sending them to an AI assistant.
  • Automatically detecting and setting the language of a user's message.
  • Composing rich messages (including images) from custom input for further automation.

Properties

Name Meaning
Source Selects the origin of the message. Options: Telegram, Whatsapp, Chatwoot Omnichannel, Custom.
Source ID The source ID of the message, useful for tracking in command executions (e.g., telegram, slack, discord, etc.). Only shown if Source is "Custom".
Chat First Name The first name of the user that sent the message. Only shown if Source is "Custom".
Chat Last Name The last name of the user that sent the message. Only shown if Source is "Custom".
User Identifier The ID of the user to execute the workflow as. Required if Source is "Custom".
Chat Identifier A chat identifier to identify the chat session. Required if Source is "Custom".
Phone Number The phone number of the user that sent the message. Shown if Source is "Custom" or "Telegram".
Message Identifier A message identifier to track the message. Only shown if Source is "Custom".
Message Type Specify the type of message to send. Options: image, audio, video, file, location, contact, text. Required if Source is "Custom".
Input Text The message to send to Lola Assistant. Required if Source is "Custom".
Auto Detect Language Whether to automatically detect the language of the message to send to Lola Assistant. If enabled, disables manual language selection.
OpenAI Detect Language Whether to use OpenAI to automatically detect the language. Only shown if Auto Detect Language is enabled.
Language The language of the message to send to Lola Assistant (ISO 639-1 code, e.g., en, es, fr, it, pt). Only shown if Auto Detect Language is disabled.
Fallback Language The fallback language if language detection fails (ISO 639-1 code, e.g., en, es, fr, it, pt). Only shown if Auto Detect Language is enabled.
Image (Base64) If the message type is image, specify the image in base64 format. Only shown if Source is "Custom".

Output

The node adds a lola_message field to the output item's json property. The structure is as follows:

{
  "lola_message": {
    "source": "...",        // Source ID or identifier
    "chatwoot": {...},      // Chatwoot-specific info (if applicable)
    "message": {
      "message_id": "...",  // Message identifier
      "from": {
        "id": "...",        // User identifier
        "is_bot": false,
        "first_name": "...",
        "last_name": "...",
        "language_code": {  // Language detection result
          "languageCode": "...",
          "languageName": "...",
          "confidence": 1,
          "success": true,
          "reason": "..."
        },
        "phone": "..."      // Phone number (if provided)
      },
      "chat": {
        "id": "..."         // Chat identifier
      },
      "date": 1680000000000, // Timestamp (milliseconds since epoch)
      "type": "...",        // Message type (text, image, etc.)
      "text": "...",        // Message text
      "image": "...",       // Base64 image data (if applicable)
      "image_url": "...",   // Image URL (if applicable)
      "contact": "...",     // Contact info (if applicable)
      "reply": "..."        // Reply info (if applicable)
    }
  }
}
  • If the message type is "image" and an image is provided, the image field will contain the base64-encoded image data.
  • Language detection results are included under from.language_code.

Dependencies

  • No external API keys are required for this node itself, but:
    • If using language detection, the node may rely on external services (e.g., OpenAI) depending on configuration.
    • If integrating with Lola Assistant, ensure any required credentials (like lolaKeyApi) are configured in n8n.
  • No special environment variables are needed unless required by upstream integrations.

Troubleshooting

Common issues:

  • Missing required fields: If required properties (like User Identifier, Chat Identifier, or Input Text) are not provided when Source is "Custom", the node will throw validation errors.
  • Language detection failures: If automatic language detection fails, the node will fall back to the specified fallback language.
  • Invalid base64 image: If the "Image (Base64)" field is not properly formatted, downstream nodes expecting valid image data may fail.

Error messages and resolutions:

  • "Parameter X is required" — Ensure all required fields are filled out, especially when using the "Custom" source option.
  • "Failed to detect language" — Check your language detection settings and ensure fallback language is set.

Links and References

Discussion