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

标签 onesignal

我编写了一个 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

enter image description here

如果您只使用app_id,那么它会正常发送:)

关于OneSignal REST API 发送推送通知,但我收到 500 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40740770/

相关文章:

swift - 没有这样的模块 OneSignal

json - 通过 JSON 网络请求发送 Onesignal/gamethrive 推送

javascript - 如何进行异步调用以发送一个信号推送通知

android - CORDOVA 11 Android 构建失败 : Unresolved reference: FireBaseInstanceId

node.js - Web oneSignal 的静默推送通知

android - 取消/关闭图标上的通知

cordova - 为什么我会收到消息 "All included players are not subscribed"?

javascript - OneSignal 获取玩家 ID

ios - 使用CocoaPods依赖性管理器的OneSignal破坏了PhoneGapBuild

ios - 如何使用 OneSignal 发送自定义声音推送通知?