PostHog / posthog

🦔 PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host.
https://posthog.com
Other
19.45k stars 1.14k forks source link

API to update Schema Enforcer JSON Schema #22751

Open logason opened 1 month ago

logason commented 1 month ago

Feature request

Is your feature request related to a problem?

Tracking plans are commonly maintained in internal tools or in products such as Avo.

Being able to automatically push tracking plan schemas from the single-source-of-truth tracking plan into PostHog's Schema Enforcer would allow users to get the full value of Schema Enforcer without having to worry about manually updating the JSON Schemas it uses for validation.

Describe the solution you'd like

An API that accepts a JSON (ideally some form of a JSON Schema) to update the Schema Enforcer would allow users and 3rd party tools to build direct integrations to automate workflows around updating tracking plans/schemas.

Describe alternatives you've considered

Additional context

I'm the co-founder/CTO of Avo, and we already have shared customers asking for a direct publishing integration between Avo's Tracking Plan and the PostHog Schema Enforcer

Debug info

- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]
- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]
- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]
joethreepwood commented 1 month ago

Really appreciate you raising this and giving the extra detail.

I've discussed this quickly with our CDP and Pipeline teams and they agree that this would be a good solution. Maybe we could even build this into PostHog as a feature so that it could be done without an API too! Right now both those teams are focused on other projects though, so we aren't able to jump on this right away -- but it's on our radar and we'll update you here with more info when we can!

timgl commented 1 month ago

Our entire frontend is run off of APIs you can also access with personal api keys, so this is actually already possible, you just need to get the user to give you their personal api key and transformation ID of the plugin Schema enforcer. The request looks like this, you can just form submit the JSON as a binary file. PATCH https://us.posthog.com/api/projects/[project_id]/plugin_configs/[transformation_id]/

image