rocket-chat

Community node for Rocket.Chat (send, files, webhook/polling/realtime receive)

Documentation

n8n-nodes-rocket-chat

npm version
License: MIT
n8n community node

A comprehensive n8n community node for Rocket.Chat integration, enabling powerful chat automation workflows.

šŸš€ Features

Core Capabilities

  • Send Messages: Post messages to channels, groups, and direct messages
  • File Upload: Upload files to rooms with optional message attachments
  • Message Management: Update and delete existing messages
  • Direct Messaging: Open DM channels and send private messages
  • Real-time Triggers: Receive messages via webhook, polling, or WebSocket

Three Powerful Nodes

šŸ”„ Rocket.Chat Message

Complete message management with advanced targeting options:

  • Operations: Post, Send (advanced), Update, Delete messages
  • Direct Messages: Open DM channels and send private messages
  • Flexible Targeting: Text input (#channel/@user/roomId) or dropdown selectors
  • Rich Features: Thread replies, custom avatars, emoji support, attachments

šŸ“ Rocket.Chat File

Seamless file upload capabilities:

  • Upload files to any room (channels, groups, DMs)
  • Optional message text with file uploads
  • Flexible room targeting options
  • Support for various file types

⚔ Rocket.Chat Trigger

Multiple ways to receive messages:

  • Webhook: Real-time HTTP webhook integration
  • Polling: Regular API polling for new messages
  • WebSocket: Real-time stream for instant message reception
  • Configurable room filtering and message processing

šŸ“¦ Installation

Option 1: n8n Community Nodes (Recommended)

  1. Go to Settings → Community Nodes in your n8n instance
  2. Install: n8n-nodes-rocket-chat
  3. Restart n8n

Option 2: Manual Installation

# Install in your n8n installation directory
npm install n8n-nodes-rocket-chat

# For self-hosted n8n
cd ~/.n8n/nodes
npm install n8n-nodes-rocket-chat

Option 3: Docker

Add to your n8n Docker environment:

docker run -it --rm \
  -p 5678:5678 \
  -e N8N_NODES_INCLUDE="n8n-nodes-rocket-chat" \
  n8nio/n8n

šŸ”§ Configuration

Credentials Setup

  1. In Rocket.Chat, go to Administration → Personal Access Tokens
  2. Create a new Personal Access Token
  3. In n8n, create new Rocket.Chat PAT credentials:
    • Base URL: Your Rocket.Chat server URL (e.g., https://open.rocket.chat)
    • User ID: Your Rocket.Chat user ID
    • Auth Token: The personal access token from step 2
    • Default Target (optional): Default channel/user for messages

API Permissions

Ensure your Rocket.Chat user has appropriate permissions:

  • chat.postMessage - Send messages
  • chat.update - Update messages
  • chat.delete - Delete messages
  • upload-file - Upload files
  • im.open - Open direct messages

šŸŽÆ Usage Examples

Basic Message Sending

// Send a message to #general channel
{
  "operation": "post",
  "target": "#general", 
  "text": "Hello from n8n! šŸš€"
}

File Upload with Message

// Upload file to a room
{
  "targetMode": "text",
  "target": "#announcements",
  "message": "Weekly report attached",
  "file": "{{ $binary.file }}"
}

Real-time Message Trigger

// WebSocket trigger configuration
{
  "mode": "realtime",
  "rooms": ["GENERAL", "random"],
  "includeAll": false
}

Direct Message Workflow

// Open DM and send message
{
  "operation": "sendDm",
  "dmUsername": "john.doe",
  "text": "Your task has been completed āœ…"
}

šŸ›  Development

Prerequisites

  • Node.js 18+
  • TypeScript 5+
  • n8n development environment

Build from Source

# Clone repository
git clone https://github.com/your-repo/n8n-nodes-rocket-chat.git
cd n8n-nodes-rocket-chat

# Install dependencies
npm install

# Build
npm run build

# Development mode
npm run dev

Project Structure

ā”œā”€ā”€ credentials/           # Authentication credentials
│   └── RocketChatPat.credentials.ts
ā”œā”€ā”€ nodes/                # Node implementations
│   ā”œā”€ā”€ RocketChatMessage.node.ts
│   ā”œā”€ā”€ RocketChatFile.node.ts
│   └── RocketChatTrigger.node.ts
ā”œā”€ā”€ transport/            # API utilities
│   └── GenericFunctions.ts
└── dist/                 # Compiled output

šŸ”Œ API Reference

Rocket.Chat REST API Endpoints Used

  • POST /api/v1/chat.postMessage - Send messages
  • POST /api/v1/chat.sendMessage - Send messages (advanced)
  • POST /api/v1/chat.update - Update messages
  • POST /api/v1/chat.delete - Delete messages
  • POST /api/v1/rooms.upload - Upload files
  • POST /api/v1/im.open - Open direct messages
  • GET /api/v1/channels.list.joined - List channels
  • GET /api/v1/groups.list - List private groups
  • GET /api/v1/im.list - List direct messages

WebSocket Realtime API

  • stream-room-messages - Real-time message streaming

šŸ¤ Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and test thoroughly
  4. Commit: git commit -m 'feat: add amazing feature'
  5. Push: git push origin feature/amazing-feature
  6. Open a Pull Request

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ†˜ Support & Issues

šŸ™ Acknowledgments

  • Built with ā¤ļø for the n8n community
  • Powered by Rocket.Chat API
  • Compatible with n8n workflow automation platform

Made possible by: n8n | Rocket.Chat

Discussion