Webhooks send real-time notifications to a specified URL when events occur on EasyPost objects such as shipments, trackers, batches, and more. Each time an event occurs, EasyPost sends a POST request to all configured webhook endpoints.
Using webhooks is the most efficient way to receive updates. Polling the API with GET requests can introduce latency and unnecessary requests when no updates are available.
Create a Webhook in the EasyPost Dashboard
- Log in to the EasyPost Dashboard.
- Navigate to Webhooks & Events.
- Click Add webhook.
- Select the environment:
- Production for live events
- Test for test mode events
- Enter the endpoint URL that will receive webhook
POSTrequests. - (Optional) Select specific event types to receive. If no event types are selected, all supported events are sent.
- Click Save.
Once saved, EasyPost begins sending webhook events to the specified endpoint as events occur.
Verify Webhook Delivery
After creating a webhook, delivery attempts and responses can be viewed directly in the Webhooks & Events section of the Dashboard. This includes:
- Event type
- Delivery status
- Timestamp
This information can be used to confirm successful delivery or troubleshoot failed webhook attempts.
Best Practices
- Ensure the endpoint can accept HTTPS POST requests.
- Return a 2xx HTTP response to acknowledge successful receipt.
- Webhook endpoints should respond quickly to avoid retries.
- Test webhooks in the Test environment before enabling them in Production.
FAQs
Q: What events are sent if no event types are selected?
If no event types are selected when creating a webhook, EasyPost sends all supported event types to the configured endpoint.
Q: Can multiple webhook URLs be configured?
Yes. Multiple webhook endpoints can be configured in the EasyPost Dashboard. Each endpoint receives events independently.
Q: What happens if a webhook delivery fails?
If a webhook delivery attempt fails or the endpoint does not return a 2xx HTTP response, EasyPost automatically retries delivery according to it's retry policy. Delivery attempts and response details can be reviewed in the Webhooks & Events section of the Dashboard.