Iframe integration: Sending commands
- Print
- DarkLight
- PDF
Iframe integration: Sending commands
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
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
Command | Params | Description |
---|---|---|
go | - | Change url |
login-with-token | - | Allow login with token |
call-custom-oauth-login | - | Allow login via oauth methods |
set-user-status | - | Set the status of the user |
logout | Log the user out of their current session |
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'
}, '*')
Was this article helpful?