Osome Automation Skill
Automate document uploads and invoice management for Osome, a corporate secretary and accounting platform for Singapore companies.
What This Skill Does
Osome flags bank transactions that need supporting documents (invoices, receipts, salary slips). Their web UI requires uploading each document one by one. This skill automates the entire workflow:
- List transactions that need documents attached
- Generate missing PDFs (salary slips, client invoices, receipts) from data using Puppeteer
- Upload documents via Osome's internal API (presigned S3 URLs)
- Link documents to transactions and send messages to accounting threads
Prerequisites
- Bun runtime
- A valid Osome account with browser session cookies
- Puppeteer (for PDF generation)
Setup
# Install dependencies
bun install
# Copy env template and add your Osome cookies
cp .env.example .env
# Edit .env — paste cookies from browser DevTools → Network → any Osome request → Cookie header
How to Get Your Cookies
- Log into
my.osome.comin your browser - Open DevTools (
Cmd+Shift+I) → Network tab - Click on any request to
my.osome.com - Copy the
Cookieheader value - Paste into
.envasOSOME_COOKIES
CLI Commands
bun scripts/osome.ts list # List transactions needing documents
bun scripts/osome.ts upload <txId> <file> [-m "msg"] # Upload PDF and link to transaction
bun scripts/osome.ts message <txId> <message> # Send message to transaction thread
bun scripts/osome.ts tx <txId> # Get transaction details
API Reference
All endpoints use https://my.osome.com/api/v2 with session cookie authentication.
List Transactions
GET /roberto/companies/{COMPANY_ID}/transactions?sort=dateDesc&perPage=200&page=1
Filter response for transactionStatus === "documentRequired".
Upload Flow (3 Steps)
Step 1 — Get presigned S3 URL:
POST /companies/{COMPANY_ID}/files/url_for_upload
Body: { filename, size, contentType, checksum (MD5 hex) }
Returns: { uploadUrlInfo: { signedUrl, formData }, file: { url, signedUrl } }
Step 2 — Upload file to S3:
POST {signedUrl from step 1}
Body: FormData with all formData fields from step 1, then file LAST
Important: The file field MUST be appended last in the FormData. S3 presigned POST uploads enforce this ordering.
Step 3 — Create document and link to transaction:
POST /companies/{COMPANY_ID}/documents
Body: {
document: {
attributes: { acTransactionIds: [txId] },
uploadingMethod: "transactionItemPage",
name: filename,
file: { url, signedUrl, name, fileSize, checksum }
}
}
Send Message
POST /conversations/{CONVERSATION_ID}/messages
Body: { message: { text: "your message" } }
PDF Generation
Generate missing invoices/receipts from transaction data using Puppeteer:
bun scripts/generate-salary-pdfs.ts # Salary payment slips
bun scripts/generate-client-invoices.ts # Client invoices
bun scripts/generate-visa-receipt.ts # Visa receipts
Each generator:
- Takes an array of payment data (txId, date, amount, name, etc.)
- Renders an HTML template with inline CSS
- Converts to PDF via
page.pdf({ format: "A4" }) - Outputs a
mapping.jsonlinking{ txId, filename }pairs
Bulk Upload Pattern
for entry in $(cat salary-pdfs/mapping.json | jq -c '.[]'); do
txId=$(echo $entry | jq -r '.txId')
file=$(echo $entry | jq -r '.filename')
bun scripts/osome.ts upload $txId $file -m "Document attached"
done
Project Structure
├── lib/
│ ├── api/
│ │ ├── osome.ts # Core API functions
│ │ ├── upload.ts # S3 upload helper
│ │ └── types.ts # TypeScript interfaces + constants
│ └── utils/
│ └── md5.ts # MD5 checksum (pure JS, RFC 1321)
├── scripts/
│ ├── osome.ts # CLI tool
│ └── generate-*.ts # PDF generators (customize with your data)
├── .env.example # Environment template
└── package.json
Customization
To use this for your own Osome account:
- Update
COMPANY_IDinlib/api/types.tswith your company ID (visible in Osome URLs) - Modify the payment data arrays in
generate-*.tsscripts with your transactions - Customize HTML templates for your company branding
Key Technical Details
- Auth: Session cookies only (no API keys or OAuth)
- Storage: Osome uses S3 in
ap-southeast-1for document storage - File integrity: MD5 checksums required for all uploads
- Rate limits: No observed rate limits, but paginate transactions (200 per page)
- Internal naming: Osome's frontend is called "websome" internally (
x-initiator: websome-transactions@x.x.x)