OneSignal REST API 发送推送通知,但我收到 500 错误

OneSignal REST API to send push notification, but I get a 500 error

我已经编写了一个 Perl 脚本,我正在尝试使用 OneSignal 发送测试推送通知。这是我的 JSON(经过美化,便于阅读);

 {
    "contents": {
        "en": "Here are your daily picks!"
    },
    "app_id": "id_here",
    "app_ids": ["id_here"],
    "include_player_ids": ["aabaa581-b54a-4348-81cb-00ed65c1adf8"]
 }

我收到一条错误消息,很简单 HTML:

  <p id="message" class="text">An Unexpected Error Occurred</p>
  <p id="submessage" class="text">Error Code: 500</p>
  <p id="explanation" class="text">
    We track these errors automatically, but if the problem persists feel free to contact us.
  </p>

关于我做错了什么有什么想法吗?

啊,我知道了!我会把答案放在这里,以防其他人将来遇到同样的问题。基本上,您 不需要 需要同时提供 1app_idANDapp_ids` 参数。文档有点误导:

https://documentation.onesignal.com/reference#create-notification

如果你只使用app_id,那么它发送的很好:)