This Python script migrates signature requests from HelloSign (now Dropbox Sign) to DocuSign, preserving the original sender information by using HelloSign's "Sent By" field as the DocuSign Owner. It supports batch migration with tracking of migration status through a CSV file.
- Complete Migration: Transfers documents, recipients, and metadata from HelloSign to DocuSign
- Owner Preservation: Uses HelloSign's "Sent By" field as DocuSign Owner
- Batch Processing: Migrate multiple signature requests at once
- Progress Tracking: CSV-based tracking of migration status
- Multi-User Support: Migrate documents for multiple users with different HelloSign and DocuSign accounts
- Error Handling: Comprehensive logging and error handling
- Flexible Configuration: Support for both demo and production environments
- HelloSign API Keys: Get API keys for each user from HelloSign API Dashboard
- DocuSign Developer Account: Create an account at DocuSign Developer Center
- DocuSign JWT Authentication: Set up JWT authentication for impersonation
- DocuSign Account IDs: Account identifiers for all users
- User Mapping File: CSV file mapping HelloSign users to DocuSign users
-
Clone or download this project
-
Install dependencies:
pip install -r requirements.txt
-
Copy the environment configuration:
cp .env.example .env
-
Edit
.env
file with your DocuSign configuration:# DocuSign API Configuration DOCUSIGN_BASE_PATH=https://demo.docusign.net/restapi DOCUSIGN_INTEGRATOR_KEY=your_docusign_integrator_key DOCUSIGN_PRIVATE_KEY_FILENAME=docusign_private_key.key DOCUSIGN_ACCOUNT_ID=your_docusign_account_id DOCUSIGN_REDIRECT_URI=your_redirect_uri
-
Create a
User_Mapping.csv
file with the following columns:User_Name,User_Email,HelloSign_User_API_Key,DocuSign_User_ID
-
Set up your environment variables (using .env file)
-
Create User_Mapping.csv with the following format:
User_Name,User_Email,HelloSign_User_API_Key,DocuSign_User_ID John Doe,john@example.com,abc123hellosign_key,1234 Jane Smith,jane@example.com,xyz456hellosign_key,5678
-
Run the migration script:
python main.py
This will:
- Generate the
all_user_migrated_content.csv
file with all signature requests - Process all pending migrations
- Generate the
To only generate the CSV file without performing migrations:
from main import HelloSignClient, MigrationService
# Initialize client with any valid HelloSign API key
hellosign_client = HelloSignClient(api_key)
migration_service = MigrationService(hellosign_client, None)
# Generate the migration CSV
migration_df = migration_service.generate_migration_csv()
print(f"Generated CSV with {len(migration_df)} signature requests")
from main import HelloSignClient, DocuSignClient, MigrationService, get_docusign_access_token
# Get DocuSign access token using JWT
docusign_token = get_docusign_access_token("user@example.com")
# Initialize clients
hellosign_client = HelloSignClient(api_key)
docusign_client = DocuSignClient(docusign_token, account_id, base_url)
migration_service = MigrationService(hellosign_client, docusign_client)
# Migrate single request for specific user
success = migration_service.migrate_signature_request("signature_request_id", "user@example.com")
# Migrate multiple requests for specific user
results = migration_service.migrate_multiple_requests(["id1", "id2"], "user@example.com")
- Base URL:
https://api.hellosign.com/v3
- Authentication: Basic Auth using API key
- Required Permissions: Read signature requests and download files
- Demo Base URL:
https://demo.docusign.net/restapi
- Production Base URL:
https://na1.docusign.net/restapi
(varies by region) - Authentication: Bearer token (OAuth2)
- Required Permissions: Create and send envelopes
- Generate Migration CSV:
- Scans all users' HelloSign accounts
- Creates CSV with all signature requests
- Sets initial status to "Pending"
- Process Migrations:
- Reads CSV file for pending migrations
- For each user, processes their pending migrations:
- Authenticates with both HelloSign and DocuSign
- Fetches and migrates each document
- Updates CSV with status ("Done" or "Failed")
- Provides detailed summary after completion
- Fetch HelloSign Data: Retrieves signature request details and metadata
- Download Documents: Downloads PDF files from HelloSign
- Map Recipients: Converts HelloSign signers to DocuSign recipients
- Create Envelope: Creates new DocuSign envelope with:
- Original document content
- Recipient information
- Email subject and message
- Custom field storing original sender email
- Send Envelope: Automatically sends the envelope to recipients
- Update Status: Records migration result in CSV file
HelloSign Field | DocuSign Field | Notes |
---|---|---|
requester_email_address |
Custom Field: OriginalSender |
Preserves original sender |
title |
Document Name | Document title |
subject |
Email Subject | Email subject line |
message |
Email Blurb | Email message body |
signatures[].signer_email_address |
Recipients Email | Signer email |
signatures[].signer_name |
Recipients Name | Signer name |
signatures[].order |
Routing Order | Signing order |
Field | Description |
---|---|
User_Name |
Name of the user from User_Mapping.csv |
User_Email |
Email of the user from User_Mapping.csv |
signature_request_id |
HelloSign signature request ID |
Migrate_Status |
Migration status (Pending, Done, Failed) |
Timestamp |
Last update timestamp |
The script includes comprehensive error handling:
- API Errors: Logs HTTP errors with response details
- Missing Data: Handles missing or incomplete signature requests
- Network Issues: Retries and proper error reporting
- Validation: Checks for required fields before processing
All operations are logged with timestamps and severity levels:
- INFO: Normal operation progress
- WARNING: Non-critical issues
- ERROR: Failed operations with details
- Environment Variables: Store API keys in environment variables, not in code
- Access Tokens: Use short-lived access tokens when possible
- Network Security: Use HTTPS for all API calls
- Data Handling: Documents are processed in memory and not stored locally
- Document Types: Currently supports PDF documents only
- Signature Positioning: Places signature tabs at default positions
- Custom Fields: Limited to basic text custom fields
- Rate Limits: Subject to API rate limits of both services
-
Authentication Errors:
- Verify HelloSign API keys in User_Mapping.csv
- Check DocuSign JWT configuration
- Ensure DocuSign users have proper permissions
- Verify correct base URLs
-
Document Download Failures:
- Check HelloSign signature request status
- Verify file permissions
- Ensure signature request IDs in the CSV are valid
- Check user has access to the requested document
-
Envelope Creation Failures:
- Validate recipient email addresses
- Check DocuSign account limits
- Verify document format
Enable detailed logging by setting log level to DEBUG:
logging.basicConfig(level=logging.DEBUG)
For issues related to:
- HelloSign API: HelloSign Support
- DocuSign API: DocuSign Developer Support
- This Script: Check the error logs and ensure all prerequisites are met
This project is provided as-is for educational and integration purposes. Please ensure compliance with both HelloSign and DocuSign terms of service when using their APIs.