ghl-sdk v1.1.6
GoHighLevel SDK for JavaScript
Installation
npm install ghl-sdk
yarn add ghl-sdk
pnpm add ghl-sdk
Overview
The library is organized into distinct client modules — each responsible for a specific set of API interactions aligned with the structure described in official GHL API documentation. For example, the OAuthClient
handles authentication and token management, while the LocationsClient
encapsulates the location-specific endpoints. Both type definitions and retry logic are included. The pagination should be considered separately for each particular method and use case as there is no consistency across different modules of the underlying GHL API.
Quick Start
import { OAuthClient, LocationsClient, FormsClient } from 'ghl-sdk';
// Replace this with your own valid GHL credentials
const client_id = '64720d51b50eb849194247ce-lzdnsr6z';
const client_secret = '5060d220-a031-4f39-9cr0-0424e08ffba5';
const grant_type = 'authorization_code';
const user_type = 'Location';
const code = '86b68a0da12ba59f9a85abf2f5bafde171321bdd';
const locationId = 've9EPM428h8vShlRW1KT';
// Exchange OAuth code for access token
const oauthClient = new OAuthClient();
const { access_token } = await oauthClient.getAccessToken({
client_id,
client_secret,
grant_type,
user_type,
code,
});
// Fetch location details
const locationsClient = new LocationsClient(accessToken);
const { location } = await locationsClient.findById(locationId);
console.log(location.name);
// Fetch the available forms for location
const formsClient = new FormsClient(accessToken);
const { forms, total } = await formsClient.find({ locationId, limit: 100 });
console.log(`Fetched ${forms.length} forms out of ${total}`);
Client Modules
Here's the list of all available client modules and their methods in relation to the official GoHighLevel API documentation. All the type definition details can be found on the auto-generated typedoc pages.
BlogsClient
Client Method | API Documentation Reference |
---|---|
findAuthors | Get All Authors |
findCategories | Get All Categories |
checkSlug | Check Url Slug |
create | Create Blog Post |
update | Update Blog Post |
BusinessesClient
Client Method | API Documentation Reference |
---|---|
findByLocation | Get Businesses By Location |
findById | Get Business |
create | Create Business |
update | Update Business |
remove | Delete Business |
CalendarsClient
CampaignsClient
Client Method | API Documentation Reference |
---|---|
find | Get Campaigns |
CompaniesClient
Client Method | API Documentation Reference |
---|---|
findById | Get Company |
ContactsClient
Client Method | API Documentation Reference |
---|---|
findById | Get Contact |
update | Update Contact |
remove | Delete Contact |
upsert | Upsert Contact |
findByBusiness | Get Contacts By BusinessId |
create | Create Contact |
find | Get Contacts |
findTasks | Get All Tasks |
createTask | Create Task |
findTaskById | Get Task |
updateTask | Update Task |
removeTask | Delete Task |
updateTaskStatus | Update Task Completed |
findAppointments | Get Appointments For Contact |
addTags | Add Tags |
removeTags | Remove Tags |
findNotes | Get All Notes |
createNote | Create Notes |
findNoteById | Get Note |
updateNote | Get Note |
removeNote | Delete Note |
addToCampaign | Add Contact To Campaign |
removeFromCampaign | Remove Contact From Campaign |
removeFromEveryCampaign | Remove Contact From Every Campaign |
addToWorkflow | Add Contact To Workflow |
addRemoveFromBusiness | Add/Remove Contacts From Business |
search | Search Contacts |
findDuplicates | Get Duplicate Contact |
addFollowers | Add Followers |
removeFollowers | Remove Followers |
ConversationsClient
Client Method | API Documentation Reference |
---|---|
findById | Get Conversation |
update | Update Conversation |
remove | Delete Conversation |
create | Create Conversation |
search | Search Conversations |
findEmailById | Get Email By Id |
cancelScheduledEmail | Cancel A Scheduled Email Message |
findMessageById | Get Message By Message Id |
findMessagesByConversationId | Get Messages By Conversation Id |
sendMessage | Send A New Message |
addInboundMessage | Add An Inbound Message |
addOutboundMessage | Add An External Outbound Call |
cancelScheduledMessage | Cancel A Scheduled Message |
uploadFileAttachments | Upload File Attachments |
updateMessageStatus | Update Message Status |
findMessageRecording | Get Recording By Message ID |
findMessageTranscription | Get Transcription By Message ID |
downloadMessageTranscription | Download Transcription By Message ID |
CoursesClient
Client Method | API Documentation Reference |
---|---|
import | Import Courses |
CustomFieldsClient
Client Method | API Documentation Reference |
---|---|
findById | Get Custom Field / Folder By Id |
update | Update Custom Field By Id |
remove | Delete Custom Field By Id |
findByObjectKey | Get Custom Fields By Object Key |
createFolder | Create Custom Field Folder |
updateFolder | Update Custom Field Folder Name |
removeFolder | Delete Custom Field Folder |
create | Create Custom Field |
CustomMenusClient
Client Method | API Documentation Reference |
---|---|
findById | Get Custom Menu Link |
remove | Delete Custom Menu Link |
update | Update Custom Menu Link |
find | Get Custom Menu Links |
create | Create Custom Menu Link |
EmailsClient
Client Method | API Documentation Reference |
---|---|
create | Create A New Template |
find | Fetch Email Templates |
remove | Delete A Template |
update | Update A Template |
FormsClient
Client Method | API Documentation Reference |
---|---|
find | Get Forms |
updloadCustomFiles | Upload Files To Custom Fields |
findSubmissions | Get Forms Submissions |
FunnelsClient
Client Method | API Documentation Reference |
---|---|
findFunnels | Fetch List Of Funnels |
findPages | Fetch List Of Funnel Pages |
countPages | Fetch Count Of Funnel Pages |
createRedirect | Create Redirect |
updateRedirect | Update Redirect By Id |
removeRedirect | Delete Redirect By Id |
findRedirects | Fetch List Of Redirects |
InvoicesClient
Client Method | API Documentation Reference |
---|---|
generateInvoiceNumber | Generate Invoice Number |
findById | Get Invoice |
update | Update Invoice |
remove | Delete Invoice |
voidById | Void Invoice |
send | Send Invoice |
recordPayment | Record A Manual Payment For An Invoice |
create | Create Invoice |
find | List Invoices |
createTemplate | Create Template |
findTemplates | List Templates |
findTemplateById | Get An Template |
updateTemplate | Update Template |
removeTemplate | Delete Template |
createSchedule | Create Invoice Schedule |
findSchedules | List Schedules |
findScheduleById | Get An Schedule |
updateSchedule | Update Schedule |
removeSchedule | Delete Schedule |
createScheduledInvoice | Schedule An Schedule Invoice |
manageAutoPayment | Manage Auto payment For An Schedule Invoice |
cancelScheduledInvoice | Cancel An Scheduled Invoice |
createText2Pay | Create & Send |
LCEmailClient
Client Method | API Documentation Reference |
---|---|
verify | Email Verification |
LinksClient
Client Method | API Documentation Reference |
---|---|
update | Update Link |
remove | Delete Link |
find | Get Links |
create | Create Link |
LocationsClient
Client Method | API Documentation Reference |
---|---|
findById | Get Sub-Account (Formerly Location) |
update | Put Sub-Account (Formerly Location) |
remove | Delete Sub-Account (Formerly Location) |
create | Create Sub-Account (Formerly Location) |
search | Search |
findCustomFields | Get Custom Fields |
createCustomField | Create Custom Field |
findCustomFieldById | Get Custom Field |
updateCustomField | Update Custom Field |
removeCustomField | Delete Custom Field |
uploadCustomFieldFile | Uploads File to customFields |
findCustomValues | Get Custom Values |
createCustomValue | Create Custom Value |
findCustomValueById | Get Custom Value |
updateCustomValue | Update Custom Value |
removeCustomValue | Delete Custom Value |
findTemplates | GET all or email/sms templates |
removeTemplate | DELETE an email/sms template |
findTags | Get Tags |
createTag | Create Tag |
findTagById | Get Tag By Id |
updateTag | Update Tag |
removeTag | Delete Tag |
searchTasks | Task Search Filter |
findTimezones | Fetch Timezones |
MediaClient
Client Method | API Documentation Reference |
---|---|
findFiles | Get List Of Files |
uploadFile | Upload File Into Media Library |
deleteFile | Delete File Or Folder |
OAuthClient
Client Method | API Documentation Reference |
---|---|
getAccessToken | Get Access Token |
findInstalledLocations | Get Locations Where App Is Installed |
getLocationToken | Get Location Access Token From Agency Token |
ObjectsClient
Client Method | API Documentation Reference |
---|---|
findByKey | Get Object Schema By Key / Id |
updateByKey | Update Object Schema By Key / Id |
findByLocation | Get All Objects For A Location |
create | Create Custom Object |
findRecordById | Get Record By Id |
updateRecord | Update Record |
deleteRecord | Delete Record |
createRecord | Create Record |
searchRecords | Search Object Records |
OpportunitiesClient
Client Method | API Documentation Reference |
---|---|
findById | Get Opportunity |
remove | Delete Opportunity |
update | Update Opportunity |
updateStatus | Update Opportunity Status |
upsert | Upsert Opportunity |
create | Create Opportunity |
search | Search Opportunity |
findPipelines | Get Pipelines |
addFollowers | Add Followers |
removeFollowers | Remove Followers |
PaymentsClient
Client Method | API Documentation Reference |
---|---|
createWhiteLabelIntegrationProvider | Create White-label Integration Provider |
findWhiteLabelIntegrationProviders | List White-label Integration Providers |
findOrders | List Orders |
findOrderById | Get Order by ID |
createOrderFullfillment | Create Order Fulfillment |
findOrderFullfillments | List Fulfillment |
findTransactions | List Transactions |
findTransactionById | Get Transaction by ID |
findSubscriptions | List Subscriptions |
findSubscriptionById | Get Subscription by ID |
createCustomIntegrationProvider | Create New Integration |
removeCustomIntegrationProvider | Deleting An Existing Integration |
findCustomIntegrationConnection | Fetch Given Provider Config |
connectCustomIntegration | Create New Provider Config |
disconnectCustomIntegration | Disconnect Existing Provider Config |
ProductsClient
Client Method | API Documentation Reference |
---|---|
findById | Get Product By ID |
remove | Delete Product By ID |
update | Update Product By ID |
create | Create Product |
find | List Products |
createPrice | Create Price For A Product |
findPrices | List Prices For A Product |
findPriceById | Get Price By ID For A Product |
updatePrice | Update Price By ID For A Product |
removePrice | Delete Price By ID For A Product |
SaasClient
Client Method | API Documentation Reference |
---|---|
findLocations | Get Locations By StripeId With CompanyId |
update | Update SaaS Subscription |
bulkDisable | Disable SaaS For Locations |
enable | Enable SaaS For Location |
pause | Pause Location |
updateRebilling | Update Rebilling |
SnapshotsClient
Client Method | API Documentation Reference |
---|---|
find | Get Snapshots |
createShareLink | Create Snapshot Share Link |
findPushBetweenDates | Get Snapshot Push Between Dates |
findLastPushByLocationId | Get Last Snapshot Push |
SurveysClient
Client Method | API Documentation Reference |
---|---|
find | Get Surveys |
findSubmissions | Get Surveys Submissions |
UsersClient
Client Method | API Documentation Reference |
---|---|
findById | Get User |
update | Update User |
remove | Remove User |
findByLocation | Get User By Location |
create | Create User |
search | Search Users |
WorkflowsClient
Client Method | API Documentation Reference |
---|---|
findByLocationId | Get Workflow |