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

140
Views
Parse responses from JSON response
async sendMessage(message) {
    const slackEndpoint = 'https://hooks.slack.com/services/........';
    return await axios.post(slackEndpoint,
      {text: message})
      .catch((error) => console.log(error));
  }

let response = await this.sendMessage(message);
this.logger.info('Sending Slack message for amount threshold: ' + message);
console.log("!!!!!!!!!!!!! ", response.statusText )

if (response.statusText == 'OK') {
  this.logger.info('sent');
}
else {
  this.logger.error('NOT send!');
}

I get response:

{
  status: 200,
  statusText: 'OK',
  headers: {
    date: 'Thu, 09 Dec 2021 17:29:29 GMT',
  ..............
}

And error:

TypeError: Cannot read properties of undefined (reading 'statusText')

Do you know how I can properly get the value of statusText and compare it?

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

0

Try this:

async sendMessage(message) {
    const slackEndpoint = 'https://hooks.slack.com/services/........';
    return await axios.post(slackEndpoint,
      {text: message})
      .then(response => response)
      .catch((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!