revertinc / revert

Revert makes it incredibly easy to build integrations with any third party API
https://revert.dev
GNU Affero General Public License v3.0
926 stars 72 forks source link

Go High Level integration #328

Open simple10 opened 10 months ago

simple10 commented 10 months ago

GHL is used by hundreds of thousands of companies, mostly through white labeled versions created by agencies, and is rapidly growing. It has a thriving app marketplace that would readily adopt Revert if GHL was supported.

jatinsandilya commented 10 months ago

Hi @simple10, thanks for creating an issue here.

We'll look into it!

If you have more details/ideas on what use-cases someone could use GHL for would love to know!

simple10 commented 10 months ago

Hi @jatinsandilya. I think a lot of the use cases will be the same as other CRM and marketing tools with syncing lead data and messages between platforms. Personally, I'm interested in building dashboards and UI enhancements inside of GHL and offering it as a paid app inside the GHL app marketplace. I came across Revert from a HackerNews post while researching unified API platforms to manage OAuth UI & tokens and syncing data between CRMs.

GHL has a unique model of unlimited subaccounts, contacts, and data. Agencies frequently rebrand GHL and sell it to sales and marketing teams in their clients' companies. It's common for these clients to also have existing CRMs but for various workflow reasons, teams within the companies will opt to use GHL. A common use case is sales teams using GHL to acquire and manage leads, and once the leads convert to customers, they get pushed over into the company's legacy CRM system.

I see a lot of opportunity for GHL agencies and developers to use Revert to build custom GHL apps as a way of solving the most common sales objection of having data in multiple CRMs. No code syncing solutions like Zapier and Make are just not reliable or scalable enough to use as a proper app backend to sync data. Revert could be the missing piece of the GHL app dev puzzle.

gold-olar commented 6 months ago

Hi @jatinsandilya would love to take on this.... Can I get a check list of items that I should make sure I cross out so a PR for this can be accepted ??

jatinsandilya commented 6 months ago

Hi @jatinsandilya would love to take on this.... Can I get a check list of items that I should make sure I cross out so a PR for this can be accepted ??

@gold-olar Do you know the specific kind of objects you want to deal with inside of GHL, like Contacts or deals?

I’d start in this order.

  1. Understand OAuth piece for a connection.
  2. Implement connection flow for GHL. (including obtaining access token + refresh of those tokens if applicable)
  3. Implement unified API endpoints for the standard objects (contacts, leads for eg)

1 & 2 should be straightforward on their own. Check packages/js/src/index.ts on how the OAuth works, lmk if you have any questions on it.

3 could be a little complex to understand given we store field mappings in the database but I'm happy to help their when you come to that.

gold-olar commented 6 months ago

Hi @jatinsandilya I tried to go through the auth logic and I have some questions. If you don't mind, I want to walk through what I have understood so far by just looking through the codebase and trying out some things.

With what I have learned so far, I see that the auth logic for a connection starts from the UI. The user is directed to the app (either the default revert one or the one the custom one the user creates) on whatever platform they want to integrate.

One question here though, how is the redirect uri configured if the user creates their own app (must it always be https://app.revert.dev/oauth-callback)?

After the user completes the process, the user is redirected to the callback url (app.revret.dev).

The app takes the code in the URL and other necessary parameters and calls revert backend api to verify that code and get the access and refresh token from the integrated platform.

Then it creates a connection in the db.

Lastly, there is a cron that refreshes the tokens every 2 mins.

Please lmk if i missed anything in this Oauth flow.

Another question I have is how I can use the frontend SDK in my local environment, so I can test when I start implementing. I did not see any docs on how to go about setting that up. Can you help with that ?

jatinsandilya commented 6 months ago

One question here though, how is the redirect uri configured if the user creates their own app (must it always be https://app.revert.dev/oauth-callback)?

Yes. This is correct. Even with a custom app, it will always have to be https://app.revert.dev/oauth-callback

After the user completes the process, the user is redirected to the callback url (app.revert.dev).

The app takes the code in the URL and other necessary parameters and calls revert backend api to verify that code and get the access and refresh token from the integrated platform.

Then it creates a connection in the db.

Lastly, there is a cron that refreshes the tokens every 2 mins.

Please lmk if i missed anything in this Oauth flow.

Sounds right.

Another question I have is how I can use the frontend SDK in my local environment, so I can test when I start implementing. I did not see any docs on how to go about setting that up. Can you help with that ?

You can use yarn workspace @revertdotdev/js dev to start working with the JS SDK locally. If you look at the packages/js/package.json you'll notice that it runs the dev version of the react SDK locally.

gold-olar commented 6 months ago

You can use yarn workspace @revertdotdev/js dev to start working with the JS SDK locally. If you look at the packages/js/package.json you'll notice that it runs the dev version of the react SDK locally.

Is there a command I am supposed to use to build this asides yarn workspace @revertdotdev/js build ?

I am running into an error when I run this JS SDK.

Screenshot 2024-02-17 at 6 14 14 AM

Also, Is there a reason why this part of the setup is not in the docs? Can It be updated ?

jatinsandilya commented 6 months ago

You can use yarn workspace @revertdotdev/js dev to start working with the JS SDK locally. If you look at the packages/js/package.json you'll notice that it runs the dev version of the react SDK locally.

Is there a command I am supposed to use to build this asides yarn workspace @revertdotdev/js build ?

I am running into an error when I run this JS SDK.

Screenshot 2024-02-17 at 6 14 14 AM

Also, Is there a reason why this part of the setup is not in the docs? Can It be updated ?

@gold-olar yarn workspace @revertdotdev/js dev will build it and copy it to the appropriate directory. But if you're only building it, then you'd have to update the .env in packages/react to point to the build file yourself (See .env.example.)

Please check watch:tsto see exactly what is happening under the hood.

And yes always happy to a take PR that improves the docs! 🙏🏼

gold-olar commented 6 months ago

For some reason, I cannot get an account on GHL, they keep rejecting all the cards I try to use. I won't be able to test the OAuth piece when I work on that...

I see there is an open issue as well for Asana, I may pick that up pending the time I can get an account on GHL. I am sure I should not have any issues with that, as I already have an asana account I could use to test.

I would go through the docs and leave a comment on the issue to signify that I am picking up that ticket...