Post Message

Prev Next
Post
/api/v1/chat.postMessage

Send messages to channels or users on your workspace.

Note: You can only send the alias and avatar properties if your user has the message-impersonate (Impersonate other users) permission. By default, only the bot and app roles have this permission.

The server removes markdown trees (md and descriptionMd) from attachments before it saves the message. It does not generate a new md for the attachment.

The request body accepts only the top-level properties listed here. Any other property, such as blocks or a message field that only the server sets (for example pinned, u, or ts), fails. To send blocks, use chat.sendMessage.

Change Log

Version Description
9.0.0 Stripped md and descriptionMd from attachments before saving the message.
6.8.0 Added custom fields to messages.
6.2.0 Rejected request body properties that are not listed.
2.4.0 Added validation on user's identity
0.49.0 The channel can now be a room's id.
0.48.0 Information about the sent message is now returned.
0.17.0 Messages aren't always processed as from BOT and urls are parsed by default.
0.14.0 Internally using processWebhookMessage which enabled more features.
0.13.0 Added
Header parameters
X-Auth-Token
stringRequired

The authToken of the authenticated user.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-Id
stringRequired

The userId of the authenticated user.

ExamplerbAXPnMktTFbNpwtJ
Body parameters
Example
{
  "channel": "#general",
  "emoji": ":smirk:",
  "text": "Sample message",
  "attachments": [
    {
      "audio_url": "http://www.w3schools.com/tags/horse.mp3",
      "author_icon": "https://avatars.githubusercontent.com/u/850391?v=3",
      "author_link": "https://rocket.chat/",
      "author_name": "Bradley Hilton",
      "collapsed": false,
      "color": "#ff0000",
      "fields": [
        {
          "short": true,
          "title": "Test",
          "value": "Testing out something or other"
        },
        {
          "short": true,
          "title": "Another Test",
          "value": "[Link](https://google.com/) something and this and that."
        }
      ],
      "image_url": "http://res.guggy.com/logo_128.png",
      "message_link": "https://google.com",
      "text": "Yay for gruggy!",
      "thumb_url": "http://res.guggy.com/logo_128.png",
      "title": "Attachment Example",
      "title_link": "https://youtube.com",
      "title_link_download": true,
      "ts": "2016-12-09T16:53:06.761Z",
      "video_url": "http://www.w3schools.com/tags/movie.mp4"
    }
  ]
}
Expand All
OneOf
object
object
alias
string

The name to display on the message instead of your name. Your username is still displayed.

avatar
string

The URL of an image to display as the message avatar.

emoji
string

An emoji to display as the message avatar.

Example:smile:
roomId

The room ID or an array of room IDs where the message is to be sent. You can also use a room name, with or without the # prefix, or a username with the @ prefix. Cannot be combined with channel. With an array, the message is posted to each room, and the response describes only the first one.

Example#general
OneOf
string
string
array
array
string
text
string

The message text to send.

parseUrls
boolean

Set to false to stop the server from extracting URLs from text. The message is saved with no urls and no link preview. When the message has attachments, the default is false, and no link preview is generated even with true.

attachments
Array of object
object
audio_url
string

Audio file to attach. See the HTML audio element for information.

author_icon
string

Displays a tiny icon to the left of the author's name.

author_link
string

Providing this makes the author's name clickable and points to the provided link.

author_name
string

Name of the author.

collapsed
boolean

Causes the image, audio, and video sections to be displayed as collapsed when set to true.

color
string

See background-css for the supported colors.

fields
Array of object
object
short
boolean

Whether this field should be a short field.

title
string Required

The title of this field.

value
string Required

The value of this field, displayed underneath the title value.

image_url
string

The URL of the image to display in the attachment.

message_link
string

Only applicable if the ts field is provided, as it makes the time clickable to this link.

text
string

The text to display in the attachment.

thumb_url
string

The URL of a thumbnail image to display to the left of the attachment text.

title
string

Title to display for this attachment, displays under the author.

title_link
string

Providing this makes the title clickable, pointing to this link.

title_link_download
boolean

When this is true, a download icon appears and clicking this saves the link to file.

ts
string

Displays the time next to the text portion.

video_url
string

Video file to attach. See the HTML video element for information.

tmid
string

The message ID of the original message to reply to or to create a thread on. Only available with roomId.

customFields
object

Custom fields for the message, such as a priority. Custom fields must be enabled, and the value must match the validation defined in the Message settings.

Example{ "priority": "high" }
object
object
alias
string

The name to display on the message instead of your name. Your username is still displayed.

