Reference · Tools

RocketChat

Post messages to channels and direct messages on a Rocket.Chat server.

Action Communication v1

The RocketChat node posts messages to channels and direct messages on a Rocket.Chat server, with attachments. A typical build is routing alerts into the right channel with structured attachment blocks rather than a wall of plain text.

Node type
Action
Parameters
9
Outputs
Output, Error
Credentials
Rocket.Chat API

RocketChat

Post messages to channels and direct messages on a Rocket.Chat server.

Overview

Rocket.Chat is an open-source team communication platform. This tool posts messages to Rocket.Chat channels or direct messages using the REST API. It supports plain text messages, rich attachments with colors/images/fields, custom aliases, avatars, and emoji overrides. Authentication uses User ID and Auth Token headers. Attachments can be provided via structured UI fields or raw JSON.

Category: Communication
Tool Name: rocketchat
Version: 1

Appearance: Icon: si-rocketdotchat | Color: #F5455C

Node Type

Action — processes input items and produces output

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires Rocket.Chat API credentials. See the Credentials Guide for setup instructions.

Resources

ResourceValue
Chatchat

Operations

OperationValueDescription
Chat: Post MessagepostMessagePost a message to a channel or a direct message.

Parameters

Chat: Post Message

ParameterTypeRequiredDefaultDescription
ChannelstringYesThe channel name with the prefix in front of it (e.g., “#general”, “@username”). Use # for channels, @ for direct messages. Supports expressions.
TextstringNoThe text of the message to send. Optional if attachments are provided. Supports expressions.
JSON ParametersbooleanNofalseWhether to provide attachments as a raw JSON array instead of using structured fields.
OptionscollectionNo{}Additional options for the message.
— AliasstringNoThis will cause the message’s name to appear as the given alias, but your username will still display.
— AvatarstringNoIf provided, this will make the avatar use the provided image URL.
— EmojistringNoIf provided, this will set the avatar to the specified emoji (e.g., “:smile:”).
AttachmentscollectionNo{}Rich attachment objects to include with the message. Add one entry per attachment block. (shown when JSON Parameters is false)
— ColorstringNo#ff0000The color for the left-side border. Any CSS background-color value.
— TextstringNoThe text to display for this attachment, different from the message text.
— TimestampstringNoDisplays the time next to the text portion. Use ISO 8601 format.
— Thumb URLstringNoAn image that displays to the left of the text. Best when relatively small.
— Message LinkstringNoOnly applicable if timestamp is provided. Makes the time clickable to this link.
— CollapsedbooleanNofalseWhether the image, audio, and video sections should be hidden when collapsed.
— Author NamestringNoName of the author.
— Author LinkstringNoProviding this makes the author name clickable and points to this link.
— Author IconstringNoDisplays a tiny icon to the left of the author name.
— TitlestringNoTitle to display for this attachment, displayed under the author.
— Title LinkstringNoProviding this makes the title clickable, pointing to this link.
— Title Link DownloadbooleanNofalseWhether clicking the title saves the link to file.
— Image URLstringNoThe image to display. Will be “big” and easy to see.
— Audio URLstringNoAudio file to play. Only supports what HTML audio does.
— Video URLstringNoVideo file to play. Only supports what HTML video does.
— FieldsfixedCollectionNo{}Labelled rows displayed inside the attachment. Add one entry per row.
— — ShortbooleanNofalseWhether this field should be a short field (displayed inline).
— — TitlestringNoThe title of this field.
— — ValuestringNoThe value of this field, displayed underneath the title.
Attachments (JSON)jsonNoA JSON array of attachment objects. See Rocket.Chat API documentation for the attachment schema. (shown when JSON Parameters is true)

All Operations

ParameterTypeRequiredDefaultDescription
Max ConcurrencynumberNo10Maximum number of items to process concurrently.

Output Data

One output item is produced per input item, on the Output port. Rocket.Chat’s response to the post — its record of the message that was created — is merged onto the item JSON at the top level rather than nested under a wrapper property, so the rest of the incoming item passes through unchanged and response fields are addressed directly by expression. Binary data on the input item is forwarded untouched. The node never fans out: one input item is one posted message and one output item.

When the server replies with an empty body, nothing is merged and the item passes straight through. A non-2xx reply raises an item error carrying the HTTP status; failures go to the Error port in errorPort mode, carrying _error.

Usage Examples

  • Send a message to a Rocket.Chat channel
  • Post a notification to #general in Rocket.Chat
  • Send a direct message to a Rocket.Chat user
  • Post a message with rich attachments to Rocket.Chat
  • Send a Rocket.Chat message with a custom alias and avatar

Example Configuration

Post plain text to a channel:

{
  "type": "rocketchat",
  "parameters": {
    "resource": "chat",
    "operation": "postMessage",
    "channel": "#notifications",
    "text": "{{ $json.message }}"
  }
}

Send the same message as a direct message by using the @ prefix:

{
  "type": "rocketchat",
  "parameters": {
    "resource": "chat",
    "operation": "postMessage",
    "channel": "@john.doe",
    "text": "Hi John, your export finished."
  }
}

Post under a custom display name and emoji avatar:

{
  "type": "rocketchat",
  "parameters": {
    "resource": "chat",
    "operation": "postMessage",
    "channel": "#alerts",
    "text": "ALERT: {{ $json.alertMessage }}",
    "options": {
      "alias": "Alert Bot",
      "emoji": ":warning:"
    }
  }
}

Attach a coloured status card with two inline fields — Attachments is a repeating field, so its value is a list:

{
  "type": "rocketchat",
  "parameters": {
    "resource": "chat",
    "operation": "postMessage",
    "channel": "#status",
    "text": "System Status Report",
    "jsonParameters": false,
    "attachments": [
      {
        "color": "#36a64f",
        "title": "All Systems Operational",
        "titleLink": "https://status.example.com",
        "authorName": "Status Monitor",
        "collapsed": false,
        "fields": {
          "fieldsValues": [
            { "title": "Uptime", "value": "{{ $json.uptime }}", "short": true },
            { "title": "Response Time", "value": "{{ $json.responseTime }}ms", "short": true }
          ]
        }
      }
    ]
  }
}

Supply the attachments as raw JSON instead — the value is the text of a JSON array:

{
  "type": "rocketchat",
  "parameters": {
    "resource": "chat",
    "operation": "postMessage",
    "channel": "#general",
    "text": "Status update with multiple attachments:",
    "jsonParameters": true,
    "attachmentsJson": "[{\"color\":\"#36a64f\",\"title\":\"Server Status\",\"text\":\"All systems operational\"},{\"color\":\"#ff9900\",\"title\":\"Maintenance Window\",\"text\":\"Scheduled maintenance tonight at 2 AM\"}]"
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

Post messages to channels and direct messages on a Rocket.Chat server via the REST API.

Notes

  • Give the message something to show: Text may be left empty only when you supply at least one attachment.
  • JSON Parameters chooses which attachment input the node reads. With it off, Attachments is used and Attachments (JSON) is ignored; with it on, the reverse.
  • Attachments is a repeating field — its value is a list of attachment objects, and each entry becomes one attachment block in Rocket.Chat. A single object supplied where a list is expected is ignored.
  • Attachments (JSON) is parsed as text. If it is not valid JSON, the message is still posted, just without attachments.
  • Channel, Text, Options and the attachment fields all accept {{ … }} expressions, so a card’s colour, title and field values can come from the item.

Frequently asked questions

Can I post a message with no text?

Only if you supply at least one attachment. Text may be left empty in that case, but a message with neither text nor attachment has nothing to show.

What does the JSON Parameters toggle change?

Which attachment input is read. With it off, Attachments is used and Attachments (JSON) is ignored; with it on, the reverse.

How are attachments structured?

Attachments is a repeating field whose value is a list of attachment objects, so several can be attached to one message.

Which credential does it need?

A Rocket.Chat API credential for the server you are posting to.

Build with the RocketChat node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Rocket.Chat API credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.