How to ask a user to create a password for the account made for him?

We have a feedback form on our website, which is mostly used for support questions. I want questions posted there to become new topics on our forum, powered by Discourse.

I am trying to implement the following sequence of actions:

  1. Create a new user via API, based on the name and e-mail, submitted via the form.
  2. Create a new topic, authored by this user.
  3. Send this user an e-mail with the link to this topic, and also a request to create a password.

Now, I have found four e-mail templates on Discourse, that could be used in step 3 - “Account created”, “Login via link”, “Forgot Password” and “Set Password”. In the API documentation, I only found a call that sends the “Forgot Password” message, but this doesn’t seem to be the best candidate for my case.

My questions:
a) Under what circumstances other three messages (“Account created”, “Login via link”, and “Set Password”) are sent?
b) How can I send them via API?

1 Like

Could anyone respond to this topic, please?

1 Like

‘account_created’ is used when using the ‘invite admin’ API endpoint, and when creating an administrator via the admin:invite rake task

‘login via link’ (internally referred to as email_login) is sent when someone uses the ‘login via email’ link

‘set password’ is the same as ‘forgot password’, when the user does not already have a password in the database

I think the best approach is to create the new users as “staged”, and then send them an ‘invite’ to the topic. That invite will log them straight into their staged account, and then take them to the topic. They won’t be asked to create a password, but they can do that manually, or just use the sign in via email option.

4 Likes

Thank you, David!

What is the API call to create “staged” users? I thought they could only be created via email.

1 Like