# networkbots

## WhatsApp bot storage mode

The bot now runs **without a local database**.

### Files used for local persistence

- `whatsapp-bot/storage/bot_state.json`: conversation state + first-visit tracking + purchase orders.
- `whatsapp-bot/storage/whatsapp_bot.events.jsonl`: structured JSON logs for incoming messages, outgoing responses, support requests, and order submission results.
- `whatsapp-bot/storage/whatsapp_bot.log`: plain text operational log.

### Config

`whatsapp-bot/bot.config.json` supports:

- `welcome_message`: sent once when a user contacts the bot for the first time.
- `api_new_order`: backend API endpoint used to submit completed purchase orders.
- `api_voucher_check`: backend API endpoint used to submit voucher/card check requests.

### Purchase options

- `whatsapp-bot/options.json` contains:
  - network list (providers)
  - voucher categories per network (name + price)

### API contract

- See `whatsapp-bot/NEW_ORDER_API.md` for request/response details of `api_new_order`.
- See `whatsapp-bot/ORDER_SYNC_API.md` for callback details including `voucher_check_callback`.

`bot_servers` now also includes `instance_id` so voucher-check requests can be linked to `server_id` by bot instance.
