Deliveries

Webhook deliveries detail and attempts

Crypitor supports multiple deliveries for every event through its webhook system. This ensures that you receive event notifications reliably, even in the face of temporary network issues or endpoint downtime.

Delivery Mechanism

  1. Initial Delivery

    • When an event occurs, Crypitor attempts to deliver the event notification to your configured webhook endpoint immediately.

    • The event notification is sent as a POST request with a JSON payload.

  2. Timeout and Retries

    • Each delivery attempt has a timeout of 5 seconds. If the webhook endpoint does not respond within this time frame, the request is considered a failure.

    • Crypitor will retry delivery up to a maximum of 3 times for each failed request.

    • The retries use an exponential backoff strategy, with a minimum backoff of 10 seconds and a maximum backoff of 60 seconds between retries.

    • Crypitor will consider the delivery successful only if the webhook endpoint responds with HTTP status codes 200 (OK) or 201 (Created). Any other status code will be treated as a failure and trigger a retry.

Example Workflow

  1. Event Occurrence

    • An ERC20 token transfer event is detected and logged by Crypitor.

  2. Initial Delivery Attempt

    • Crypitor sends a POST request to the configured webhook endpoint.

    • The request times out after 5 seconds without a response or receives a non-200/201 status code.

  3. First Retry

    • After the initial failure, Crypitor waits for a short interval (minimum backoff of 10 seconds) before retrying.

    • Crypitor sends the POST request again.

  4. Second Retry

    • If the first retry also fails, Crypitor waits for a slightly longer interval before the next retry.

    • The interval is determined by the exponential backoff strategy but will not exceed 60 seconds.

    • Crypitor sends the POST request again.

  5. Third and Final Retry

    • If the second retry fails, Crypitor waits for another interval (up to 60 seconds) before the final retry.

    • Crypitor sends the POST request one last time.

  6. Failure Notification

    • If all retries fail, Crypitor logs the failure (in deliveries tab at dashboard).

Delivery Status

You can monitor the delivery status of each event through the Crypitor dashboard. Each event will have an associated delivery log that includes:

  • Event ID: Unique identifier for the event.

  • Delivery Id: Id of webhook delivery request

  • Request Id: Number of attempts made to deliver the event notification.

  • Status: Final status of the delivery (e.g., success, failed after retries).

  • Timestamps: Timestamps for each delivery attempt.

Best Practices for Webhook Endpoints

To ensure reliable event delivery, follow these best practices:

  1. High Availability

    • Ensure your webhook endpoint is hosted on a high-availability server to minimize downtime.

  2. Efficient Processing

    • Process incoming event notifications efficiently and respond within 5 seconds to avoid timeouts.

    • Ensure your endpoint returns HTTP status codes 200 or 201 upon successful processing of the request.

  3. Logging and Monitoring

    • Implement logging and monitoring for your webhook endpoint to track incoming requests and identify any issues quickly.

  4. Error Handling

    • Implement robust error handling to respond appropriately to different types of errors (e.g., server errors, network issues).

Retry Backoff Configuration

Crypitor uses an exponential backoff strategy for retries with the following settings:

  • Retry min backoff: 10 seconds

  • Retry max backoff: 60 seconds

These settings ensure that retries are spaced out, allowing your endpoint time to recover between attempts.

Last updated