In a Dev discussion about automating user account creation via REST API for a Discourse forum, dm.linov seeks to create users from a feedback form, post a topic as them, and email them a link to the topic with a password setup request. They identified four email templates but found only the ‘Forgot Password’ API call documented. david explains that ‘Account created’ is sent via admin invite API or rake task, ‘Login via link’ is for email login, and ‘Set Password’ is used when no password exists (same as ‘Forgot Password’). He recommends creating users as ‘staged’ and sending an invite to the topic, which logs them in directly without forcing password creation — they can set one manually or use email login. dm.linov asks for the API call to create staged users, noting they thought it was only possible via email. The discussion centers on aligning automated user onboarding with Discourse’s native email workflows and user states.
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:
Create a new user via API, based on the name and e-mail, submitted via the form.
Create a new topic, authored by this user.
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?
‘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.