RocketChat Trigger icon

RocketChat Trigger

Handle RocketChat events via webhooks

RocketChat Trigger

AI-generated

Overview

The RocketChat Trigger node listens for specific events in a Rocket.Chat workspace and triggers n8n workflows when those events occur. It uses outgoing webhooks from Rocket.Chat to receive event notifications such as messages sent, files uploaded, rooms created or archived, users created, and more. This node is useful for automating processes based on activity within Rocket.Chat, such as archiving messages, notifying external systems, or synchronizing data.

Example scenarios:

  • Automatically create a task in another system when a file is uploaded to a channel.
  • Notify a team via email when a new user joins a room.
  • Archive information externally when a room is archived in Rocket.Chat.

Properties

Name Type Meaning
Events Name options The type of Rocket.Chat event to listen for (e.g., Send Message, File Uploaded, Room Created, etc.).
Channels Names or ID multiOptions The channels to monitor for the selected event. You can select from a list or specify IDs using an expression. Supports special values like * (all), all_public_channels, all_private_groups, and all_direct_messages.

Output

The node outputs the full JSON body received from the Rocket.Chat webhook. The structure of this output depends on the event type configured in Rocket.Chat, but typically includes details about the event, such as message content, user information, channel details, timestamps, etc.

Example output:

{
  "event": "sendMessage",
  "payload": {
    "message": {
      "_id": "msgId123",
      "rid": "roomId456",
      "msg": "Hello world!",
      "u": {
        "_id": "userId789",
        "username": "john.doe"
      },
      "ts": "2024-06-01T12:34:56.789Z"
    }
  }
}

Note: The actual fields depend on the event and Rocket.Chat's webhook payload format.

Dependencies

  • External Service: Requires access to a Rocket.Chat server with API credentials.
  • API Key: Needs a credential named rocketChatApi configured in n8n.
  • Webhook Configuration: The node automatically creates and manages outgoing webhooks in Rocket.Chat for the specified events and channels.

Troubleshooting

  • Common Issues:

    • Missing or invalid credentials: Ensure that the rocketChatApi credential is correctly set up in n8n.
    • Webhook not triggering: Make sure the selected event and channels are correct, and that the Rocket.Chat server can reach your n8n instance (check network/firewall settings).
    • Error: "Cannot read property 'webhookId' of undefined": This may occur if the webhook was not created successfully. Try re-saving or re-enabling the node.
    • No data received: Check that the event actually occurs in Rocket.Chat and that the webhook integration is enabled.
  • Error Messages:

    • "Request failed with status code 401/403": Indicates authentication issues; verify your API credentials.
    • "integrationId not found": The webhook integration may have been deleted manually; try reactivating the node.

Links and References

Discussion