Post Message

rocketchat.post_message
ActionChat & messagingconnection required

Calls the Rocket.Chat API with the connection's credentials.

Post a message to a channel or a person. This is the one op that takes a name — '#releases' for a channel or '@jane' for a direct message — as well as a room id, and it carries rich attachments, an alias and an emoji avatar.

Connection

Required
Yes — the node will not save without one
Auth type
API key
Providers
Rocket.Chat
Secret shape
the personal access token, or {"token": "…", "user_id": "…"}
Config it needs
base_url, user_id
Resolved by
config.connection_id, else node.connection_id

Configuration

10 fields, none required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.

FieldTypeRequiredDefaultConstraintsExample
channel
Where to post: '#channel-name' for a channel, '@username' for a direct message. Leave blank when you have a room_id.
stringNo———
room_id
The room id to post to, instead of a channel name.
stringNo———
text
The markdown message to post.
stringNo———
attachments
Rich message attachments (JSON array of Rocket.Chat attachment objects, each with title, text, color, image_url, fields and so on). For a real file use rocketchat.upload_file instead.
arrayNo—array of object—
tmid
Post as a reply inside this thread; leave blank to start a new message.
stringNo———
alias
Display this name instead of the token's user; needs the message-impersonate permission.
stringNo———
emoji
Use this emoji as the sender's avatar, e.g. ':robot:'.
stringNo———
avatar
Use the image at this URL as the sender's avatar.
stringNo—url format—
parse_urls
Whether Rocket.Chat should expand link previews. Leave unset for the workspace default.
booleanNo———
custom_fields
Custom message fields (JSON) the workspace has been configured to accept.
objectNo———
  • At least one of channel, room_id must be set.
  • At least one of text, attachments must be set.

Output

One shape.

result

FieldTypeExample
ts
When Rocket.Chat accepted the post, epoch milliseconds.
number—
channel
The channel name the message went to.
string—
message._id
The message id.
string7aDSXtjMA3KPLxLjt
message.rid
The id of the room the message is in.
string—
message.msg
The message text, as Rocket.Chat stored it.
string—
message.ts
When the message was posted, as an ISO-8601 timestamp.
string—
message.u._id
The id of the user the message was posted as.
string—
message.u.username
The username the message was posted as.
string—
message._updatedAt
When the message last changed, ISO-8601.
string—
success
True — Rocket.Chat's own envelope flag.
boolean—
{
  "channel": "",
  "message": {
    "_id": "7aDSXtjMA3KPLxLjt",
    "_updatedAt": "",
    "msg": "",
    "rid": "",
    "ts": "",
    "u": {
      "_id": "",
      "username": ""
    }
  },
  "success": false,
  "ts": 0
}

Notes

  • Address the message with a channel name or a room id, not both.
  • A message needs text, at least one attachment, or both.

See Post Message run in a workflow.

In a technical demo we add the Rocket.Chat connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.