[英]How to get the events like Processed, Delivered, Bounced, Dropped using sendgrid API in Java?
We are using sendgrid API to send emails via our web portal developed using Java. 我们正在使用sendgrid API通过使用Java开发的Web门户发送电子邮件。 We would like to capture the real time events using our portal for every mail sent using Event Webhook. 我们想使用门户网站捕获使用事件Webhook发送的每封邮件的实时事件。 Please tell us the implementation process. 请告诉我们实施过程。
We have tried using a block of code but it didn't work. 我们尝试使用代码块,但是没有用。
request.method = Method.PATCH;
request.endpoint = "user/webhooks/event/settings";
request.body = "{\"group_resubscribe\":true,\"delivered\":true,\"group_unsubscribe\":true,\"spam_report\":true,\"url\":\"url\",\"enabled\":true,\"bounce\":true,\"deferred\":true,\"unsubscribe\":true,\"dropped\":true,\"open\":true,\"click\":true,\"processed\":true}";
response = sendgrid.api(request);
String events = response.body;
Gson gson = new Gson();
Object obj = gson.toJson(events);
Event Notification needs to be configured in https://app.sendgrid.com/settings/mail_settings 需要在https://app.sendgrid.com/settings/mail_settings中配置事件通知
Based on the configuration, Sendgrid sends JSON messages in real time to the URL which is provided. 根据配置,Sendgrid将JSON消息实时发送到所提供的URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.