'Save response ID from Sendgrid to spring boot db
I am using the Sendgrid mail template for sending mail, and it is working completely fine. Mail is sent properly to recipients with the proper body. Now I came with a new requirement, which is, By using SendGrid it provides you with a transaction ID of each mail you sent. Now I have to save it in my DB. Can anyone help me with it?
Solution 1:[1]
When you send a mail with the SendGrid API the response is empty, so you don't get an ID back.
However, what you can do is set anything you like in the custom_args for either the entire request or for each personalisation. custom_args are sent back in the parameters for every tracking event. So, you can generate your own ID and store that, then when you receive an event from the API, you will get that ID as the custom_args and can attribute the event to the original email.
I wrote a blog post about how to do this in Ruby on Rails, but I don't have an example in Spring Boot.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | philnash |
