Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

286
Vistas
Status code: 422 (error: {type: 'validation', message: 'Invalid message'})

I am trying to write the following curl post function with basic authentication in vanilla javascript.

curl -X POST \
  https://api.livechatinc.com/v3.3/agent/action/list_chats \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <your_access_token>' \
  -d '{}'

This is my code in javascript.

    (async () => {
      const rawResponse = await fetch(url, {
        method: 'POST',
        headers: {
          'Content-Type' : 'application/json',
          'Authorization': 'Basic ' + btoa(username+":"+password)
        },
        body: {
         "filters.group_ids" : "1",
         "limit" : 1
        }
      });
      const content = await rawResponse.json();
      
      console.log(content);
    })();

I keep getting this error "error: message: "Invalid message" type: "validation""

The curl method works perfectly in postman. I have read the documentation about this error and tried removing the content type header. It did not work. Any help is appreciated.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda