Configure the WHMCS Bulk Client Import Script

Overview

This guide will walk you through the steps to configure and use the WHMCS API Configuration Script for bulk adding clients using a CSV file.

Prerequisites

  1. A WHMCS installation with API access.
  2. Web server with PHP support.
  3. API credentials (Identifier and Secret) from WHMCS.

Step 1: Download the Script

  1. Download the script files and extract them to a directory on your web server.
  2. Ensure that the directory is accessible via your web server.

Step 2: Configure API Settings

  1. Open the Configuration Page:
    • Navigate to configure.php in your browser.
  2. Enter API Credentials:
    • API URL: The URL to your WHMCS API, typically https://your-whmcs-url.com/includes/api.php.
    • API Identifier: Your WHMCS API identifier.
    • API Secret: Your WHMCS API secret.
  3. Save Configuration:
    • Click the "Update Configuration" button to save your API settings.

Step 3: Prepare the CSV File

  1. Download the Template:
    • A template CSV file can be found in the template.csv file included with the script.
  2. Format Your CSV File:
    • Ensure your CSV file follows the same format as the template.
    • Required fields: First Name, Last Name, Email, Address, City, State, Postcode, Country, Phone Number, Password.
    • Optional fields: Client Group ID, Marketing Opt-In, Language.

Step 4: Upload and Add Clients

  1. Open the Main Form:
    • Navigate to index.php in your browser.
  2. Upload CSV File:
    • Select the CSV file with client details.
  3. Optional Settings:
    • Send Welcome Email: Check if you want to send a welcome email to new clients.
    • Marketing Opt-In: Check if clients should opt-in to marketing emails.
    • Select Language: Choose the default language for the clients.
    • Client Group: Choose a client group to assign to the clients.
  4. Submit the Form:
    • Click the "Upload and Add Clients" button to process the CSV file and add clients to WHMCS.

Demo Mode

  1. Test in Demo Mode:
    • Before going live, you can test the script in demo mode to see how it works without actually adding clients.
    • The form submission will redirect to demo.php, displaying a demo message and an ad space.

Security Settings

  1. IP Whitelisting:
    • Edit the .htaccess file to restrict access to specific IP addresses.
    • Uncomment and update the <Limit> block:

      <Limit GET POST> order deny,allow deny from all allow from <YOUR_IP_ADDRESS> </Limit>
  2. Password Protection:
    • Protect the configuration page with basic authentication.
    • Use an online tool to generate a password hash.
    • Create a .htpasswd file and add the username and hashed password.
    • Update the .htaccess file to point to your .htpasswd file:

      AuthType Basic AuthName "Restricted Area" AuthBasicProvider file AuthUserFile /path/to/.htpasswd Require valid-user

Troubleshooting

  1. Common Issues:

    • cURL Errors: Ensure the API URL is correct and accessible from your server.
    • Authentication Errors: Verify the API credentials (Identifier and Secret) are correct.
    • CSV Format Errors: Ensure the CSV file is properly formatted according to the template.