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

195
Views
Enviar notificación push de Expo a una matriz de token

Estoy tratando de enviar notificaciones automáticas a varios dispositivos con una serie de tokens provenientes de una API. Cuando envío a un solo objeto, la notificación push se envía correctamente, pero cuando lo hago a través de una matriz de objetos, da el error 400 en la solicitud.

 //assembling the array of tokens coming from the api let tokenArray = []; this.dataObj.notification_tokens.map((item) => { tokenArray.push({ to: item.push_token, sound: "default", title: this.dataObj.push_title, body: this.dataObj.push_message, }); }); //passing the array as a parameter of the Expo Push Notification request. I receive 400 error await fetch("https://exp.host/--/api/v2/push/send", { mode: "no-cors", method: "POST", headers: { Accept: "application/json", "Accept-encoding": "gzip, deflate", "Content-Type": "application/json", }, body: JSON.stringify(tokenArray), }).then((res) => { if (res) { this.dataObj.push_title = ""; this.dataObj.push_message = ""; this.goSuccess("Push Notification sending!"); } });

Si paso un solo objeto como parámetro de la solicitud Expo, la notificación push se envía normalmente

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No pude encontrar una solución usando el frontend, así que hice un punto final para enviar push a través del backend. Entonces, el backend se encarga de todo el envío masivo.

 const dataObj = { sound: "default", title: this.dataObj.push_title, body: this.dataObj.push_message, }; await this.$http .post(`/push/send-notification`, dataObj) .then((response) => { if (!response.data.success) { this.goError(response.data.message); } else { this.goSuccess(response.data.message); this.dataObj.push_title = ""; this.dataObj.push_message = ""; } }) .catch(function (error) { console.log(error); });

about 4 years ago · Juan Pablo Isaza Report
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!