# `PaperTiger.TelemetryHandler`
[🔗](https://github.com/EnaiaInc/paper_tiger/blob/v1.2.2/lib/paper_tiger/telemetry_handler.ex#L1)

Handles telemetry events and creates Stripe events + delivers webhooks.

This module bridges the gap between resource operations and webhook delivery.
When resources emit telemetry events (e.g., customer created), this handler:

1. Creates a Stripe Event object
2. Stores it in the Events store
3. Delivers webhooks to registered endpoints

## Event Naming Convention

Telemetry events follow the pattern:
  [:paper_tiger, :resource_type, :action]

Which maps to Stripe event types:
  resource_type.action (e.g., "customer.created")

For nested types like subscriptions:
  [:paper_tiger, :subscription, :created] -> "customer.subscription.created"

# `attach`

```elixir
@spec attach() :: :ok
```

Attaches all telemetry handlers for PaperTiger events.

Call this during application startup.

# `detach`

```elixir
@spec detach() :: :ok | {:error, :not_found}
```

Detaches all telemetry handlers.

Useful for testing or cleanup.

# `handle_event`

```elixir
@spec handle_event(list(), map(), map(), any()) :: :ok
```

Handles a telemetry event by creating a Stripe event and delivering webhooks.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
