招待を作成するAPIがメールを送信していません

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.
image

Postman response the emailed field is true.

Any advice? Thanks.

someone else also reported this,

check this topic

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.

@yburhanielさん、こんにちは。

古いトピックですが、同様の問題が発生しています。invite.json への API リクエストは招待リンクを生成しますが、メールは送信されません。一方、API キーがバインドされているのと同じユーザーが UI からユーザーを招待すると、メールは正常に送信されます。

当時、どのように解決しましたか?

send_email を設定しましたか?

以下のようなPythonコードを使用しています。

invitation = {
          "email": u.mail,
          "group_ids": valid_group_ids(u.groups),
          "send_email": True,
}

site.invites.post(data=invitation)

使用しているコードを見せていただけますか?

@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",
}

しかし、おそらく私が設定したプロパティがまだ間違っているのかもしれません。

UIと同じパラメータを使用するために、私は常にhttps://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576を使用しています。

素晴らしい、教えてくれてありがとう。それは、より長いDiscourseの経験からくる本能だと思います。:slight_smile: とにかく、あなたがそう言った今、完全に理にかなっています。

試してみて、どうだったかここに戻って報告します!

@thoka

残念ながら、問題はまだ解決していません。ステータスはOK 200ですが、招待リンクのみが生成されています。

UIからのAPIには、明示的な expires_at および max_redemptions_allowed プロパティが追加されただけです。

ところで、インテグレーション経由で system ユーザーを使用していますが、それが問題になる可能性はありますか?とはいえ、「人間」のユーザーも使用してテストしたと思います。

UI経由で招待を作成すると、すべて期待どおりに機能しますか?

@thoka

ええ、それが謎なんです。UIからは問題なくすべて動作します。

ただ、気づいたのは、system ユーザーのプロフィール/招待セクションから招待を送信しても、招待メールには私(私のユーザー)が招待者として表示されるということです。

ユーザー名で管理者APIキーを試してみてはどうでしょうか。
API経由でUIと同じ動作が得られるはずです。