This is doable but it takes quite a lot of digging since the documentation is uhmm bad and poorly written. Here’s what I did (Note that it’s close but It doesn’t work for me completely at this point)
First you setup an account in your rocketchat server that has admin privileges. You will use this account using REST calls to automatically create user accounts.
I would advise that this is done in a server you write, something in PHP, Pythin or JEE, because you don’t want to have these credentials floating around in your webpage.
Use the same code to log the user into your rocketchat instance with the newly created account:
You will get a JSON object back that has a token. You can then use that token to call postMessage on the iframe where you have rocketchat embedded, as per:
I’m stuck on this one myself. This should all work according the documentation but I’m seeing an error in the iframe running rocketchat.