Skip to content

DeeeeZ/HSBC-Bot-Companion

Repository files navigation

HSBC Bot Companion

Chrome Extension Manifest V3 License: MIT RPA Ready Version

A powerful Chrome extension to automate workflows on the HSBCnet banking portal. Designed for both human users and RPA bot integration with intelligent features for batch processing, smart date handling, and export tracking.


Features

1. Export All Accounts with Smart Controls

Batch export all accounts with unprecedented control and visibility

  • Selective Export: Checkbox on each account row - export only what you need

    • Select All / Deselect All toggle in the header
    • Dynamic button label shows "Export Selected (X)" count
    • Smart filtering to process only checked accounts
  • Date Presets Modal: One-click date range selection

    • Yesterday
    • Last 7 Days
    • Last Month
    • Month to Date
    • Custom date range picker
  • Live Progress Bar: Real-time visual feedback at top of screen

    • Shows "Exporting... 34/106" with progress percentage
    • Animated progress bar
    • Cancel button to stop batch processing mid-operation
  • Automatic Loop: Clicks through ALL accounts (100+), exports each one, returns to list

  • Pagination Support: Handles multiple pages automatically

  • Smart File Naming: Files organized into HSBC_Exports/YYYY-MM-DD/ subfolder and renamed to {AccountTitle}_{AccountNumber}_{Currency}_{DateFrom}_TO_{DateTo}.xlsx

  • Error Recovery: Failed accounts are logged and skipped, loop continues

  • Completion Modal: Summary popup showing success/fail counts, duration, and failed account details

  • Export Log JSON: Auto-downloads HSBC_Export_Log.json with full account details for all completed/failed exports

2. Export History Tracking

Never lose track of your exports

  • Persistent History: Click the extension icon to view popup with complete export log
  • Detailed Records: Each export session shows:
    • Date and time of export
    • Date range that was exported
    • Success/fail counts
    • Total duration
  • Local Storage: History saved using Chrome Storage API
  • Quick Access: Always available via toolbar icon

3. Auto Export Excel (Single Account)

One-click intelligent export for individual accounts

  • One-Click Automation: Clean "Auto Export" button on Account Details page
  • Smart Date Filling: Prompts for Start/End dates (defaulting to current month) and auto-fills them
  • Smart Wait: Intelligently monitors the transaction table and clicks export as soon as data finishes loading (no fixed delays)
  • Auto-Download: Automatically selects the Excel option to start the download
  • Smart File Naming: Same organization as Export All - saved to HSBC_Exports/YYYY-MM-DD/ subfolder
  • RPA Status Polling: data-status attribute for Power Automate Desktop integration (see RPA section below)

4. Zero-Latency Auto-Close

Instant cleanup for seamless workflow

  • Instant Cleanup: Monitors the "Redirecting" popup window
  • Event-Driven: Closes the popup the exact millisecond the Excel file starts downloading
  • Status Indicator: Displays "Waiting for Download..." while active

5. Visual Debugger

Know exactly what's happening in real-time

  • Non-Intrusive Logger: Green text on black background at bottom-left corner
  • Color-Coded Messages:
    • Orange for Export All progress
    • Green for success states
    • Red for errors
  • Real-time Updates: Shows exactly what the bot is doing at each step

6. Keep Alive

Prevent session timeouts during long operations

  • Comprehensive Activity Simulation: Dispatches mouse, keyboard, and scroll events every 1 minute to prevent HSBCnet's 5-minute session timeout
  • Multi-Target Events: Events dispatched on document, window, and document.body for maximum compatibility
  • Toggle Control: Checkbox on Accounts List page to enable/disable
  • ON by Default: Automatically enabled when extension loads
  • Visual Indicator: Checkbox shows current state

Screenshots

Coming soon: Screenshots of the extension in action


Installation

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable Developer mode (toggle in the top-right corner)
  3. Click Load unpacked
  4. Select the directory containing this extension: .../HSBC_Bot_Companion
  5. Important: After updates, always click the Reload icon on the extension card and refresh your HSBCnet tabs

Usage

