# Configuration

### Configuration Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `token` | `string` | **Required** | WhatsApp API access token |
| `phoneNumberId` | `string` | **Required** | Your WhatsApp phone number ID |
| `businessAccountId` | `string` | Optional | Business account ID |
| `version` | `string` | `'v21.0'` | API version |
| `appSecret` | `string` | Optional | App secret for signature verification |
| `webhookVerifyToken` | `string` | Optional | Token for webhook verification |
| `apiTimeout` | `number` | `30000` | API request timeout (ms) |
| `maxRetries` | `number` | `3` | Max retry attempts for failed requests |
| `autoMarkRead` | `boolean` | `true` | Auto-mark messages as read |
| `autoProcessMessages` | `boolean` | `true` | Auto-process incoming messages |
| `queueEnabled` | `boolean` | `true` | Enable message queue |
| `maxQueueSize` | `number` | `1000` | Maximum queue size |

### Full Configuration Example

```typescript
const whatsapp = createWhatsAppHandler({
  token: 'YOUR_TOKEN',
  phoneNumberId: 'YOUR_PHONE_ID',
  businessAccountId: 'YOUR_BUSINESS_ID',
  version: 'v21.0',
  appSecret: 'YOUR_APP_SECRET',
  webhookVerifyToken: 'YOUR_VERIFY_TOKEN',
  apiTimeout: 30000,
  maxRetries: 3,
  autoMarkRead: true,
  autoProcessMessages: true,
  queueEnabled: true,
  maxQueueSize: 1000,
  storage: {
    type: 'memory',
    autoCleanup: true,
    maxMessagesPerConversation: 1000
  },
  webhook: {
    verifyToken: 'YOUR_VERIFY_TOKEN',
    appSecret: 'YOUR_APP_SECRET',
    autoProcess: true,
    autoMarkRead: true,
    verifySignature: true,
    maxBodySize: 10485760, // 10MB
    timeout: 30000
  }
});
```

---