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
- A WHMCS installation with API access.
- Web server with PHP support.
- API credentials (Identifier and Secret) from WHMCS.
Step 1: Download the Script
- Download the script files and extract them to a directory on your web server.
- Ensure that the directory is accessible via your web server.
Step 2: Configure API Settings
- Open the Configuration Page:
- Navigate to
configure.php
in your browser.
- Navigate to
- 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.
- API URL: The URL to your WHMCS API, typically
- Save Configuration:
- Click the "Update Configuration" button to save your API settings.
Step 3: Prepare the CSV File
- Download the Template:
- A template CSV file can be found in the
template.csv
file included with the script.
- A template CSV file can be found in the
- 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
- Open the Main Form:
- Navigate to
index.php
in your browser.
- Navigate to
- Upload CSV File:
- Select the CSV file with client details.
- 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.
- Submit the Form:
- Click the "Upload and Add Clients" button to process the CSV file and add clients to WHMCS.
Demo Mode
- 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
- 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>
- Edit the
- 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
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.