# Version 2.4.8 Initial SMS Diagnostics + Manual Resend

This patch addresses the case where:

- A call creates a new dashboard lead.
- The lead source is `inbound_call_text`.
- But the customer does not receive the initial recovery SMS.

## Why

If the lead source is `inbound_call_text`, the recovery trigger did run. The remaining failure is usually:

- TextBee config missing or incorrect.
- TextBee device/SIM not online.
- TextBee API accepted but Android/SIM/carrier did not deliver.
- Lead state skipped SMS because of `do_not_contact` or `sms_blocked`.
- Provider returned null/skipped.

## What changed

### Lead fields added

- initial_sms_status
- initial_sms_provider
- initial_sms_attempted_at
- initial_sms_sent_at
- initial_sms_error
- initial_sms_result

### Dashboard health now includes

- initial_sms_status
- initial_sms_error
- initial_sms_result
- outbound_message_count
- last_outbound_message

### Lead Details now shows

- Initial SMS status
- Provider
- Error
- Sent time

### Manual resend button

Lead Details now has:

Resend initial SMS

Endpoint:

POST /admin/api/leads/:id/resend-initial-sms

### Better TextBee logs

- [TextBee SMS attempt]
- [TextBee SMS accepted]
- [TextBee API error]
- [TextBee API returned unsuccessful payload]

## What to check

Open:

/admin/api/dashboard-health

Look at the latest lead:

- initial_sms_status
- initial_sms_error
- initial_sms_result
- outbound_message_count
- last_outbound_message

Open:

/admin/api/app-log?lines=500

Look for:

- [Missed-call recovery SMS attempt]
- [TextBee SMS attempt]
- [TextBee SMS accepted]
- [Missed-call recovery SMS sent]
- [Missed-call recovery SMS skipped]
- [Missed-call SMS failed]


## Provider diagnostics added

`/admin/api/dashboard-health` also shows:

- smsProvider
- ownerSmsProvider
- textbeeConfigured
- textbeeDeviceIdPresent
- telnyxSmsConfigured

If the app says SMS sent but the customer does not receive it, confirm whether the app is sending through TextBee or Telnyx. If Telnyx SMS is not A2P-approved, switch customer SMS to TextBee:

SMS_PROVIDER=textbee
