I want to know whether emails are opened by the clients or not (I already have a link along with the email but I want to know if they didn't click the link by opening the email and ignoring it).
Using Mailgun API,
I created webhooks and integrated with Mailgun.
@PostMapping(value = "/open-events") public ResponseEntity<Void> receiveOpenedEvents(@RequestBody MailGunPayload payload) { EventData eventData = payload.getEventData(); LOGGER.info("Event of type {} received", eventData.getEvent()); //logic removed return new ResponseEntity<Void>(HttpStatus.OK);}
But my problem is this webhook is called even when the email is not opened by the client.
I also tried calling their Events API but I get the same thing. (The opened event log when the email is not opened)
This is the piece of code for Events API.
HttpResponse<String> request = Unirest.get(API_URL +"/events") .basicAuth("api", API_KEY) .queryString("recipient", user.getEmail()) .queryString("event", "opened") .asString(); return request.getBody();
Below is the screenshot of my webhook from Mailgun Dashboard.
Am I missing something?
PS: The gmail address was used as a client.