Sendgrid-nodejs: Why we get such unuseful http response?

Created on 12 Sep 2019  路  4Comments  路  Source: sendgrid/sendgrid-nodejs

I try to understand why we get such http response after sending an email?

[
  {
    "statusCode": 202,
    "headers": {
      "server": "nginx",
      "date": "Thu, 12 Sep 2019 10:55:31 GMT",
      "content-length": "0",
      "connection": "close",
      "x-message-id": "PART OF MESSAGEID",
      "access-control-allow-origin": "https://sendgrid.api-docs.io",
      "access-control-allow-methods": "POST",
      "access-control-allow-headers": "Authorization, Content-Type, On-behalf-of, x-sg-elas-acl",
      "access-control-max-age": "600",
      "x-no-cors-reason": "https://sendgrid.com/docs/Classroom/Basics/API/cors.html"
    },
    "request": {
      "uri": {
        "protocol": "https:",
        "slashes": true,
        "auth": null,
        "host": "api.sendgrid.com",
        "port": 443,
        "hostname": "api.sendgrid.com",
        "hash": null,
        "search": null,
        "query": null,
        "pathname": "/v3/mail/send",
        "path": "/v3/mail/send",
        "href": "https://api.sendgrid.com/v3/mail/send"
      },
      "method": "POST",
      "headers": {
        "Accept": "application/json",
        "User-agent": "sendgrid/6.3.0;nodejs",
        "Authorization": "Bearer ",
        "content-type": "application/json",
        "content-length": 1103
      }
    }
  },
  null
]

What I should understand from this? Only http status code useful here.
Why I can't get normal Message-ID? Why I get the string before @ sign, how do I get the full Message-ID? I don't want to send custom argument, I want Message-ID.

Why I can't get status of message in response? Even if it will be "In queue" it's still better than current response.

As a paying customer I want to get a normal useful response that will help me to integrate sendgrid with our service and not what you send me.

Thx

support

All 4 comments

He is right! We had the same issue. Please fix it....

Sorry sgMail.send(msg), and then? how do I match webhook events with this email?

Just wanted to leave a comment here regarding how to match webhook events with emails. You can add custom args to the emails that carry over to the events.

{
        to: '[email protected]',
        from: 'Some Company <[email protected]>',
        subject: 'Did somebody say BACON DONUTS?? 馃馃馃',
        templateId: 'xsdsew22323dxxx',
        custom_args: {
          "param1": 'some_id',
          "param2": 'internal_person_id'
        },     
        dynamic_template_data: {
          first_name: 'dynamic data'
        }        
      }

Hello @Rashe,

Thanks for submitting a GitHub issue! We are very sorry that you are running into this problem. In order to better serve you, as this does not present itself as a library specific issue, we would like to ask that you reach out to our support team at https://support.sendgrid.com.

Thank you!

SendGrid DX Team

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prasoonjalan picture prasoonjalan  路  3Comments

kiranshashiny picture kiranshashiny  路  4Comments

Loriot-n picture Loriot-n  路  4Comments

thinkingserious picture thinkingserious  路  4Comments

danielflippance picture danielflippance  路  4Comments