I don’t think they can. They would have to register and update their preferences on that topic or their overall notification preferences.
Are there some docs about this endpoint? I have searched API docs but it is not there.
I am looking for a way how to create topic and assign it to a specific user (by discourse-assign plugin).
And also thinking if API key have to by for user system or I can use some other user with minimal permissions (what are that minimal required?).
Just this post: Creating a staged user with an API call - #8 by blake
This is totally doable. Have a look at Reverse engineer the Discourse API and you will see which endpoint the discourse-assign plugin calls.
Nope does not need to be with the system user. You just need a user with enough trust level to create and assign topics.
Thank you for reply. I understand how to assign specific post, but how to reliably find post just created by the /admin/email/handle_mail endpoint? It also seems to queue received calls, so I will not always find it immediately after the first call.
Correct, that endpoint does not return a topic_id.
Do they HAVE to be staged users? Couldn’t you just create the user via the api and then create a topic? Or are people that don’t have accounts yet going to be emailing that endpoint?
It is for public contact form on different products where each have different merchant. I want to assign topic to the specific merchant and also deny access to topics what does not belong to that merchant.
从非开发人员的角度来看,我有一个问题。
我正在使用 Discourse 作为我们公司的票务系统,并且已成功将其设置为允许未注册用户在我们的支持论坛中创建新主题。
有时,我需要代表客户创建票证,而不是让他们直接创建。
是否有简单的分步方法可以做到这一点,并代表一个在论坛上尚无帐户的用户创建主题?除非他们自己注册,否则我不想让他们拥有完整帐户。
我建议通过电子邮件创建主题:
这样在创建主题时就会创建一个暂存用户。
您可以通过 API 创建暂存用户
curl -i -sS -X POST "http://localhost:4200/users" \
-H "Content-Type: multipart/form-data" \
-H "Api-Key: 3e8aa0b7970cf010da24d06215fdc7b3951352c61a59ada70f5f36b4ce890bb2" \
-H "Api-Username: system" \
-F "name=2e6ac3603" \
-F "active=false" \
-F "staged=true" \
-F "username=2e6ac3603" \
-F "email=2e6ac3603@example.com" \
-F "password=f9b4c3c7ebd1c2877a0ad659be6ca83e"
然后为用户创建主题,但在用户创建操作时,Discourse 会发送一封激活邮件:
{“success”: true,“active”: false,“message”: “您几乎完成了!我们已向 2e6ac3603@example.com 发送了激活邮件。请按照邮件中的说明激活您的帐户。如果未收到,请检查您的垃圾邮件文件夹。”}
那么,这些行是否都以 CR 结尾?反斜杠前面是双空格还是制表符?
抱歉,正如我所说,我不是开发人员,所以仅展示此代码不足以让我完成,还需要一些额外信息。
所以使用此方法只是创建了用户,即使 staged=true,它也会发送电子邮件邀请吗?
最简单的答案永远是最好的:
所以我们会偶尔使用它。
感谢您的帮助。