LINE Trigger icon

LINE Trigger

Handle LINE webhook events (messages, postbacks, follows, etc.)

LINE Trigger

AI-generated

Overview

This node acts as a webhook trigger for LINE messaging events. It listens for various LINE events such as messages, follows, unfollows, joins, leaves, postbacks, beacons, account links, and device link/unlink events. When an event occurs, the node captures the event data and outputs it for further workflow processing. It is useful for automating responses or actions based on user interactions with a LINE bot, such as replying to messages, tracking user engagement, or handling device events.

Use Case Examples

  1. Automatically respond to user messages sent to a LINE bot.
  2. Track when users add or remove the bot as a friend.
  3. Handle postback actions triggered by user interactions with template messages.
  4. Download and process media content sent by users, such as images or videos.

Properties

Name Meaning
Path The webhook path to listen to for incoming LINE events, e.g., 'line' creates a webhook URL like https://your-n8n-url/webhook/line.
Events The specific LINE events to listen for, such as message, follow, unfollow, join, leave, postback, beacon, account link, and device-related events.
Download Binary Content Whether to automatically download binary content (image, video, audio, file) when received in a message event.
Binary Property Name The name of the binary property to store the downloaded content if binary download is enabled.

Output

JSON

  • eventType - Type of the LINE event received.
  • timestamp - Timestamp of the event.
  • source - Source information of the event (e.g., user, group, room).
  • webhookEventId - Unique identifier for the webhook event.
  • deliveryContext - Context information about the delivery of the event.
  • replyToken - Token used to reply to the event, if applicable.
  • message
    • id - ID of the message, if the event is a message.
    • type - Type of the message (text, image, video, audio, location, sticker, file).
    • text - Text content of the message, if applicable.
    • emojis - Emojis included in the text message, if any.
    • mention - Mention information in the text message, if any.
    • contentProvider - Content provider information for media messages.
    • imageSet - Image set information for image messages.
    • fileName - File name for file messages.
    • fileSize - File size for file messages.
    • duration - Duration for audio or video messages.
    • title - Title for location messages.
    • address - Address for location messages.
    • latitude - Latitude for location messages.
    • longitude - Longitude for location messages.
    • packageId - Package ID for sticker messages.
    • stickerId - Sticker ID for sticker messages.
    • stickerResourceType - Sticker resource type for sticker messages.
    • keywords - Keywords associated with the sticker.
  • postback
    • data - Data from postback events.
    • params - Parameters from postback events.
  • joined
    • members - Members who joined in memberJoined events.
  • left
    • members - Members who left in memberLeft events.
  • beacon
    • hwid - Hardware ID for beacon events.
    • type - Type of beacon event.
    • dm - Device message for beacon events.
  • link
    • result - Result of account link events.
    • nonce - Nonce for account link events.
  • things
    • type - Type of device event.
    • deviceId - Device ID for device events.
  • binaryDownloaded - Indicates if binary content was successfully downloaded.
  • binaryPropertyName - Name of the binary property where content is stored.
  • mimeType - MIME type of the downloaded binary content.
  • size - Size of the downloaded binary content in bytes.
  • binaryDownloadError - Error message if binary content download failed.

Dependencies

  • An API key credential for LINE Messaging API with channel secret and access token

Troubleshooting

  • Missing or invalid 'x-line-signature' header will cause the webhook to reject requests. Ensure the LINE platform is correctly configured to send requests with this header.
  • If the signature validation fails, the webhook request is rejected as not coming from LINE. Verify the channel secret is correctly set in the credentials.
  • Binary content download may fail due to network issues or invalid message IDs. Check the error message in the output and ensure the access token has proper permissions.
  • Ensure the webhook URL is correctly set in the LINE Developers Console under Messaging API settings and that 'Use webhook' is enabled.

Links

Discussion