Iframe integration: Sending commands

When integrating an iframe into Rocket.Chat, you can also send commands to the embedded content using the postMessage Rocket.Chat API. It allows you to interact with the content in real time and perform various actions.

Available commands

Here is an example of how to send a command through a Rocket.Chat iframe:

document.querySelector('iframe').contentWindow.postMessage({
  externalCommand: 'go',
  path: '/admin/General'
}, '*')

Another useful example is setting user status in an iframe embedded in Rocket.Chat :

document.querySelector('iframe').contentWindow.postMessage({
  externalCommand: 'userSetStatus',
  status: 'away'
}, '*')

Last updated

Rocket.Chat versions receive support for six months after release.