Hi,
I’ve been sending invites using the api (Discourse API Docs ). When I send it on postman, I am getting the invite email. But when I implement it on laravel I’m not getting the email.
Here is the response when the api from laravel. I noticed that the emailed field is false.
Postman response the emailed field is true.
Any advice? Thanks.
IAmGav
(Gavin Perch)
2021 年10 月 11 日 10:35
2
someone else also reported this,
check this topic
Hi,
Ive been trying to send invites to users to by discussion board via the invites API and i keep running into a 500 internal error.
Any advice.
{
"email": "anitsirc+3@gtechme.com",
"skip_email": false,
"custom_message": "string",
"max_redemptions_allowed": 5,
"group_id": 0,
"group_names": "string",
"expires_at": "controlled by invite_expiry_days site setting"
}
[image (4)]
yes this was a different error which was already resolved. the issue now is we’re not getting emails but using the api is successful.
i’m not sure if we need to enable anything? coz when i call the api on postman i get the email but on the laravel app we’ve created we’re not getting the emails.
pko
2024 年11 月 28 日 08:08
4
嘿 @yburhaniel ,
这是一个老话题了,但我遇到了类似的问题。API 请求 invite.json 会生成邀请链接,但不会发送电子邮件。而如果 API 密钥绑定的同一用户从 UI 邀请用户,则电子邮件会正常发送。
你当时是怎么解决这个问题的?
thoka
(Thomas Kalka)
2024 年11 月 28 日 19:30
5
你设置了 send_email 吗?
我正在使用如下的 Python 代码:
invitation = {
"email": u.mail,
"group_ids": valid_group_ids(u.groups),
"send_email": True,
}
site.invites.post(data=invitation)
可以给我们看看你正在使用的代码吗?
pko
2024 年11 月 28 日 19:50
6
您好 @thoka ,
感谢您的回复。真的这么简单吗?那将是个好消息!
对于这个问题,我正在使用 Zapier,但使用的是我按照这份API 文档 创建的一个对象。也许这不是正确的文档,或者我遗漏了其他东西。
我尝试了许多不同的参数,但最新的参数是:
{
"email": "email@email.com",
"skip_email": false,
"custom_message": "Welcome to the forum",
}
我也尝试了以下参数。但不幸的是,这并没有导致邀请被发送:
{
"email": "email@email.com",
"skip_email": false,
"send_email": true,
"custom_message": "Welcome to the forum",
}
但也许我在这里设置的属性仍然是错误的。
thoka
(Thomas Kalka)
2024 年11 月 28 日 19:55
7
pko
2024 年11 月 28 日 19:59
8
很好,谢谢你提醒我。我想这是因为在 Discourse 上有更长的使用经验吧。 无论如何,你这么说了之后,完全说得通了。
我来试试看,之后再告诉你结果!
pko
2024 年11 月 28 日 20:14
9
@thoka
不幸的是,问题仍然存在,状态码为 OK 200,但只生成了邀请链接。
UI 中的 API 仅额外设置了显式的 expires_at 和 max_redemptions_allowed 属性。
顺便说一句,我通过集成使用的是 system 用户,这会是个问题吗?话虽如此,我认为我也使用了一个实际的“人类”用户进行了测试。
thoka
(Thomas Kalka)
2024 年11 月 28 日 21:22
10
如果您通过用户界面创建邀请,一切是否都按预期工作?
pko
2024 年11 月 28 日 21:26
11
@thoka
是的,这就是神秘之处,通过 UI,一切都能正常工作,没有问题。
不过,我注意到的是,即使我从 system 用户的个人资料/邀请部分发送邀请,邀请邮件中仍然显示是我(我的用户)发送的邀请。
thoka
(Thomas Kalka)
2024 年11 月 28 日 21:33
12
我建议为您的用户名尝试使用管理员 API 密钥。
通过 API,您应该能够获得与通过 UI 相同的行为。