IWI
IWI

Reputation: 1608

Sendgrid Mail Send not returning a response (undefined)

I have been working with the sendgrid email API ("Mail Send") and I am trying to keep track of the mails that have been sent, so i can watch when they have been clicked or responded to. When I send a mail, I get a 202, but the response body is empty (not undefined or anything) According to the docs I am supposed to get a schema back. Am I missing some critical piece of information. I am testing with Ngrok

    email.send({ to: '[email protected]',
    from: '[email protected]',
    subject: 'Hello world',
    text: 'Hello plain world!'
}).then(([response, body]) => {
    console.log('::::8', body) // EMPTY
    console.log(response.statusCode);
    console.log('::::4', response)

    }) .catch(error => {
    console.error('::::5', error.response?.body);
});

Upvotes: 1

Views: 1096

Answers (1)

rfdf
rfdf

Reputation: 61

According to the docs you only get a response from the api call when there's an error. For a successful email send (with a 202 code) you shouldn't get any response.

enter image description here

Upvotes: 2

Related Questions