This project provides two key functionalities that extend the GoHighLevel platform:
- Funnel Management: Retrieves a list of all funnels and their steps, displays them in a table, and pushes the data to a Google Sheet with alternating row colors.
- Calendar Slot Management: Retrieves free and booked slots for each calendar and calculates how many free slots are available for each agent in the coming days.
- A GoHighLevel account.
- Access to the GoHighLevel API Marketplace.
- PHP 7.4 or later.
- Composer installed on your system.
- Google Sheets API credentials.
- Log in to the GoHighLevel API Marketplace.
- Create a new application.
- Define the required scopes.
- Generate the
Client ID
andClient Secret
. - Add a
Redirect URI
. Use a placeholder like:- Redirect URI:
https://your_redirect_uri.com
- Redirect URI:
-
Open the
ghl_api_conf.php
file. -
Replace the placeholders with your actual credentials:
$client_id = 'your_client_id'; $client_secret = 'your_client_secret'; $redirect_uri = 'your_redirect_uri'; $scope = 'XXXXXXXX'; $g_client->setAccessToken('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); $slots = get_slots_for_calendar('XXXXXXXXXXXXXXXXXXXX', $access_token, $locationID); $sheet_ID = 'XXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXX'; $sheet_name = "the_sheet_name";
-
Place the
refresh_token.php
script in a cron job to refresh tokens automatically. Access token expires ins 24 hours.
- Open
credentials_placeholder.json
. - Replace the placeholders with your Google Sheets API credentials.
- Share your Google Sheet with the email address provided in the Google Sheets API console.
- Update the script with the following details:
- Sheet URL
- Sheet name
- Navigate to the project directory.
- Run the following commands:
composer install composer update
-
Funnel Management: Run
funnels_complete.php
to retrieve funnel data and push it to Google Sheets. -
Calendar Slot Management: Run
calendars_slots.php
to retrieve free and booked slots and push them to Google Sheets.
ghl_api_conf.php
: Configuration file for GoHighLevel API.refresh_token.php
: Script to refresh API tokens.credentials_placeholder.json
: Placeholder for Google Sheets API credentials.tokens_placeholder.json
: Placeholder for storing tokens.funnels_complete.php
: Script for funnel management.calendars_slots.php
: Script for calendar slot management.composer.json
andcomposer.lock
: Dependency management files.
- Ensure your server supports cron jobs for token refresh.
- Make sure Google Sheets API is enabled and credentials are correctly set.
For more details on GoHighLevel API, refer to their official documentation.
For more details on how to generate Google Sheet API credentials, follow this guide: https://materialplus.srijan.net/resources/blog/integrating-google-sheets-with-php-is-this-easy-know-how