Best place to catch invalid payload or error from webhook sender? #33
ChrisHardie
started this conversation in
Receivers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
WordPress's WooCommerce appears to be capable of sending webhook payloads that basically say "your webhook setup is misconfigured" in the case where the webhook is setup as a user without sufficient permissions to view the requested event/payload:
(IMHO WooCommerce should just not send a webhook in that scenario.)
It still sends valid event information. So I'm trying to figure out the best place to catch that payload before passing it along to my individual event handlers, and generate an error message for further action/investigation. I could do it in the "verify" method but the "unauthorized" response from Laravel may then disable further webhook sending, which isn't ideal. I'm using a series of parent/child classes to handle individual events so I could put it in the parent
handle()
method, but then each child class has to call that parent before their own individualhandle()
logic, which is a bit repetitive.Maybe I'm making it too complicated, but any guidance is welcome.
Beta Was this translation helpful? Give feedback.
All reactions