gpt4 book ai didi

javascript - 用于 Cordova 的 Pushwoosh 远程 API

转载 作者:行者123 更新时间:2023-11-30 12:35:14 24 4
gpt4 key购买 nike

我想通过 pushwoosh 从客户端(我的 cordova (ionic) 应用程序)发送推送通知.

是否有任何示例代码或指南?

谢谢!

最佳答案

您必须使用 Remote Access API这需要付费计划。我创建了一个对象,其中包含我要发送的文本和我要将其发送到的设备 token ,并将其作为参数传递给以下函数:

function push(object) {
var params = {
"request": {
"application": "PW_ID GOES HERE",
"auth": "Find in your API Access page",
"notifications": [{
// Content Settings
"send_date": "now",
"ignore_user_timezone": true,
"content": {
"en": object.text
},
"platforms": [1, 3], // 1 - iOS; 3 - Android;
// iOS Related
"ios_category_id": "1",
"ios_badges": "+1",
// Android Related
"android_icon": "icon",
// Who to send it to
"devices": object.tokens
}]
}
};
$http.post('https://cp.pushwoosh.com/json/1.3/createMessage', params).then(success, failure);

function success() {
console.log("successful notification push");
}

function failure(error) {
console.log('error sending notification', error);
}
}

关于javascript - 用于 Cordova 的 Pushwoosh 远程 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26274138/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com