Skip to main content

Utility classes to interact with CRMs like HubSpot, Salesforce, and Zoho using OAuth 2.0.

Project description

🧩 CRM Connector Suite

Unified Python Clients for Zoho, HubSpot, and Salesforce CRM APIs This repository provides independent Python connectors to interact with popular CRM systems — Zoho, HubSpot, and Salesforce — through a unified, modular interface. Each connector supports OAuth 2.0 authentication, and includes features such as creating, updating, fetching, and exporting leads.


Prerequisites

  • Python 3.11+
  • pip (Python package installer)

2. Create a Virtual Environment (Recommended)

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

🔧 Installation

🧩 Installation Guide This package contains three individual CRM connector modules:

📘 Table of Contents

Each connector is built as a subpackage under the main package connector/. Once installed, you can import and use them independently.


🚀 Features

  • Create new leads
  • Update lead
  • Export all leads to CSV

📂 Project Structure

connector/
├── __init__.py
├── zoho/
│   ├── __init__.py
│   └── client.py                # Zoho CRM connector
├── hubspot/
│   ├── __init__.py
│   └── client.py                # HubSpot CRM connector
├── salesforce/
│   ├── __init__.py
│   └── client.py                # Salesforce CRM connector
├── requirements.txt
├── setup.py                     # Build & packaging configuration
├── script.sh                    # Wheel build and upload automation
├── README.md                    # Combined documentation

⚙️ How to Use / Test Each Connector with .env

You can securely manage your CRM credentials using a .env file in your project root.
This avoids hardcoding sensitive information in your scripts.


🧩 Common Environment Variables

All connectors require these basic credentials:

CLIENT_ID=YOUR_CLIENT_ID
CLIENT_SECRET=YOUR_CLIENT_SECRET
ACCESS_TOKEN=YOUR_ACCESS_TOKEN
REFRESH_TOKEN=YOUR_REFRESH_TOKEN

Additional for Zoho

TOKEN_URL=https://accounts.zoho.in/oauth/v2/token
CRM_API_URL=https://www.zohoapis.in
DOMAIN=zoho.in

Additional for Salesforce

INSTANCE_URL=https://your-instance.salesforce.com

🧩 Usage Examples


Salesforce CRM Connector


Create a New Lead

    "FirstName": "Example",
    "LastName": "Exam",
    "Company": "X-labs Plt",
    "Email": "exam@example.com"}
created_lead = salesforce.create_lead(lead_data)
print(created_lead)

Export All Leads to CSV salesforce.get_all_leads_and_save_csv("all_leads.csv")


HubSpot CRM Connector


Fetch All Leads hubspot.get_all_leads()

Create a New Lead hubspot.create_lead(firstname, lastname, email)

Update an Existing Lead hubspot.update_lead(email, updated_fields={})

Get Lead by Email hubspot.get_lead_by_email(email)

Export Leads to CSV hubspot.export_leads_to_csv(file_name, path)


Zoho CRM Connector


refresh_access_token()

Refreshes the access token using the refresh token.

get_all_leads(per_page=200)

Retrieves all leads from Zoho CRM.

  • per_page (int, optional): The number of leads to retrieve per page. Defaults to 200.

_search_lead(email=None, phone=None)

Searches for a lead by email or phone.

  • email (str, optional): The email of the lead to search for.
  • phone (str, optional): The phone number of the lead to search for.

create_lead(lead_data)

Creates a new lead in Zoho CRM.

  • lead_data (dict): The data for the new lead.

add_note_to_lead(lead_id, note_title, note_content)

Adds a note to an existing lead.

  • lead_id (str): The ID of the lead to add the note to.
  • note_title (str): The title of the note.
  • note_content (str): The content of the note.

add_lead(zoho_data)

Adds a lead to Zoho CRM. If the lead already exists, it adds a note to the existing lead.

  • zoho_data (dict): The data for the lead.

write_leads_to_file(filename="leads.csv")

Writes all leads to a CSV file.

  • filename (str, optional): The name of the file to write the leads to. Defaults to "leads.csv".

generate_leads_csv(leads_data)

Generates CSV data from a list of leads.

  • leads_data (list): A list of lead data dictionaries.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crm_connectors-0.0.1-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file crm_connectors-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: crm_connectors-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for crm_connectors-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a9ca1d8d941be41cec9947e6c59e8ca45e492107c596a87b9bba36caae6e9a0
MD5 c018dd26a44be4cc7f0e61ee12a9b8cf
BLAKE2b-256 b118ef90070c64c22189d435180b3ae331c4705dc485a6b7f2828e794fcc06e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page