Trigger "set random password and send via email" via API


I have a set of known users (emails, names) that I would like to programmatically add to rocketchat and then give them the opportunity to set their passwords. The registration page is therefore turned off. Also I do not need two-factor-authentication.

What I achieved so far using the API is

  • importing the users
    this requires an initial password and I disabled “welcome email” as I have to send another email anyway
  • sending an email using users.forgotPassword.

However, as the users never used rocketchatpreviously I would rather send the equivalent of “set random password and send via email” in the admin interface. I was not able to identify the correct api endpoint for this. Is it available?

Everything would be much simpler, if the createUser endpoint would allow to chose which mail to send (welcome email, random password, …). Currently it is only possible to send a welcome email or to not do so.

I actually expect this to be quite a common use case. So maybe there is better way altogether to achieve what I want?

Server Setup Information

  • Version of Rocket.Chat Server: 5.4.2
  • Operating System: Debian (bookworm/sid)
  • Deployment Method: docker-compose
  • Number of Running Instances: 1
  • DB Replicaset Oplog: default from docker-compose.yml
  • NodeJS Version: 4.19.3 (as per the rocketchat image)
  • MongoDB Version: 5.0.0
  • Proxy: nginx
  • Firewalls involved:

Any additional Information

see above: no two-factor-auth, no registration page

great, thank you very much for this information