Go High Level - Add an appointment into a calendar

Follow

In this article we are going to outline how you can create a appointment in HighLevel from LeadByte and bring to your attention some of the problems.  Please do read this article top down if you are adding an appointment from LeadByte to GHL.  We also have a FAQ section at the bottom.

Delivery Basics
You need a Direct Post delivery with JSON Post as the remote system.  In the URL you will use the following to add an appointment:  https://rest.gohighlevel.com/v1/appointments/  The request payload is JSON, you can use the code below to get started with the structure.  You can copy and paste the example code below into the Payload Builder in the delivery.

{
"firstName": "[firstname]",
"lastName": "[lastname]",
"phone": "[phone1]",
"selectedSlot": "[INSERT]",
"selectedTimezone": "America/New_York",
"calendarId": "[CALENDAR ID FOR THE SPECIFIC CALENDAR HERE]",
"customField": {
"extrafield": "ExtraTest"
}
}


Headers
GHL requires you to pass in your API key, you need to do this under our Custom Headers section.  Example below on how this should look.  You will find your API Key in GHL under Settings > Business Info.

Screenshot_2023-02-09_at_21.29.24.png
The field value is the word "Bearer" followed by the the API key from your GHL account.


Response Codes

To read a successful response from GHL, you should add the success response code as 200 under "Remote System Response" as shown below.

LeadByte_-_Edit_2022-03-25_at_10.37.18_am.jpg

GHL Appointment Fields & Date Format

You need to pass the appointment date/time into the GHL field called "selectedSlot" and you will also need to include the sub account TimeZone; this is passed into the field "selectedTimezone". 

GHL needs to date format to be as follows: YYYY-MM-DDTHH:MM:SS{UTC timezone offset}
For example, for the TimeZone "America/New_York" it would be 2021-08-21T15:00:00-04:00


LeadByte Appointment Field (Important)

Receiving Appointment Date/Time From GHL
If you are receiving data from GHL (typically from a Webhook) you will need to create a Custom Field in your LeadByte Campaign to store the date/time against the lead.  You can create the Custom Field called calendar_startTime and set the Date Type as NONE.  This means, LeadByte will not adjust the format.  

LeadByte_-_Campaign_Fields_2022-03-25_at_10.04.11_am.jpg

The GHL Webhook will pass the calendar start date/time into LeadByte like this:

"calendar_startTime": "2022-02-18T10:00:00",

However, to pass this back into a GHL sub-account it needs to include the timezone. You may have various sub-accounts on different timezones, so this is very important to get right.  Here is an example of how GHL need the date/time with timezone ("America/New_York"):

"calendar_startTime": "2021-08-21T15:00:00-04:00",

You will need to add the the TimeZone as a static value AFTER the LeadByte tag in the JSON Payload Builder.  Here is an example

"selectedSlot": "[calendar_startTime]-04:00",
"selectedTimezone": "America/New_York",


NOT Receiving Appointment Date/Time From GHL
If you have built your own form and are posting lead registration data into LeadByte you can create a Custom Field in your LeadByte Campaign to store the appointment date/time against the lead.  You should select the Data Type as "Date/Time" (as per the image below).  The will be stored in LeadByte as DD/MM/YYYY HH:MM:SSS.  By doing this, you can then transform the date format when sending it to GHL.

Screenshot_2023-02-09_at_21.51.36.png

 

Transforming the date format against the Delivery can be done under "options" within the Delivery field mapping.  For example, if you collect the appointment date/time as DD/MM/YYYY HH:MM:SS you can use the date transform feature to convert into how GHL need it i.e. 2021-08-21T15:00:00-04:00 as per the image below.

Screenshot_2023-02-09_at_21.55.28.png 
GHL Selected Timezone Field
It is super important that this field matches what you have in GHL else you will receive an error on selected timeSlot from GHL.  Make sure this matches what you have in your GHL sub-account. Below is an example when selecting Europe/London taken from GHL.

 "selectedTimezone": "Europe/London",

 

CalendarId
You need this to add an appointment.  This can be taken from the calendar settings on the sub-account.  

IPNET_2022-03-25_at_10.26.40_am.jpg


Test Delivery
It's VERY important you test the Delivery and get a successful response from GHL. Do this by selecting TEST at the bottom of the page. You will need to get a successful response before you can enable the Delivery.

Adding a Contact to GHL
You can find how to add a contact in the following article -  How to add a contact to GHL.  There is a slight variation to the information in the "Add Contact" article if you only want to add a contact only if an appointment has been successfully booked. 

The "Action" for the add contact Delivery will need to be "Manually / via code"
LeadByte_-_Edit_2022-05-06_at_9.53.44_am.jpg 

Once this Delivery has been created go back to the Appointment Booking delivery > scroll down to the section called "Remote System Response" and tick the box that says "On Success, trigger delivery" then select the add contact Delivery you just created.

Again, make sure you test the Delivery before going live.

More information here https://developers.gohighlevel.com

FAQs

Q. The data is not storing against the field, why?
A. If it is a duplicate, it will not store.

Q. The GHL field has "contact" as a prefix i.e. contact.home_owner.  Is this what I should use?
A. No, this is a common mistake.  With the example above it should be home_owner

Q: How do I add multiple appointments into the same slot?
A: You can increase the number of allowed slots on the calendar in GHL.

Screenshot_2022-10-04_at_10.56.13.png

 

NOTE: We are not GHL experts but MAY be able to point you in the right direction if you come across any issues. Alternatively, please reach out to GHL or you can access their API docs here https://public-api.gohighlevel.com/

Was this article helpful?
0 out of 0 found this helpful

Comments