How to use the GoHighLevel API v2 | Complete Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Theo high level API version 2 I swear I have barely spent that much time on an API integration in the past couple of years as this one literally took me days until we finally had a solution for the problems we fac and this even happens to me and I built literally over 3 400 Integrations for my very own product so it's not surprising that there are so many people inside of my comments and as well inside of our agency not really knowing how the heck to set this thing up so this whole video is an attempt of everything I learned so far and show you an actual setup that works that you literally can Implement into your business with a go high level API version two with features that are not supported by other platforms like me.com cuz obviously that would be way too easy and I really hope this shortens the amount of time you need to spend on integrating their API with your very own business to give you a little bit more of information what we are going to do now and how I actually came up with that I'm going to explain you a little bit why I needed that in the first place cuz inside of my agency we are building voice AI agents that are able to schedule meetings that view availability Etc and if you know with go high level the old API is basically deprecated it gets removed so we have to use V2 and inside of V2 if we look over here to the highle lead connector you can scroll through all of those actions there will not be a single one that supports calendars even though the IPI supports it so basically with their integration we cannot really set it up cuz it doesn't support it so the only option we have is we need to set up something by ourselves right so I've tried everything I literally set it up by custom code to figure out how the the whole logic in the back end works and I actually managed to get that to work and then I kind of translated that into make.com so now we have a solution that literally only uses make.com that creates that whole authentication workflow and for your luck like I like to share templates you will get access to that whole setup completely for free this is literally knowledge for the past couple of weeks for me boil down in a single template you get it without any costs directly insert of my resource app so simply head over to h. indra.com download your template and you can follow me along the screen while actually watching me build it and you have everything available there so you can look into more details if you want to while watching it also definitely grab yourself a coffee or another drink cuz this is going to be a longer one since I literally cover everything that you need to know to understand how you can actually Leverage The go high level API version 2 I'd also like to mention that you don't need to be a developer and you don't need to understand code cuz everything is going to be in a visual no code Builder I would try to explain some more technical aspects like authentication with apis in a visual way but if you don't even know what an API is it probably makes sense to watch one of my other videos that is linked up here which we where I'm explaining more about the difference of web Hooks and apis what it is and how they work etc so you will find tons of content about that on my channel as well so if you're ready let's dive right into it to show you the complete setup from beginning to end I'm going to prepare an example that was actually the case inside of my company like I mentioned we basically wanted to fetch a calendar and find the availability in that calendar for that agent or that user that is that is interacting with it I'm going to use a similar example to demonstrate that whole functional cuz this is literally covering most of it what we need for authenticating with a V2 API so that you can leverage that for mostly any kind of other endpoints that you would like to get started let's head right over to the screen as you can see I'm currently on the make.com go high Lev page cuz that's the one I showed you earlier and there is literally no endpoint for a calendar booking and I can also just search for calendar and you can see it only finds the Google Calendar integration but literally nothing else so go high level by default doesn't integrate with a calendar which is a massive issue and I promise you it's not the only one there are tons on tons of different API endpoints that are not available right within here and I'm going to show you that by simply heading over to the high level API there's that page in the support portal which you can find here with the API V2 dos or you can also simply head over to their Spotlight which is their documentation for the API so by simply clicking on the Integrations API you can see down here that you have tons and tons of end points for a lot of different objectives inside of go high level and as you can see there are definitely more than the ones that that make.com offers but there is another one that's interesting it's called make an API call and I've tried it but I can already tell you now that this one also only works for a small percentage of all the end points available why this is the case I'm going to go into it in a bit but for now let's just acknowledge the fact that make.com by itself with a standard integration is just not enough to make things work with go high level V2 now to actually set things up we need something called a custom app which you can create directly inside of the marketplace of go high level so if you don't know where it's located you simply Google for go high Lev Marketplace and you will find something like this where it says marketplace. gooh High l.com and we are now inside an app dashboard and you can see I have a bunch of apps down here which you probably don't cuz you I assume you probably sign up the first time especially if you're not a developer cuz this portal is intended for developers like I mentioned promise you don't need to write any code we're just going to go through this whole thing visually and you can literally set it up without writing anything so it's super super simple but you need to understand the core concept uh behind go high level so that you understand actually what you need to configure when setting up the app to actually set up the app we're going to do what we should always do just click on the create up button up here then we can give this whole thing an app name I'm just going to call it ghl app test obviously you would name it the way you would like to name your app you can probably just name it as your company name so you have the app inside of your company name and you're good to go the app type should be private if you want to make it public the app will basically be available inside of the go high level Marketplace which is nice if you're building a product but if you like me and you just want to use this whole app inside of your business for your very own clients I suggest you not to do it cuz it's a big pain in the because every time you want to change permissions they need to be reviewed by the go high Lev team which can take days and it's just a big hassle it pushes you back so I just don't recommend it simply start with a private app it's the easiest way especially when you want to use it directly inside of your business then we have the distribution type which is which you can either set for agency sub account or what I like to do is just set it to both which is is just a thing about permissions which of the API endpoints have permission to what so if you just have an agency account and you literally just want to automate parts inside of your agency account so not with a sub accounts you can simply set it up to agency if you are planning just to use sub accounts then you only set it up to sub accounts this makes a difference when you authenticate people through the authentication process later on down the line and I'm going to show you also how this looks like if they customers are just interacting with your own page it doesn't really matter you can just structure that inside of a documentation so in my my case or as well as how I see it and personally like to do it I'll just set both of them because in the end I can just I don't need to set up two different apps for getting this whole thing working I can just have one apps and I can just Define it inside of my documentation or my Sops for my very own teammates then lastly is another very important one that you definitely should look into it's the listing types and you can stand it set it to White Label or standard non-white label I would always suggest to leave it at White Label because it supports everything you can also see that by clicking here on learn more and once the documentation loads you can see here the two different types you can obviously read through all of that I did that many many times but this is probably the most important part which says white label apps are visible at the agency and subacc account levels under both white label and nonwhite label domains so it supports everything which is exactly what we want you always want to reduce headache when building those apps especially if you have never done it before it just saves you a lot of time that's exactly why we keep this at White Label and all I'm going to do now is I click on create app and tell taada now we have created our very first app and now we are going to do something that's a little bit more complex but it's super relevant especially when to work with API because you need to define a scope a scope is nothing else than a certain part of permission that you would like the app to have access to which permissions then are also used for whatever you want to do with a user that authenticated inside of the app let's assume you're like me and you would like to use the calendar of a sub account directly inside of go high level in that case we would need to add calendar permissions to do that what you need to do is you click here on the select Scopes and you search for calendar and as you can see here you have a massive selection of different kind of properties or permissions that you can select for this app so since I would like to interact with a calendar and maybe schedule meetings and maybe view bookings and stuff like that what I can do is I can basically just set it to calendar read only and maybe even Calendar's right if I want to see the exact events I can also select more here like events read only events WR etc for the example of this video I'll try to keep it very simple so I'm only going to add the calendar read only and calendar right CU for me I want to show you how this app works without much friction so that you get an understanding of it so this is enough for now obviously if you would like to your app to have access to more features you can select them down here from the list and there is another very important thing that I would like to mention so when we are heading back to the documentation of go high level and you can scroll to the top you'll find another menu item called Scopes and when we head over to Scopes you can see a massive list of all of the end points that are available with a given scope this looks kind of useless in the beginning cuz we have them anyways in the menu item but there is a very very important difference because depending on the account you own you have access to certain of those Scopes so not all of those Scopes are available with the plan that you have in most cases so if you run on the smaller go high level plan you will have access to all of the endpoints that have the access type sub which is great which is the majority of all of those as you can see here but there are some like if we are looking here the locations. right which is only available for companies and the company access type is only available for the bigger plan of go high level on the company level and not on the location level or the sub account level so in that case you would need to upgrade to a bigger plan if you would use if if you would like to use something like the location endpoints but as you can see for the most for the majority of it sub account is also available so you don't need to worry as well as here as you can see we have location stre only which can also be part of both so in that case still the sub account is most likely efficient if you don't want to deal with them on a company level I found that a super important information cuz that alone took me ages to figure out because I had so many permission issues while setting up this whole app so definitely make sure that the end points and the permissions you set definitely match with the plan that you have if you have a smaller plan stick to the sub account if you have a bigger plan you don't need to worry about it so with that out of the way let's head back into our marketplace where we are creating our app so we have set Now calendar read only calendar right and there is another one that I would like you to set in in any case cuz we're going to need it for our Automation and this one is called location. readon and if we are looking now back into the documentation under Scopes locations. readon you can see that this one also is available on sub account accounts and Company accounts so whatever plan you use this automation will work for you and I'm going to tell you in a bit as well why this one is important for now let's just add it here the web hooks we basically don't need to add right now web hooks is basically whenever something happens inside of go high level that you are notified by the book you can set it up and then you need to provide a URL Etc and you can automate that part as well since we would just like to interact with the API and we would actually like to access information on go high level we don't need to set it up in that example now when we scroll down past the Scopes in the web hooks you can find another field which is the redirect URLs and this one is just as important this one is going to be also a bit more complex you don't need to research anything I'm going to provide you what you need to add there cuz we are integrating it directly with me.com which automatically takes care of providing redirect ues with in an O authentication flow 2.0 so all you would need to do is you need to click in the redirect URL field and you add this URL which is also shown in the screen and it is also mentioned inside of my resource sub so you canly simply copy it and then click here on the add button now as you can see here it is added this URL by the way is directly from make.com even though it says integromat if you don't know about it make.com was named or branded integromat before it became make.com this was a couple of years ago they just changed it and rebranded once they have been bought by salonis salonis basic the parent company and it was part of their rebranding structure so don't don't be confused why there's written integromat it is something they're working on but for now this oo callback that we need to use is still hosted on the integromat domain instead of the make.com domain by the way if you scroll through their documentation you will also find out about that all right once we've added that we simply scroll down to the client Keys which is where we need to define a couple of keys that we then need to use directly inside of our make.com scenario we definitely have to create those credentials and it is also important to mention that you need to pre-save them somewhere cuz once you click okay they are gone cuz for security reasons and stuff like that so all we do is we click on ADD we're going to give this whole thing a name so you would probably call it something like your company name so I call it inte gradicus credentials and I'm going to click on ADD and now you can see that we are basically creating a client ID and a client secret make sure to not share those with anyone in my case it doesn't matter cuz this is a demo account that literally just this for this video so I can demonstrate you the whole setup without hiding anything so that you get a better understanding of it all I'm going to do now is I'll copy the client ID I'll paste it into an empty editor and I do the exact same thing with a client secret just going to head it to the notep right here and we just need to keep them for now because we need to use them directly inside of my our make.com scenario once we reach that part now heading back to the marketplace we can click okay and once I click okay you will see that all of those are gone and I cannot see the client secret anymore it will just not be available anymore so if you have not not copied it your mistake simply delete it and create a new one we do not need to provide a web hook URL for now cuz like we mentioned we don't want to set up web hooks right now because web hooks is very simple it literally just informs us on a specific event that happens directly inside of go high level we also don't need to set any single sign on and the last part is for deleting the app which is obviously also not what we would like to do and honestly most of those kind of side menus or the menu items down here we don't even need to use for the basic setup this is literally all we need now now we're going to click on Save and once this whole app has been saved we still need to scroll down to the redirect URL and we need to activate it right here and clicking another time on save so congratulations this is literally all you need to get a basic app setup directly inside of the marketplace of go high level we have configured it now as you can see here for the calendar read only calendar right and the locations read only permissions which is all we need for this specific example again if you would like to have access to different features directly inside of the API it is important that you select the right permission here which you can also compare to the endpoints inside of their documentation under the Scopes so that was the easy part let's head now to the make.com scenario CU that is where we probably going to spend most of the time so I've already prepared a scenario right here it is an empty one this is where we are basically creating that whole setup so that we can then leverage that to make authentications to the API and to access it I definitely have to mention that this setup works out of the box but I 100% suggest you you to optimize it even further so that you can store the temporary exess tokens that are generated through the API key in a table or maybe in your very own CRM wherever you need them so that you can access them at any given point without regenerating them over and over again if that doesn't make sense what I just said right now just stick with me if you know very good I will anyway show you that whole thing at the end I just wanted to mention it upfront cuz this scenario Works in theory and works practically as well but if you want to get the most out of it you have to make a small a couple of small adjustments along the way just to not run into kind of rate limit issues if you really start scaling this thing up all right you would obviously have some kind of scenario setup where you would basically like to interact with the API in a lot of cases that's probably going to be something like a web hook endpoint that you can add with web Hooks and then the custom web hook in my case I'm literally just going to start with the tools CU we don't have anything else to trigger and I literally just want to show you how you can create the integration itself so first of all we go to tools we're going to set multiple variables because they are are a couple of variables that we would like to set that we want to interact with and I'm going to guide you through all of them step by step now the first one is going to be location uncore ID and for the value we are going to use the location of the sub account that we want to use if that sounds confusing to you location is basically the API definition within go high level that describes a sub account so you can say location equal sub account just as an example now once we head into our go high level account which I have mine right here and it is a demo account that runs on their higher tier API plan while what I would need to do is I basically grab the slack of the location and it is located directly inside of the URL after the location slurl part as you can see here I just double click it I copy it I head back into my make.com scenario paste it right within here this is Step number one the next step is because I would like to integrate a calendar I'm going to set another variable and I call this one calendar ID now I head back into my go high level setup and as you can see I have created a demo calendar and I'm just going to copy this ID cuz this is the ID for the API that we can just use instead of our make.com scenario so heading back into make.com I'm going to paste that inside of our variable value and I'm also going to Define another variable that I'm just keeping empty for now cuz all I want is that it is predefined cuz we automatically fill it cuz I just realized that for me it was fairly difficult to find the ID of a company cuz in the dashboard it is not that easily visible maybe I missed it somewhere but this way it's just a bit smoother cuz you don't need to worry about the company ID all you would need to provide is the location ID and we can basically fetch the company ID from the location ID all right now we simply click on okay once it looks something like this with your credentials or with your IDs right here and now we come to the first more complex part like I mentioned the high level API is nice but it definitely doesn't support anything that of the things that I need so we are ignoring the fact that the co high level API is integrated as an integration and we are going to use what I always like to use the the HTTP module and if you're not familiar with this module all it does is basically allow you to create HTTP calls to the internet imagine you are opening Facebook or you're opening Google in that case you make a request and Google sends you the stuff back it's nothing else than what the HTTP module does as a very basic explanation and this would happen usually with the make a request setup or the make a request action in our case obviously since we work with go high level it's going to be a little more complex than that what we are going to use is a make an O 2.0 request the go high level V2 version of the API supports only oo 2.0 and by the way you can see this as well by clicking over here and go to authorization you can see that it requires an oo 2.0 flow so it also describes a couple of small setup steps here which we're going to get into in a second too now let's just head back to our make.com scenario and all I'm going to do now is I select this mean o 2.0 request and you will see that it just adds a request with a lot of fields here that kind of look like alienated if you know what I'm talking about probably going to be simple but if you have never seen a request setup this is how it looks like and trust me there is more to that it's not the only thing cuz this is already the secondary part that we are taking care of because now the first thing we want to do is actually access information within the API so to actually do that and basically run through this whole oo flow that is supported by this element we click up here on ADD which then adds a new connection name which anyways you have to do when you set this thing up the first time which I I assume you do so for the connection name you just Define something meaningful in my case I would just say in C ghl app which would probably be the custom app that we created as an authorization as a flow type you select authorization code which is nothing else that during that authentication process it basically provides you a code that is inside of a cury parameter of the URL you will never see that you don't need to worry about it if you would like to understand it look up the O authentication 2.0 flow you will get a better understanding of it I'm going to link some resources as well inside of my resource app so you can look into it if you're really keen on how this works now for the next part the authorized Ur URI which is a very important one this is basically the U that is used to create this whole redirect so that we can actually authenticate with our very own app directly inside of our browser so to do that we head over to the go high level documentation as you can see here and on the page that I mentioned on authorization all you would need to do is you scroll down a little bit until you can see here get the apps authorization page URL so it looks complex but all we're going to do is we locate the question mark in this whole URL obviously in every URL there's only one question mark because that is what separates the URL from the cury parameters and all we do now is we basically copy everything before the question mark which is this whole part of the URL you can also see that there are two different things before I mention yeah it's important to mention for standard off URL flow and for the white label off URL flow in our case since we have set up a white label app anyways we are going to use this down here which also has the only difference of the domain this one is hosted on go high LEL this one is hosted on lead connector HQ and I can promise you it does not matter if your app is on a custom domain or if it is on this white label domain I've tried both it both work to make sure everything is compliant I just suggest you to use the lead connector HQ domain so again we're going to copy everything before the question mark copy that I head back into my mac.com flow I'm going to paste that inside of the authorized U now we have another part which is the token URI which is in the end the URL that will receive the custom token or the custom code once you have been authenticated during that o outlow to actually get the token U all you would need to do is you need to head into the go high level documentation and within the menu here you can see an oos 2.0 setup or item once you click on the sub item down here you can see three different endpoints I promise you don't need to understand all of them now the first one that we are interested in is the get access token cuz this is the one where we basically can retrieve a company access token for our app and this company access token is then able to give us access tokens for all of our locations SL sub accounts I know that it's very complex and the process behind it is a little bit off and it's not following all of the standards like I would like to see it inside of an app but that is not our problem our problem is that we could not use it and I tried to find solutions for that so here we are now what we need to do to actually get it added to make.com we're going to click here on this get access token URL we're going to copy that part we head back into our our make.com scenario and we paste it into this URL field now go high level has a little bug which mean which is right here CU what they do is they make the last power bolt to just highlight the actual endpoint which is nice visually but the problem is it breaks the URL inside of the workflow as you can see here it has an empty space which I tab here this is an issue because it breaks the URL so all you would need to do is you simply delete this endpoint so now it's gone we have the whole URL it is a full URL which is exactly what we would like so the connection we setting up right now is there to authenticate ourselves with our company account or our agency account on go high level this is literally the most basic step where we need to set permissions so that we can access others accounts or other sub accounts directly through our app with our go high level account now once you've done that the next thing we need to do is setting up the Scopes and if you remember Scopes we have to find that inside of our Marketplace app right here selected Scopes so as you can imagine we need to Define the Scopes directly inside of our scenario here so all I do is I click on a new scope I'm going to type calendars. write which is the first one we want to set we want to also set calendars. read only and lastly we would also like to set locations. read only cuz those are the exact ones we have defined right here within our app now there's another thing that probably causes tons of issues if you don't do it because go high level specifically would like to have the Scopes defined with a space in between and not separated by a comma like I would want to usually see it so again it is not the exact and best best setup because there can be other issues involved but go high wants it like this so we need to make sure it works so if you would save this whole connection later on it would probably break and it will not work the way it should so what you would need to do for making the Scopes work you click down here on this little button for show the advanced settings and you can now see a scope separator you want to change that from comma to space very very important step because I promise you you will get tons of 400 arrows directly inside of your authentication process now with that set up we can actually set up the client ID as well and the client secret which are the ones that we copied earlier so all I'm going to do is I head back to my notepad or wherever you basically stored your credentials we copy the client ID I'm going to paste it into this field I'm going to copy the client secret and I'm going to paste the client secret in the client secret field that's it now if you have been logged in or if you are loged in into your go high level account awesome cuz you need to anyways once we clicking on Save down here because this is the time where we now actually run through the very first oo flow for authenticating our company with our app which means that our app has access to the whole setup so we basically interact through our Marketplace app directly with the accounts that we connect with it so in our case I'm basically just using my account as an example so that we can access it directly through this app which is obviously what you would like CU we are connecting it within .c anyway all right I'm going to click save and you can see now that a new popup comes up which now wants us to authenticate with go high level and as you can see here it basically opens a new URL which is very interesting because it contains all of the parameters that are defined that we basically defined within the module that we just set up and you can see here redirect URI which is the in integr url that we set up with have the client ID we have a response type which is code also what we defined earlier and you can see here all of the Scopes that we defined separated by a empty space which in url parameters is defined as percent 20 great so now if everything works and you basically set it up so far you should be able to see your agency account here and your sub account and since my goal basically is to interact with the sub account what I'm going to do is I click on the Indra sub account down here and I'm basically just waiting until it refreshes as you can see now and now you will see the connection up here if everything worked out if not you will see definitely a red error message directly inside the authentication process with a very un problem and I promise you this is one of the worst parts of the whole go high level documentation cuz there is literally no visual Arrow handling you get a 400 arrow and you have no freaking idea why it's happening and what is the reason for it so there is no other solution than reaching out to their tech support I hope they fix it at the point I'm releasing this video however I honestly don't think it's going to happen great so what we did so far is we authenticated ourselves through the app so that the app can basically access our sub account and we can interact with our sub account awesome this this is Step number one so now to actually make the authentication to the calendar ID or the calendar setup what we would need to do is we need to define the calendar URL right within here and I need to mention that this only works because we have defined a sub account during the authentication process while setting up the connection if you would have set up an agency account there is a lot more that we need to do which I'm also going to guide you through in a moment but for now what we need to do to actually just access the calendar which I think is the exact thing that you would like to achieve which is what we would like to ch right we want to connect ourselves to the calendar in that case this setup is perfectly fine what we need to do is now we need to define the calendar URL and you can do this by going here over the documentation you scroll in the menu down to calendars and you click on the get calendar endpoint which looks something like this so we basically copy the URL going to head back into my make.com scenario I'm going to paste it right within here and you can see now as well that there is a place holder for the calendar ID I'm going to remove that and I replace it by the calendar ID we defined as a variable over here I have it as SC and we also have to define the version of the current API go high level just wants us to do that so to actually add the version We simply click on add a header we're going to Define in the name field version and to get the version we basically just scroll down here to that version inside the header string and you can see it as an allowed value we're going to copy that part going to head back and I paste it in the value field so that's it now we have access to our calendar if we have been authenticated ated with a sub account during that authentication process of this connection I'm going to show you how that works I'm going to click okay and I'm going to run the scenario once and if everything works out you will get back a status qu 200 and you will get back the data of the calendar as you can see here which is exactly what we would like so now we basically managed to create a successful connection for a sub account directly with GOI level now this is the easy version which I'm just going to keep here I'm going to do another thing cuz we are basically just creating another connection I'm just going to disconnect that one I'm going to add another module do the same thing with the HTTP module and the O2 request and now we are running through the whole os2 flow again but in that case I'm going to set it up with an agency so that you see how it actually looks like if I would connect through an agency account instead of a sub account so I'm just going to call this part IND gradicus ghl agency we keep it as an authorization code I'm going to run through the exact same setup again so we scroll up to authorization I'm going to copy here that choose location URL going to paste it in this field we're going to go within here to the access token URL going to copy this part going to paste it here remove this space I add the Scopes again all right now we're going to add the client ID and client secret again just like we did it before and we also need to set the separator to a space and now I'm going to click on safe and during the authentication process now instead of selecting a sub account I'm going to select the agency and I'm going to select as well allow access to all sub accounts which means now I can basically use our agency account with access to all of the sub accounts below it which means if you manage your very own clients and you don't want to set it up for each and every single sub account this way there's another way that I'm going to demonstrate you right now which you can leverage to just access that same API for other agency or for other sub accounts so you click on allow access to all sub accounts for integr and you click on proceed and if everything works out it should work but you can see now that I'm getting an 400 arrow that is very undefined so it it doesn't really tell you exactly what is wrong it just tells you that something is wrong so what I would do now is I probably think I have done something wrong in the in the Scopes maybe we can actually verify that by just going to the URL and scrolling to the very end because the Scopes are always defined at the end right here you can see we have calendars. write which looks correct we have separated it by a space we have calendars. read only which looks correct separated by a space and we have locations oh there's the issue so as you can see I have no s right within here so what I would do is I would basically just go back I'm just going to close this task or close this window which then should refresh this part right here that we basically don't get an authorization which I hope works and apparently it doesn't so I'm just going to close it and I'm going to do the exact same thing again so just bear with me I'm going to be so just bear with me all right so I basically just set up everything again we have added our authorized URI token U our Scopes and now I also made sure I added the S at the end cuz that was missing in the previous scope so I basically just wrote it wrong and that's why it didn't work and again it just doesn't tell you the scope is wrong it just tells you 400 bam it just throws you an arrow and you have literally no idea what's going on so that's why I mean it's very very poorly created if it comes to Arrow handling anyways we ignore the fact I'm going to click now on Save down here and we basically just run through this whole authentication process again which we have anyways done before so we're going to select the agency account again we're going to allow sub accounts I'm going to click on proceed and now if everything works out well we basically getting connected with make.com which happens here as you can see verify connection and now we are connected awesome so what I'm going to do now is I'm basically just using the endpoint that I had in my previous setup up here so let's just connect that part I'm copy this URL cuz I just want to demonstrate you that we can we can try to use the exact same URL but it will not work cuz we don't have the user or the location permission permission at this given time so to actually do that what we're going to do is we set this part up here I'm going to again Define the version Define it here and this should be it I'm going to click here on yes and this should be literally the whole setup if I'm going to click okay and now I basically test the setup so I can just disconnect this part cuz this was the the agency module uh the subac account module I'm just going to call this subon permission okay and this one we're going to call agency permission going I click okay so and if I run this whole thing now you will see that here we're going to get a 401 which says this outclass type is not allowed to access the SK plri reach out to our team to get it added I promise you don't reach out to your team I'm going to show you the exact fix for that because right now with this authentication since we have chosen the agency level we basically cannot authenticate directly to a location level because we we didn't obtain the authorization code for that sub level so for that we would basically do a secondary off flow so what you've seen here is the very simple sub flow this one works great and this works great if you just want to work with one sub account and this one down here is just more awesome if you work on an agency level so you basically say you give every you give your app access to every single sub account inside of your agency account so that you can access them separately whenever you need it this is the main difference basically so now since we have authenticated this part this one doesn't work cuz now we have authenticated to an agency level but we cannot just authenticate to the location like I mentioned because we have no a no no location permission so since we have been authenticated to the company or to the agency account which is great so we basically ran through this whole process here with retrieving the access token for that agency we now need to do a secondary authentication step for the actual permissions of the location so and this is what this second endpoint is for right here you can see it's called get location access token from agency token an agency token is obviously the one that we just got right now and you can see here another URL which is called sl/ location token we're going to copy that part and we're going to now reuse this exact same module with the agency authentication but now instead of directly accessing the endpoint we need to make a couple of more substeps to be able to access it so to actually do that we paste this URL we just copied with this o/ location token as you can see here and you can also see that it is a post request so we need to change the method to post we can keep the version right here and now if we look into it we also have to Define inside of the body a company ID and a location ID which we can do directly here this is a major major difference cuz we would not even be able to use this exact setup directly inside of an o offlow that we could basically run through up here because this specific authentication requires information in the body which is not native to a standard orlow this is just a side note but I just want to make sure that you understand that this needs to be a custom request that cannot be the exact same like you would do it inside of an overflow that's why we basically make this authentication using the agency token directly inside of another step within here what we can do now is we basically can go down here to the body type we select application form mural encoded you will also see that by the way right within here you can send it as a x form URL encoded which is the exact content type we have just selected here the reason we use it is because it's simpler and you can literally just add the fields visually so now we have to Define these two fields we need to Define Company ID and location ID let's just Define them here we have location ID and we're going to have company ID so for the location ID it's going to be straightforward CU we have it right here but as you remember I mentioned earlier that we do not have the company ID right here and honestly I don't even know where exactly to locate it inside of the go high level account so so what did I did as lazy as I am I basically just created another endpoint that contains the location ID that we can leverage to get the company ID from so this is exactly why we have added the company ID variable right within here so for the basic setup of that sub account we don't need it but for the sake of the agency permissions or the the agency setup we definitely do need it so how do we get this connected for that we need to unlink this part we're going to copy this module for the agency permission we addit here and now within here we need to retrieve the location itself because the location contains the company ID in the details so to do that we're going to head back to the documentation over here and you can now see when you scroll down in the in the sidebar for a little bit you should be able to see locations which is that part you're going to click on this and you can see get location this is the endpoint we would like to use so from this endpoint we're going to get the company ID so what I do now is I baste this one here I replace this placeholder with a company with a location ID with the actual location ID and let me see I don't think there's anything else necessary yeah you can see the location access token and the agency access token another thing I'd like to mention is that inside of the request you can see here that we have two different kind of tokens because they both can be accessed through the same scope as we have seen earlier so if you go up here to the Scopes we're going to open this in a new tab and we're going to now look into the location permission that we set up earlier locations. readon you can see that this can be accessed by sub and Company and this is the exact reason why you see two different authentication methods here obviously you only need to use one depending on the setup that you have since in our example we set it up now with an agency account down here we need to use the agency authentication which by the way me.com takes care automatically because we already have pre set up our permissions during the oo 2.0 flow so this is just a side note we basically never need to do anything here it is just for you a mental reminder that only one needs to be defined which make.com does automatically so you don't even need to use the location access token in that case now we have the location ID which is the one that we have basically added to the URL and this seems all to be okay so what I would do now is oh I can see I actually have it still inside of that bottom setup which we don't need here so I'm just going to remove those parts and you can see this is the exact setup we need so let me see we have it post but I think honestly this one was also a get so yep we need to change this one to a get request as well and that should be it I'm going to click okay and I'm just going to run this whole thing once and if everything works out now we should be able to obtain an access token for a location level so so it already worked but the explanation I gave you was for a different part so again this URL and this request is specifically just to return the company ID which is what we need for making the actual authentication request for that sub account so I've already done it but I click okay again and I click on run once and you can see now once it run through you can see in the response a status qu 200 and once you see a status c 200 you managed to do it you actually got the information back from the location which means that your agency account was connected and it could access the location through the agency level and inside of the data we can now see location and then we can see Company ID which is the ID that we want so now since we would like to use that variable what I'm going to do is I'll just add a new module here I'm going to click on tools I'm going to click on get variable I'm going to call sorry I'm going to this is the wrong one actually I'm just I want to set a variable because we just want to update it I'm going to click here I'm going to click on set variable going to define the variable like we did it in the first module Company ID and as a variable value I'm now selecting the company ID from the dynamic field that we just returned it's important for you that if you want to actually use it like this that inside of that module you turn on this par response cuz otherwise it's just ajacent you could still use it as a Json with a Json module to parse the Json but I would just ignore that mess and just just simply set this field it's literally the easiest so now we basically set this Val this value as well inside of the company ID field right here and what we do now is we basically click on here we connect this agency permission module and now it is time for us to actually connect the URL where we basically can get the actual location token so since this one didn't work in the first place now it will work but we cannot use the exact same connection module so what I need to do is actually I need to remove this module and I need to recreate it without the O authentication flow so apparently right now during the set up I forgot to do one specific thing and I deleted this module right here which we basically copied for creating this agency permissions in the first place so what I wanted to show you is that we need to use that exact same authentication of the agency level to obtain the key on the sub account or location level so unfortunately I have to recreate it but I'm going to do this with you here so I'm just copying or cloning the module that we had earlier which contains the ghl agency connection that we set up before but now instead of accessing the location what we going to do is we're going to head over to the documentation we go to the get location access token setup we're going to copy the URL over here I paste this one back into here we need to select the post method here cuz this authentication requires the post request for whatever reason and I think because we send the body along that is probably why we're going to also need to define the version inside of the header so I'm going to take this part and I paste it here we have already done that so this is okay we have also select form URL encoded which is still set I think with this one we probably don't even need it but uh it doesn't matter it still works and now we need to define those two keys and those two keys are for the company ID and for the location ID as as you can see right within here in the body Company ID and location ID those two we definitely need to Define so I'm just going to paste them here I'm going to paste them here so now for the location ID I'm going to add the location from the initial step and for the company ID I'm going to select the company ID from the variable now for the we basically don't even need to define the variable in the first place we could also just select the company ID from the location down here the reason I have variables is because I just like to make things more object oriented so I can use them in a smarter way down the line and I can just adjust them or replace them if I need to through other automations this is just a need step to do that helps you in the end to make things a bit smoother and I always like to make things smoother so that's exactly why we have it in a variable we're going to set the par response again to yes I'm going to click okay and now if we've done everything the right way we should be able to obtain an exess token on a location level instead of an agency level so to do that we're going to click on run once we see that everything runs through which is great so we already don't have a specific error that breaks the whole scenario the most important part is when I click on the bubble and now you can see we have a status code 2011 which means the authentication worked which is exactly what you wanted this alone took me literally a couple of days until I managed to make it work and understood the whole thing with the support but it works and we can now see inside of the data construct that we have an access token a token type which is Barra an expiry in and a refresh token so this is where it gets a little bit more interesting where I need to just tell you a bit more about what we need to do with this setup in the first place or actually before I'm before I'm just drawing your vision of making this thing work in a more smarter way I'm just going to show you the way that it actually works even having this setup so just bear with me we now have the access token obtained so now what we can do is we can already access the calendar from a sub level so this is literally kind of the equivalent to what we did here except of that we have not set up the location endpoint yet so what we do for the location endpoint again we're not going to use a go high level app we click on adding a new app we select HTTP and now we are selecting the make a request endpoint so this literally just starts a standard endpoint that we can use to get a calendar so again in the go high level documentation here on the left we're going to go to get calendar and we're copying this calendar URL like we did it in the sub account setup I'm going to add this to the URL field I'm going to replace the p uh the placeholder with the actual calendar ID from our variables and now within the method we keep it as get we need to Define again the version inside of the header you can see that the version was defined right within the documentation 2 so I just paste it as a value and now we should be already there I'm going to set it to par response the only difference is since we are now using a normal HTTP module we also need to take care of the authentication ourselves and this is exactly why we have done this step in the first place because we have obtained that access token directly from within the sub account so we need to add a new header we're going to call this one authorization and here in the value we're going to say beer space and then within the step here which is the module 8 you can see module 8 right here we're going to go on the access token and we paste that access token this is very important cuz this authenticates our setup with that get calendar endpoint and you can see that here as well with a security St bar off which is defined as author authorization barer with a space and then the actual token so now we're going to head over here we're going to click on okay and if everything is set up the correct way we should now also be able to get the calendar through an agency level setup so I'm going to click again on run once I run this whole thing and if we click now on one you can see we get a status code 200 which is exactly what you would like and inside of the data you can now see the whole calendar just like we have done it in the step up here so I'm just going to show you this whole this whole Beauty now in one step so you can see how it works and that it works so right here you can see we have 200 we have the calendar data which is the exact same one and O and we have the same on an agency level right here on the calendar n o so my friends this is the basic explanation on how you can authenticate with a custom app directly inside of make.com with a go high Lev V2 API I know it is massively complex and I really hope this brings a little bit more of clarity to yourself so that you have a better understanding on how to set it up in both possible ways and there is another thing that I mentioned earlier on how you can optimize the setup because since we have now obtained an access token and we actually got the whole authentication flow or authentication flow different let's let's reformat it in a different way because this is not just a single oo flow that is actually two oo flows combined in one module why because we have the O flow that we connected with in the beginning and then we are using this connected or flow to make another o flow request that follows the notation of within go high level defined as here in the get location access token setup to retrieve another o authentication flow setup so while this works right here there's another thing I need to mention because we have an exess token but we can see that it expires in 24 hours so it expires in 24 hours and then it will not be valid anymore which means right now we are creating for every single request another exess token that could be valid for 24 hours and could be used for 24 hours so to make sure not to create too many access tokens if you want to make the setup better and perfect what you would need to do is you would need to store this access token somewhere and you would need to calculate a time stamp maybe from the current time maybe subtract a couple of minutes a couple of yeah let's say minutes might be the best cuz we don't know how much latencies there's going to be in between and then you create another time stamp and you basically add all of this into a custom table maybe a Google sheet maybe air table maybe you use the directly built-in database of make.com and then you can add another module here where you basically compare if that expiry date was already reached and if it was reached you can make the exact same request to a to an endpoint using the refresh token which is defined right here and this refresh token then will give you again another access token that you can then use to make another request this would be the exact and perfect setup OB ly in this tutorial I'm not including it because it depends a little bit on your setup and how you would like to manage and handle it but if you want to set this up yourself I definitely suggest you check out or authentication 2.0 so that you get an understanding of how that stuff works behind the scenes but yeah with this setup now you should be already able to create and connect your very own app to your store and you can literally manage your own clients or yourself through this app directly inser of make.com without ever sacrificing the fact that you don't have access to all of those endpoints and if you're still here since you heard me in the beginning saying that I do not recommend the direct make.com authentication setup for the API it is because the Scopes just don't match so I'm going to explain you this in another example that I'm going to add down here just so you have seen it and now I'm going to search for the go high Lev setup I think it's called high level connector which is this one correct and here we can scroll down to take that make an API call Action I'm going to click on it and you can see now that I basically have have to Define another connection with go high level so now it is an actual go high level connection which means that you do not even need a custom app to make it work so if those permissions that they support is enough for your case you might not even need to use the custom app but I need to warn you I've seen it very often that customers would like to have different kind of Scopes and maybe want to integrate more things and in that case this app or this permissions they just get useless because they don't support the Scopes that you need for your specific use case so I'm going to show you that and explain you that in an actual setup so you can see here once I click on ADD we have to select a connection type which can be either company or location again company is the agency level and location is the sub accounts in both cases it doesn't really matter what you select I'm going to just do the same thing with the location level right now and once I click on save you will see that it brings me to a redirect and this creates this kind of URL up here which is the URL we're getting authenticated with so now you just need to keep in mind that we defined earlier the Scopes in the URL which is the exact same thing with this URL too the only difference is I'm going to take this URL and I'm going to run it through an URL par so that you can actually see the information that is in it which again helps us to understand the Scopes just going to type URL pass online I'm going to take the first one I find so now we're just going to put this URL in I par it and as you can see down here there is a list of Scopes defined and as you can see I'm just going to zoom in a bit you can see it has campaigns read only companies read only it is mostly only the read only setups which means you cannot really interact and create calendars uh create events Etc these are the only permissions that are set and as you can see based on the Scopes here there are tons of others that could be said which is just not what make.com directly supports out of the box so those are the only ones defined with a standard module which is usually not enough so I definitely not recommend this direct integration with make.com and better just use the custom setup that I have right here anyways this is just as an extra explanation so you have an understanding of why I'm not keen of using the highle connector setup with the API call I'm using this custom setup right here and you will not need to create any of those you will get this exit template directly inside of my resource app as a download so that you can get started with creating your very own app on go high level and you can start leveraging that right in your business that's all I have to say for now I know it's a very long video and my voice is nearly gone but I really hope you got the value out of it that you were looking for cuz this stuff probably saves you days of issues with the support going back and forth Etc and really hope it was as helpful as it was for me thanks for watching and if there's anything else we can help you with definitely drop me a message below in the comments or reach out to my team through my website very very happy about any kind of inquiries and that's all I got to say for now thank you very much for watching and see you next time
Info
Channel: Jannis Moore | AI Automation
Views: 2,115
Rating: undefined out of 5
Keywords: gohighlevel tutorial, how to use gohighlevel, go high level tutorial, gohighlevel tutorials, how to use go highlevel, how to use gohighlevel for smma, how to use go high level for smma, how to use go high level for smma agency, how to use ghl for smma, high level tutorial, go high level workflow tutorial, gohighlevel stripe tutorial, highlevel tutorials, go highlevel tutorials, go high level smma tutorial, how to connect highlevel forms to pipeline
Id: vrbi5TiFJ-g
Channel Id: undefined
Length: 52min 11sec (3131 seconds)
Published: Tue Jun 25 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.