--- name: navan-expense description: | Submit work expenses through Navan via Okta SSO using Chrome browser control. Triggers when user mentions: - "submit an expense" - "navan expense" - "file an expense" - "upload receipt" --- # Navan Expense Submission Submits work expenses through Navan (Verkada's expense system) by navigating Okta SSO and using Navan's AI expense chat to upload receipts and fill out expense forms. ## Quick Usage (Already Configured) ### Submit an expense with a receipt The user will provide: 1. A receipt image file (full local path) 2. The expense category (e.g., "Traveling: other", "Traveling: meals for myself") ### Flow 1. **Navigate to Okta** - Go to `https://verkada.okta.com` and wait for the dashboard to load 2. **Open Navan** - Click the "Navan" app link. It opens in a new tab. Switch to that tab via `list_pages` and `select_page`. 3. **Go to Expense page** - The travel home page loads first. Navigate directly to `https://app.navan.com/app/liquid/user/home` 4. **Click "New transaction"** - This opens a menu with options. Click "Add receipts" (uid will vary). 5. **Use AI chat** - A beta AI expense chat dialog appears. Click "Generate with AI" to open the chat interface. 6. **Upload receipt** - Click the "Attach file" button inside the iframe, then use `upload_file` to upload the receipt image. 7. **Send receipt** - Click the Send button to process the receipt via OCR. 8. **Wait for processing** - Wait for text like "receipt processed successfully" to appear (can take up to 30s). 9. **Review parsed data** - The AI will show: merchant, amount, date, location, expense type, GL code, etc. 10. **Correct expense type** - If the AI picks the wrong category, type a correction in the chat: e.g., "Change the expense type to Traveling: other" and send it. Wait for confirmation. 11. **Check with user** - Show the parsed expense details and confirm before submitting. 12. **Submit** - When approved, click the "Submit this expense" button. Wait for "Success!" heading. ## Key URLs | Page | URL | |------|-----| | Okta Dashboard | `https://verkada.okta.com` | | Navan Travel Home | `https://app.navan.com/app/user2/home?tripType=corporate` | | Navan Expense | `https://app.navan.com/app/liquid/user/home` | ## Common Gotchas - **Okta verification delay**: Okta may show a "Verifying your identity" page for a few seconds. Use `wait_for` with a generous timeout. - **Navan opens in new tab**: Clicking the Navan app from Okta opens it in a new browser tab. Always check `list_pages` and use `select_page` to switch. - **Travel home loads first**: The direct Navan SSO link lands on the travel booking page, not expenses. Navigate directly to the expense URL. - **"New transaction" menu is a dropdown**: Clicking it reveals options like "Add receipts", "Type in details", etc. Don't assume it navigates directly. - **AI chat lives in an iframe**: The expense chat is inside an iframe. Snapshots need to traverse into it. The iframe's RootWebArea is accessible in the a11y tree. - **OCR can take 10-30 seconds**: After uploading and sending a receipt, the AI needs time to process. Use a 30s timeout on `wait_for`. - **Expense type may be wrong**: The AI categorizes automatically but can miss. Always ask the user to confirm and correct via chat. - **Date parsing**: The AI reads the receipt date. The screenshot filename date (e.g., 20260402) may differ from the transaction date on the receipt itself. Trust the OCR, not the filename. - **No credentials needed**: Everything goes through the existing browser Okta session. No API keys or env vars required. ## Input Requirements From the user you need: 1. **File path** to the receipt image (e.g., `/Users/connor.rhodes/Downloads/Screenshot_20260402-101332.png`) 2. **Expense category** (e.g., "Traveling: other") 3. **Any corrections** to the AI-parsed data before submission ## Expense Categories (Verkada/Navan) Common categories seen in the system: - Traveling: other - Traveling: meals for myself - Traveling: taxi & rideshare - Airfare & fees - Lodging - Distance Driven - Personal Professional Development