Hanna Bot Trigger

Triggers when IRC events occur in Hanna Bot

Overview

This node, named "Hanna Bot Trigger," is designed to trigger workflows in n8n when specific IRC (Internet Relay Chat) events occur related to the Hanna Bot. It listens for incoming webhook POST requests from the bot containing event data and filters these events based on user-configured criteria.

Common scenarios where this node is beneficial include:

  • Automating responses or logging when the bot is mentioned in a channel.
  • Monitoring private messages or notices sent to the bot.
  • Tracking user join/part/quit events in channels.
  • Handling server or connection status changes.
  • Filtering and reacting to specific IRC numeric or error codes.

Practical examples:

  • Automatically sending a welcome message when a user joins a channel.
  • Logging all private messages sent to the bot for audit purposes.
  • Triggering alerts when critical errors or disconnects happen on the IRC server.
  • Filtering events to only process those from certain channels or users.

Properties

Name Meaning
Authentication Token Token that the IRC bot must send to authenticate requests. This ensures only authorized events trigger the workflow.
IRC Events Select which IRC events should trigger this node. Options include Mention, Private Message, Notice, Join, Part, Quit, Kick, Mode, Nick, Topic, Server Events, Channel Info Events, User Info Events, Error Events, MOTD Events, WHOIS Events, LIST Events, Connection Events, Capability Events, All Numeric Events. Default is "Mention".
Filter Channels Comma-separated list of channels to filter events by (e.g., #general,#dev). Leave empty to allow events from all channels.
Filter Users Comma-separated list of users to filter events by (e.g., alice,bob). Leave empty to allow events from all users.
Include Bot Messages Boolean flag whether to include messages originating from the bot itself. Defaults to false (bot messages are excluded).
Numeric Code Filter (Shown only if "All Numeric Events" selected) Comma-separated list of specific IRC numeric codes to filter (e.g., 001,002,353). Leave empty to allow all numerics.
Error Code Filter (Shown only if "Error Events" selected) Comma-separated list of specific error codes to filter (e.g., 401,403,404). Leave empty to allow all error codes.
Minimum Severity (Shown only if events include error, server, or connection) Minimum severity level for events to trigger: Info, Warning, Error, Critical. Default is Info.

Output

The node outputs JSON data representing the received IRC event with additional metadata. The output structure includes:

  • All original event fields as received in the webhook payload.
  • webhookUrl: The URL of the webhook that received the event.
  • receivedAt: ISO timestamp when the event was processed.
  • parsed: An object with helpful flags and parsed info:
    • isNumeric: Boolean indicating if the event has a numeric code.
    • numericRange: Numeric code rounded down to nearest hundred (e.g., 400 for codes 400-499).
    • isError: Boolean indicating if the event is an error (based on error code or numeric code >= 400).
    • severity: Severity level of the event (info, warning, error, critical).
    • isChannelEvent: Boolean indicating if the event targets a channel (target starts with "#").
    • isPrivateMessage: Boolean indicating if the event is a private message (event type "privmsg" and target does not start with "#").

No binary data output is produced by this node.

Dependencies

  • Requires the Hanna Bot to send authenticated webhook POST requests to the node's webhook URL.
  • The bot must include a valid authentication token matching the configured "Authentication Token" property.
  • No external API keys or services are required beyond the bot's webhook integration.

Troubleshooting

  • Invalid or missing authentication token: If the webhook request does not contain a valid token matching the configured one, the node responds with HTTP 401 Unauthorized. Ensure the bot sends the correct token either in the Authorization header as Bearer <token>, in the x-auth-token header, or in the payload field authToken.
  • Missing required fields: The webhook payload must include at least eventType and timestamp. Missing these results in HTTP 400 Bad Request.
  • Event filtered out: If the event type is not among the selected IRC events, or it does not pass channel/user/numeric/error/severity filters, the node returns HTTP 200 with a status indicating the reason for ignoring the event.
  • Bot messages filtered: By default, messages sent by the bot itself are ignored unless "Include Bot Messages" is enabled.
  • Filter syntax: Filters for channels, users, numeric codes, and error codes expect comma-separated lists without extra spaces. Incorrect formatting may cause unexpected filtering behavior.

Links and References

Discussion