Open sauravkumar-dev opened 2 years ago
Looks like it's not the raw payload which is needed to properly validate the event. Example here: https://github.com/sendgrid/sendgrid-java/blob/f158675d27e4150311ef370ae30e3a446b67871d/examples/helpers/eventwebhook/Example.java#L27
Hi, I am also facing the same issue, anyone knows how to get the right payload if we are using Spring boot? The example provided is using Spark
@sauravkumar-dev Were you able to figure out a solution to this issue?
@Kaushik612 Yes, I was figure out the issues and its working for me now. Below is the solution String payload= new ObjectMapper().writeValueAsString(payloadFromSendgrid)+"\n\r"; payload=payload.replace("},{" , "},\n\r{");
@Kaushik612 Was the above comment able to solve your issue? If not, are you able to get the raw payload from the Spring Boot implementation?
Issue Summary We are trying to validate signed webhook events in java with POST API. We are sending mail and configured https://webhook.site/73452d78-3dea-478b-a005-d87371972190 as public webhoo url. We are getting payload, timestamp and signature. but while verifying above on public key its failing.
Steps to Reproduce Enable Signed Event Webhook Requests on SendGrid website Copy the public from SendGrid and paste it in the java method Configure Mail Settings to enable webhooks and configure to send the event to our endpoint Send an email using SendGrid The webhook event is received and we try to validate the request against the public key We retrieve the info in headers X-Twilio-Email-Event-Webhook-Signature and X-Twilio-Email-Event-Webhook-Timestamp The validation always fails.
Pls find the code which i am using.
Payload as below: