问题描述
我正在尝试使用Firebase云功能发送一个信号推送通知。 我已提供了所有凭据,并且这些功能已在Firebase函数上成功部署 但通知不来
我的代码是
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const db = admin.firestore();
exports.scheduleJobs = functions.pubsub.schedule("every 5 minutes").onRun(async (context) => {
const body = {
app_id: 'app id',included_segments: ['Active Users','Inactive Users"'],headings: { en: 'hello' },contents: { en: 'test',chrome_web_image: 'https://cdn4.iconfinder.com/data/icons/iconsimple-logotypes/512/github-512.png'},data: { task: 'hello' },big_picture: 'https://cdn4.iconfinder.com/data/icons/iconsimple-logotypes/512/github-512.png'
};
const header = {
headers: new HttpHeaders()
.set('Content-Type','application/json')
.set('Authorization',`Basic Yzk1MmMxMjgtMjkwNC00MmUyLTlhMmItY2NhNTU4YTZmYjJj`)
};
return this.http.post('https://onesignal.com/api/v1/notifications',body,header);
});
但通知不会发送。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)