avatar
string

The URL of an image to display as the message avatar.

channel

The room ID or an array of room IDs where the message is to be sent. You can also use a room name, with or without the # prefix, or a username with the @ prefix. Cannot be combined with roomId. With an array, the message is posted to each room, and the response describes only the first one.

Example#test-room
OneOf
string
string
array
array
string
emoji
string

An emoji to display as the message avatar.

Example:smile:
text
string

The message text to send.

parseUrls
boolean

Set to false to stop the server from extracting URLs from text. The message is saved with no urls and no link preview. When the message has attachments, the default is false, and no link preview is generated even with true.

attachments
Array of object
object
audio_url
string

Audio file to attach. See the HTML audio element for information.

author_icon
string

Displays a tiny icon to the left of the author's name.

author_link
string

Providing this makes the author's name clickable and points to the provided link.

author_name
string

Name of the author.

collapsed
boolean

Causes the image, audio, and video sections to be displayed as collapsed when set to true.

color
string

See background-css for the supported colors.

fields
Array of object
object
short
boolean

Whether this field should be a short field.

title
string Required

The title of this field.

value
string Required

The value of this field, displayed underneath the title value.

image_url
string

The URL of the image to display in the attachment.

message_link
string

Only applicable if the ts field is provided, as it makes the time clickable to this link.

text
string

The text to display in the attachment.

thumb_url
string

The URL of a thumbnail image to display to the left of the attachment text.

title
string

Title to display for this attachment, displays under the author.

title_link
string

Providing this makes the title clickable, pointing to this link.

title_link_download
boolean

When this is true, a download icon appears and clicking this saves the link to file.

ts
string

Displays the time next to the text portion.

video_url
string

Video file to attach. See the HTML video element for information.

customFields
object

Custom fields for the message, such as a priority. Custom fields must be enabled, and the value must match the validation defined in the Message settings.

Example{ "priority": "high" }
Responses
200

OK

Example
{
  "ts": 1793706003432,
  "channel": "#general",
  "message": {
    "alias": "",
    "msg": "This is a test!",
    "attachments": [],
    "parseUrls": true,
    "groupable": false,
    "ts": "2026-11-03T11:40:03.388Z",
    "u": {
      "_id": "y65tAmHs93aDChMWu",
      "username": "graywolf336",
      "name": "Gray Wolf"
    },
    "rid": "GENERAL",
    "_id": "jC9chsFddTvsbFQG7",
    "_updatedAt": "2026-11-03T11:40:03.392Z",
    "md": [
      {
        "type": "PARAGRAPH",
        "value": [
          {
            "type": "PLAIN_TEXT",
            "value": "This is a test!"
          }
        ]
      }
    ],
    "mentions": [],
    "channels": [],
    "urls": []
  },
  "success": true
}
Expand All
object
ts
integer
channel
string
message
object
alias
string
msg
string
attachments
Array of object
object
parseUrls
boolean
groupable
boolean
emoji
string
ts
string
u
object
_id
string
username
string
name
string
rid
string
_id
string
_updatedAt
string
md
Array of object
object
mentions
Array of object
object
channels
Array of object
object
urls
Array of object
object
success
boolean
400

Bad Request

Invalid Room
{
  "success": false,
  "error": "[invalid-channel]",
  "errorType": "invalid-channel"
}
Missing Room ID and Channel
{
  "success": false,
  "error": "must have required property 'roomId'\n must have required property 'channel'\n must match exactly one schema in oneOf",
  "errorType": "error-invalid-params"
}
Unsupported Properties
{
  "success": false,
  "error": "must NOT have additional properties\n must have required property 'channel'\n must match exactly one schema in oneOf",
  "errorType": "error-invalid-params"
}
Room ID and Channel Combined
{
  "success": false,
  "error": "must NOT have additional properties\n must NOT have additional properties\n must match exactly one schema in oneOf",
  "errorType": "error-invalid-params"
}
Missing Permission for Alias or Avatar
{
  "success": false,
  "error": "Not enough permission"
}
Invalid Attachment Field
{
  "success": false,
  "error": "Invalid attachment field, title and value is required"
}
Custom Fields Not Enabled
{
  "success": false,
  "error": "Custom fields not enabled"
}
Invalid Custom Fields
{
  "success": false,
  "error": "Invalid custom fields"
}
object
success
boolean
error
string
errorType
string
401

Unauthorized

Authorization Error
{
  "success": false,
  "error": "You must be logged in to do this."
}
object
success
boolean
error
string