What is an easy way to debug webhooks?
In most cases, webhooks are rejected by the endpoint due to the payload not conforming with an expected structure or if the URL is incorrect.
To begin troubleshooting the problem check the Failed Webhooks tab in your Mailparser inboxes Emails page and click on a failed email. At the top, there will be a Dispatched Webhooks tab that will display a list of all attempts made and to which endpoints. Clicking on any of the results will display the payload, as well as the HTTP status code, and sometimes a response from the endpoint with additional information.
The first step should always be to check the type of response received. Typical response types are below;
- 100-199 - Informational responses - These are typically a response from the server that the connection was made, however, the data may not have completed the process at the endpoint.
- 200-299 - Success responses - Any 2xx usually indicates that the data has been received successfully and will not generate any failure alerts (this is what we want to see!)
- 300-399 Redirects - The endpoint should be checked to ensure the receiving target URL does not need to be updated.
- 400-499 - Client Errors - An endpoint responding with a 4XX response has rejected the payload. Ensure that the payload conforms to any data standards set out by the endpoint, this could be that a field is expecting a value that differs from your output or that a value may have exceeded a character or size limit. Please consult with your endpoints documentation on these types of issues - commonly sent back as 4XX errors.
- 500-599 - Server Errors - The endpoint is experiencing temporary or permanent issues and the payload cannot be accepted. For these types of alerts please contact the administrator for the service you are sending to or re-check any URL's.
- 0 - No contact - Zero responses indicate that the server was completely unreachable and no attempt was made to send the payload.