I can't send a notifications with image
Opened this issue · 0 comments
heshaShawky commented
I'm adding this into my node app and trying to send a notification with image, it says has been send and delivered, but it doesn't on my device.
That's happened only when trying to add a big_picture with the notification!! ( some times I receive a notification like 2 from 10 after 10 min or so but with no image which is weird as I even checked from the pannel it says the notification has an image with it )
So my code looks like this:
@Cron('45 * * * * *')
async sendNotificaiotns() {
console.log('sending notification');
try {
const randomArticle = await this.articleRepository
.createQueryBuilder()
.orderBy("RAND()")
.limit(1)
.getOne();
const input = new NotificationBySegmentBuilder()
.setIncludedSegments(['Active Users', 'Inactive Users'])
.notification() // .email()
.setAttachments({
data: {
randomArticle,
},
big_picture: encodeURI(randomArticle.image)
})
.setHeadings({ 'en': randomArticle.title })
.setContents({'en': randomArticle.title })
.build();
console.log(randomArticle);
await this.oneSignalService.createNotification(input);
} catch (e) {
console.log(e);
}
}