我正在尝试使用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);
});
但通知不会发送。