I have this function that I want it to send notifications based on user location and tags using OneSignal REST API.
sendNotifiToDriver(lat, long) {
console.log(lat, long);
const body = {
app_id: environment.onesignal.appId,
headings: { en: 'كابتن , يوجد طلب جديد' },
contents: { en: 'يوجد طلب جديد بالقرب منك . ' },
filters: [
{
field: "location",
radius: "5000",
lat: lat,
long: long,
},
{field: "tag", "key": "driver", "relation": "=", "value": "lam_driver"}
],
};
const header = {
headers: new HttpHeaders()
.set('Content-Type', 'application/json')
.set('Authorization', `Basic ${environment.onesignal.restKey}`)
};
return this.http.post('https://onesignal.com/api/v1/notifications', body, header).subscribe(res => {
console.log("driver notifi", res);
},err=>{
console.log('driver error ',err)
})
}
The problem is l have the error " All included players are not subscribed" . l already have users subscribed with that tags and location. if l use only one filter such as location or only tag above. l will have successful receiving notification. if l used both of them l will have the error above.
any idea please ?