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

185
Views
Sending media parameter is not working while sending it to kaleyra api through code

https://developers.kaleyra.io/docs/send-a-media-template-message-through-whatsapp

I am trying to send a media to kalerays api through my code. But it is not working when I pass from code. But When I hit the API from postman then it works fine.

async whatsappAPIWithAttachment(requestBody) {
     let api_key = "";
    if (requestBody.campaign) {
      api_key = "x";
    } else {
      api_key = "Y";
    }
    
    var data = qs.stringify({
      from: "xyz",
      to: "xyz",
      type: "mediatemplate",
      channel: "whatsapp",
      template_name: "xyz",
      params: '"name","vendor"',
      lang_code: "en",
      media_url: "http://www.africau.edu/images/default/sample.pdf",
    });

    var config: AxiosRequestConfig = {
      method: "post",
      url: "https://api.kaleyra.io/v1/HXIN1707222213IN/messages",
      headers: {
        "api-key": api_key,
        "content-type": "multipart/form-data",
      },
      data: data,
    };

    let response = await axios(config);
    return response.data;
  }
}

It gives me an enter image description hereerror request failed with status code 400. Here I have replaced X, Y, and XYZ with actual parameters. So Inputs are correct but still get an error saying 'E413', message: 'Invalid/incorrect inputs.

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

0

As per sample request in kaleyra documentation, they have used

--header 'Content-Type: application/json'

while you are passing

"content-type": "multipart/form-data",

pls correct it and try.

about 4 years ago · Juan Pablo Isaza Report

0

how about using double quote strings for param value

params: "\"name\",\"vendor\""
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!