> ## Documentation Index
> Fetch the complete documentation index at: https://smartcar.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Best Practices Overview

> Build reliable and maintainable webhook integrations following industry standards

Follow these best practices to build a production-ready webhook integration that handles high volume, recovers from failures, and provides a great developer experience.

<Tip>
  **Looking for a quick start?** Our [Webhook Receiver Recipe](/getting-started/tutorials/webhook-receiver-recipe) provides a production-ready implementation of these best practices. It's a serverless AWS solution that you can deploy in minutes with built-in queuing, signature verification, retry logic, and monitoring.
</Tip>

## Key Areas

<CardGroup cols={2}>
  <Card title="Architecture Patterns" icon="diagram-project" href="/integrations/webhooks/best-practices/architecture">
    Decouple receipt from processing with queue-based patterns
  </Card>

  <Card title="Security" icon="shield-check" href="/integrations/webhooks/best-practices/security">
    Verify signatures and protect against spoofed requests
  </Card>

  <Card title="Reliability" icon="shield" href="/integrations/webhooks/best-practices/reliability">
    Implement idempotency and handle out-of-order delivery
  </Card>

  <Card title="Monitoring" icon="chart-line" href="/integrations/webhooks/best-practices/monitoring">
    Log events and set up alerts for critical metrics
  </Card>

  <Card title="Testing" icon="flask" href="/integrations/webhooks/best-practices/testing">
    Test locally and validate edge cases before production
  </Card>
</CardGroup>

***

## Quick Wins

Start with these essential practices for immediate impact:

<AccordionGroup>
  <Accordion title="1. Return 200 Immediately" icon="bolt">
    Persist the payload to a queue and return a 200 status within milliseconds. Process asynchronously in a background worker.

    **Impact:** Prevents timeouts and unnecessary retries
  </Accordion>

  <Accordion title="2. Verify All Signatures" icon="shield-halved">
    Check the `SC-Signature` header on every request to ensure the payload came from Smartcar.

    **Impact:** Prevents security vulnerabilities from spoofed requests
  </Accordion>

  <Accordion title="3. Use eventId for Deduplication" icon="fingerprint">
    Track processed `eventId` values to avoid processing the same event twice.

    **Impact:** Prevents duplicate database updates and notifications
  </Accordion>

  <Accordion title="4. Handle VEHICLE_ERROR Events" icon="circle-exclamation">
    Don't ignore error events. They contain critical information about signal failures and permission issues.

    **Impact:** Better user experience and faster issue resolution
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={3}>
  <Card title="Architecture Patterns" icon="diagram-project" href="/integrations/webhooks/best-practices/architecture">
    Learn the queue-based pattern
  </Card>

  <Card title="Security" icon="shield-check" href="/integrations/webhooks/best-practices/security">
    Implement signature verification
  </Card>

  <Card title="Delivery Behavior" icon="truck-fast" href="/api-reference/webhooks/delivery-behavior">
    Understand retry policies
  </Card>
</CardGroup>
