我编写了一个 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_idAND
app_ids` 参数。该文档有点误导:
https://documentation.onesignal.com/reference#create-notification
如果您只使用app_id
,那么它会正常发送:)
关于OneSignal REST API 发送推送通知,但我收到 500 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40740770/