Export All (Batch Processing)

  1. Navigate to HSBCnet Accounts List page
  2. (Optional) Use checkboxes to select specific accounts:
    • Check/uncheck individual accounts
    • Use "Select All" / "Deselect All" in the header
  3. Click the "Export All" or "Export Selected (X)" button in the toolbar
  4. Choose a date preset from the modal:
    • Quick options: Yesterday, Last 7 Days, Last Month, Month to Date
    • Or select a custom date range
  5. Watch the progress bar at the top of the screen
  6. Click Cancel anytime to stop the batch process
  7. The extension will:
    • Loop through selected accounts
    • Export each one with your chosen date range
    • Rename files automatically
    • Handle pagination if there are multiple pages
  8. View export summary in the extension popup (click toolbar icon)

Single Account Export

  1. Navigate to any Account Details page
  2. Click "Auto Export" button
  3. Enter date range when prompted (or use defaults)
  4. File downloads and renames automatically

View Export History

  1. Click the HSBC Bot Companion icon in Chrome toolbar
  2. See complete history of all export operations:
    • When each export happened
    • What date range was used
    • How many succeeded/failed
    • How long it took

Download Organization

Downloads are automatically organized into dated subfolders:

Downloads/
└── HSBC_Exports/
    └── 2026-01-12/                    (date when export was run)
        ├── HSBC_Export_Log.json       (export summary)
        ├── STYLE_AVENUE_020-133989-001_AED_01-01-2026_TO_11-01-2026.xlsx
        ├── GUESS_EMIRATES_023-860216-001_AED_01-01-2026_TO_11-01-2026.xlsx
        └── ... (all exports from that session)

File Naming Format

{AccountTitle}_{AccountNumber}_{Currency}_{DateFrom}_TO_{DateTo}.xlsx

Example:

C G R FZE_021-894472-001_AED_06-12-2025_TO_06-12-2025.xlsx

Chrome automatically creates the folders if they don't exist.


RPA Integration Guide

Perfect for automation workflows with Power Automate Desktop, UiPath, Selenium, and more.

Button Selectors

#hsbc-bot-export-btn      (Auto Export - Account Details page)
#hsbc-bot-export-all-btn  (Export All - Accounts List page)
#hsbc-bot-keep-alive-btn  (Keep Alive checkbox - Accounts List page)

Status Polling (data-status attribute)

The Auto Export button exposes a data-status attribute for RPA tools to poll export completion:

Status Meaning
idle Ready for export
exporting Export in progress
done Download complete
error Export failed

Power Automate Desktop

Step 1: Trigger Export (Execute JavaScript action)

function ExecuteScript() {
    var btn = document.getElementById('hsbc-bot-export-btn');
    if (!btn) return 'ERROR: Button not found';
    btn.setAttribute('data-start', '%YourStartDateVar%');
    btn.setAttribute('data-end', '%YourEndDateVar%');
    btn.click();
    return 'OK';
}

Step 2: Poll for Completion (Loop until done or error)

function ExecuteScript() {
    var btn = document.getElementById('hsbc-bot-export-btn');
    return btn ? btn.getAttribute('data-status') : 'ERROR';
}
// Returns: idle, exporting, done, error

PAD Flow: Trigger → Loop (wait 1-2s → poll → exit if done/error)

Other RPA Tools (UiPath, Selenium)

const btn = document.getElementById('hsbc-bot-export-btn');
btn.setAttribute('data-start', '01/11/2025');
btn.setAttribute('data-end', '30/11/2025');
btn.click();

// Poll for completion
const status = btn.getAttribute('data-status');
// status: 'idle' | 'exporting' | 'done' | 'error'

Date Format: dd/mm/yyyy


Privacy & Permissions

  • activeTab: To interact with the HSBCnet page content
  • downloads: To detect downloads and rename files automatically
  • storage: To save export history locally on your device
  • Host Permissions: Restricted to *://*.hsbcnet.com/* only

Your data never leaves your browser. All processing happens locally.


Technical Details

  • Manifest Version: V3 (latest Chrome extension standard)
  • Content Script: DOM injection, UI automation, batch processing logic
  • Service Worker: Download events, file renaming, tab management
  • Storage: Chrome Storage API for export history persistence
  • Smart Wait: MutationObserver-based detection (no arbitrary delays)

Support & Contributing

Found a bug or have a feature request? Open an issue or submit a pull request.

Note: This extension is designed specifically for HSBCnet portal automation. Selectors may need updates if the portal structure changes.


License

MIT License - Feel free to use and modify for your automation needs.

About

Chrome extension automating HSBCnet banking portal workflows - Export All accounts, Smart File Naming, RPA integration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors