bel-download-file-from-crm-db

Download base64-encoded files from a PostgreSQL CRM database to the local filesystem.

2|Updated Oct 22, 2025
One-click install
npx skills add https://github.com/bennoloeffler/bassi --skill bel-download-file-from-crm-db
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: bel-download-file-from-crm-db
Source: https://github.com/bennoloeffler/bassi/tree/main/.claude/skills/bel-download-file-from-crm-db
Command: npx skills add https://github.com/bennoloeffler/bassi --skill bel-download-file-from-crm-db

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires psycopg2-binary, and includes scripts (resource) components.

What problem does it solve?

Retrieves files stored in the CRM database and saves them to the filesystem for easy viewing and sharing.

Core Features & Use Cases

  • Database pull: fetch file data by ID.
  • Filesystem export: saves to _RESULTS_FROM_AGENT/ with unique naming.
  • Integration: works with bel-open-file to preview results.

Quick Start

python3 scripts/download_file_from_db.py <file_id>

Frequently Asked Questions about bel-download-file-from-crm-db

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I download files from a PostgreSQL CRM database to my local disk?▼

Download files from a CRM database by connecting via PostgreSQL credentials, retrieving base64-encoded file data by file_id, decoding it, and saving to the local filesystem with sanitized filenames and collision handling.

Can I export CRM attachments and documents linked to records like contracts or PDFs?▼

Yes, you can retrieve attachments and documents linked to CRM records through file junctions (company_site_file, person_file, event_file, sales_opportunity_file), then export them as individual files with metadata like name, MIME type, size, and hash.

What database setup do I need to download CRM files with psycopg2?▼

You need PostgreSQL credentials configured via environment variables, psycopg2-binary installed, access to the CRM database schema including the file table and junction tables, and write permissions to the output directory.

How do I handle filename collisions when exporting multiple CRM files?▼

The Skill automatically handles name collisions by generating unique filenames during export to _RESULTS_FROM_AGENT/, ensuring no files are overwritten and all exported files remain accessible.

What metadata does the CRM file download expose for downstream processing?▼

File metadata including name, MIME type, file size, hash, and timestamps are exposed and can be passed to downstream agents like bel-open-file or bel-show-crm-file for preview or further analysis.

Can I batch download multiple files from the CRM database in one operation?▼

The Skill is designed to retrieve individual files by file_id; for batch operations, you would iterate over multiple file IDs or use junction tables to identify all files linked to a record type before exporting each.