Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need system API key and webhook to manage all workspaces for self hosted systems #9415

Open
codearranger opened this issue Jan 6, 2025 · 1 comment

Comments

@codearranger
Copy link

Scope & Context

When running a self-hosted twenty installation, and a user signs up we would like to trigger a script that would use the API to deploy our custom objects into the new workspace. For this we would need a system wide API key and a system wide webhook that would fire an event that a new workspace has been created, and then use the system wide API key to add the custom objects and configuration into the new workspace.

Current behavior

Currently you can only create an API key or webhook for a single user in an existing workspace.

Expected behavior

When a new workspace is created the webhook fires and our custom script would use the system API key to make changes to the newly created workspace.

Technical inputs

A system API key could be created with a yarn command or set from an environment variable
A webhook URL could be configured with a yarn command or set from an environment variable

@FelixMalfait
Copy link
Member

For the API key, it should be possible to forge an access token for a given workspace with your APP_SECRET (set in .env).

From the codebase:
Image

The value of type here should be ACCESS.
So if your secret is SECRET then you could create the token for workspace id xxx by computing

createHash('sha256')
      .update(`SECRETxxxACCESS`)
      .digest('hex');

For webhooks, maybe there's something to hack with Postgres Triggers on a self-hosted instance to register a webhook automatically when a table called webhooks is created. It's not pretty but the hack could work. I don't have a better idea for now, I'll keep this open an see if something comes up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants