-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: add sendgrid webhook endpoints to receive webhook events #1150
base: main
Are you sure you want to change the base?
Conversation
return types.NewErrHttp(http.StatusMethodNotAllowed, "Invalid request method") | ||
} | ||
|
||
inboundEmail, err := inbound.Parse(req.Request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sendgrid doesn't have a way to attach secret header so it is a bit tricky to vefify whether requests are coming from sendgrid...this makes our webhook server vulnerable to unverified webhook events from other places. (at least not from our account that you can configure to send a secret key as a header)
so there is no validation right to validate if requests are actually coming from sendgrid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added basic auth protection for now. The username and password can be configured at global level to protect webhook endpoint, and sendgrid webhook can be configured to have configured username and password in front of the url.
@@ -0,0 +1,132 @@ | |||
package emailtrigger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored the code a bit to be able to share some common trigger code from both smtp and sendgrid.
83c04f0
to
4b99147
Compare
Signed-off-by: Daishan Peng <[email protected]>
4b99147
to
f58a331
Compare
Signed-off-by: Daishan Peng <[email protected]>
Add sendgrid webhook endpoint to be able to receive sendgrid inbound parse event and trigger workflow.
A use case would be getting emails regarding to receipts and have dedicated workflows processing these emails.