jpetrucciani / hubspot3

python3.6+ hubspot client based on hapipy, but modified to use the newer endpoints and non-legacy python
MIT License
147 stars 73 forks source link

Add a Webhooks client #129

Open sangaline opened 1 year ago

sangaline commented 1 year ago

This adds a new Webhooks client that can be used to manage webhook settings and subscriptions using the Hubspot Webhooks API. This API has different requirements from the other API clients, namely it requires the use of an API key for the developer account where the webhook subscriptions live; oauth authentication won't work, nor will the legacy API key or private app access token from a non-developer account. Conversely, the developer account API key cannot be used to access anything from a non-developer account (e.g. contacts, deals, companies). The API also requires that an app_id be specified when initializing the client, for example:

client = Hubspot3(api_key='<my-developer-key>', app_id=1234)
client.webhooks.get_all_subscriptions()

As a side note, the API keys for non-developer accounts are being officially sunset tomorrow and will stop working for anybody who didn't specifically get an extension. This might suggest that the api_key parameter should be phased out, but it's worth noting that it's deprecation is only for non-developer accounts and this PR is an example of how the parameter continues to be useful moving forward.

jpetrucciani commented 1 year ago

@sangaline Sent you a message on linkedin - but in the meantime, looks like I need to update some typing stuff, and upgrade our prospector config!

jpetrucciani commented 1 year ago

Okay I've fixed a lot of the prospector and typing stuff in #130 , could you rebase and rerun the CI?