FXiaoke CRM CLI - Sync leads from JSON/CSV files
Project description
CRM CLI
A minimal CLI that reads leads from JSON/CSV files and syncs them to FXiaoke CRM (纷享销客).
Installation
Requires UV (fast Python package manager).
# Install UV (if not already installed)
brew install uv
# Clone and sync dependencies
git clone https://github.com/thaddeus-git/crm-cli.git
cd crm-cli
uv sync
Quick Start
# Sync leads from JSON file
uv run crm sync leads.json
# Preview without creating (dry run)
uv run crm sync leads.csv --dry-run
# Assign to specific owner (FSUID format)
uv run crm sync leads.json --owner FSUID_xxx
uv run crm sync leads.json --assign FSUID_xxx # --assign is an alias for --owner
# Override lead pool (skip automatic routing)
uv run crm sync leads.json --pool 643d87b17be47e0a000190a715
# Combine flags
uv run crm sync leads.json --assign FSUID_xxx --pool 643d87cda34e0a0001336093
User Lookup
Lookup CRM users by mobile number or list all users to find FSUIDs for assignment:
# Lookup user by mobile number
uv run crm lookup --mobile 18102106041
# List all users (paginated)
uv run crm lookup --list-all
# List with custom page size
uv run crm lookup --list-all --page-size 500
Example Output
✓ User found:
Name: 王雨檬
FSUID: FSUID_4CF6AD1011C941AE32545CCC409CFD50
Mobile: 18102106041
Email: wangyumeng3@orionstar.com
Status: NORMAL
Using the FSUID
Once you have the FSUID, use it with the --assign flag when syncing leads:
uv run crm sync leads.json --assign FSUID_4CF6AD1011C941AE32545CCC409CFD50
Note: Store the default assignee FSUID in your shell profile or environment for convenience:
export CRM_DEFAULT_ASSIGNEE_FSUID="FSUID_4CF6AD1011C941AE32545CCC409CFD50"
uv run crm sync leads.json --assign $CRM_DEFAULT_ASSIGNEE_FSUID
Input Format
JSON
[
{
"company": "Acme Corp",
"email": "contact@acme.com",
"phone": "+44 123 456 7890",
"country": "GB",
"source_id": "optional-external-id"
}
]
CSV
company,email,phone,country,source_id
Acme Corp,contact@acme.com,+44 123 456 7890,GB,optional-external-id
Fields
| Field | Required | Description |
|---|---|---|
company |
Yes | Company name |
email |
No | Email address |
phone |
No | Phone number (any format, cleaned automatically) |
country |
No | ISO 2-letter code (GB, DE, CN, etc.) for region/pool routing |
source_id |
No | External reference ID for logging |
Configuration
Set environment variables:
export CRM_APP_ID="FSAID_xxx"
export CRM_APP_SECRET="xxx"
export CRM_PERMANENT_CODE="xxx"
export CRM_USER_MOBILE="19957895939" # Optional, for user ID lookup
Behavior
- Duplicates: Skip with warning, continue with remaining leads
- Output: Stdout only - progress and summary printed to terminal
- Region routing: Automatic based on country code
- Europe (GB, DE, FR, etc.) → 欧洲线索公海池
- Asia (CN, JP, KR, etc.) → 亚洲线索公海池
Lead Pools
| Pool | ID | Countries |
|---|---|---|
| 欧洲线索公海池 | 643d87b17be47e0a000190a715 |
GB, DE, FR, IT, ES, NL, etc. |
| 亚洲线索公海池 | 643d87cda34e0a0001336093 |
CN, JP, KR, TH, VN, etc. |
| 日本线索池 | 6464a6451a3c2c0001c12369 |
JP (special routing) |
Use --pool to override automatic routing.
Owner Assignment
The --owner or --assign flag accepts an FSUID (e.g., FSUID_C3F0FA243B2B385385D570C8968C8AB3).
Note: The API requires FSUID format. Employee IDs like empid-1079 are not directly compatible - you need to find the corresponding FSUID from the CRM user management interface.
Development
# Run tests
uv run python -m unittest discover tests/
# Run CLI
uv run crm sync --help
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crm_cli-0.2.0.tar.gz.
File metadata
- Download URL: crm_cli-0.2.0.tar.gz
- Upload date:
- Size: 61.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07fbcd4af5826e3ba0a5d08e7aab2e3f6991d6b765d32214789ff7e6b4f982f9
|
|
| MD5 |
1d3067d5e13be22adca3bdbfc2963544
|
|
| BLAKE2b-256 |
fdc516c22d40130eb64394054e7766d691354f8a71b85833485dcf0efd62cf8a
|
File details
Details for the file crm_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: crm_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b799f34dee20ba0a7b91443312e240eaa11347c317ec1cf480e3756c8427fb0
|
|
| MD5 |
ad429bf49d9d27ed58124fc936d21714
|
|
| BLAKE2b-256 |
27148dbe314a4ed1602068adc7f95fb20e8a19f20a6703f9b296ef0b42376038
|