Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
oneSignal multiple filters tag and location api

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 ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!