# Invoice sync - ops handover Version 0.9.1 · Written 2026-10-23 · Escalation: RPA dev team, Teams channel **#rpa-support** ## 1. What the bot does Every hour, the bot reads the finance export of approved invoices (`data/input/invoices.csv`) and sends each invoice to the billing system over its web API. It writes one report file per run in `data/output/` with a Status and a Message for every invoice, and adds one line per invoice to `logs/sync.log`. It has no window or screen of its own and does not drive any desktop app or website. It is a background job that Windows Task Scheduler starts. ## 2. How it works ``` Windows Task Scheduler (every hour) └─ starts → Invoice sync (background job, no window) │ reads ← data/input/invoices.csv (finance export) ├─ sends → Billing system (web API, over the internet) ├─ writes → data/output/sync_report_.csv ├─ writes → logs/sync.log └─ writes → BOT_WAS_RUN (marker file in the bot folder, "a run started") ``` - **Task Scheduler** starts the job once an hour. The sample log shows runs at the top of the hour. - **Invoice sync** is the bot. It runs and exits by itself, with nothing on screen. - **The input file** is the finance export. The bot only reads it and never moves, renames or marks it. - **The billing system** is where invoices get created. The bot never deletes or changes an invoice there. - **The report file** is the only place that says *why* an invoice did not sync. - **`sync.log`** shows when each invoice was handled and its status, plus a "run done" line at the end. - **`BOT_WAS_RUN`** only shows that a run started. Ignore it. **One run, step by step:** 1. Write the `BOT_WAS_RUN` marker and create a new report file named after the current date and minute. 2. Read the input file one row (one invoice) at a time. 3. Check the row: invoice number, customer ID, amount and currency must be filled in, and the amount must be a number above 0. If the row fails a check, it is marked **Invalid** and the bot goes to the next row. 4. Send the invoice to billing. The bot reads billing's answer and marks the row Synced, Duplicate or Invalid. If billing does not answer or answers with an error, the bot retries (section 8). 5. Write the row's result to the report and `sync.log`. 6. After the last row, write `run done -> sync_report_