Email Activity API: How to retrieve contents of a specific email?
icarrara opened this issue · comments
I need to retrieve contents of a specific message, as for example sender email, target email, Subject, etc.
I used the below code:
SendGrid sg = new SendGrid("SG.xxxxxxxxxxxx");
Request request = new Request();
request.setMethod(Method.GET);
request.setEndpoint("messages");
request.addQueryParam("query", "msg_id="'O7MUu2GaQKODKy_Y2j0r4w.filterdrecv-p3las1-c477c4585-dg6pk-20-6032B583-20.0'");
request.addQueryParam("limit", "1");
sg.api(request);
I receive the below contents:
statusCode:200
body:{"messages":[]}
How I can retrieve original contents of the message as for example from email address, to email address, subject etc?
Thank you in advance for any help.
Ivano
I just found that my API call is correct and in fact after almost a minute I'm able to retrieve the message I was looking for.
There are a few seconds between the new message sent and the availability of it in Email Activity.
There is some chance to cut this intermediate time?
Thank you for any suggest.
Ivano
@shwetha-manvinkurke There are many minutes or hours after the message is delivered until you can get it from the Email Activity API. It is by design. So I'll close this issue. Thank you for your comment.