API
This is a custom API, written in Python using FastAPI, to help me accomplish tasks the can be improved through a RESTful API
Setup
Simplest setup is to start from compose.yml and template.env, which should be renamed to .env
Environment Vairables
API_KEY- A long, random string used to authenticate API requests. The health check is public, and the GitHub webhook uses its own signing secret.DATABASE_URL- The URL to connect to postgres DB. Must start withpostgresql+psycopg://. Should be in the format specifiec in template.envTZ- Timezone of the containerPGTZ- Timezone the Postgres container should useNEXTCLOUD_URL- Base URL (must behttps://) of the Nextcloud instance used by the Talk webhooksNEXTCLOUD_TALK_TOKEN- Conversation token of the registered Nextcloud Talk bot used by/webhook/databasusNEXTCLOUD_TALK_SECRET- Shared secret of the registered Nextcloud Talk bot used by/webhook/databasusBESZEL_NEXTCLOUD_TALK_TOKEN- Conversation token for the separate Beszel Talk bot used by/webhook/beszelBESZEL_NEXTCLOUD_TALK_SECRET- Shared secret of the registered Beszel Talk botGITHUB_WEBHOOK_SECRET- Signing secret configured on the GitHub webhookGITHUB_NEXTCLOUD_TALK_TOKEN- Conversation token for GitHub code scanning notificationsGITHUB_NEXTCLOUD_TALK_SECRET- Shared secret of the Talk bot that sends GitHub notifications
Webhooks
-
POST /webhook/databasus- Forwards aheaderandmessageto a Nextcloud Talk conversation via the Nextcloud Talk Bot API, using the nctalk package. Requires theX-API-KEYheader and a JSON body:{"header": "...", "message": "..."} -
POST /webhook/beszel- Forwards Beszel's generic JSON notifications ({"title": "...", "message": "..."}) using a separate Talk bot. Requires theX-API-KEYheader. Posts the title in bold followed by the message. Returns{"status": "sent"}on success,422for invalid payloads,500for missing or insecure Talk configuration, or502when delivery fails. -
POST /webhook/github/code-scanning- Verifies GitHub'sX-Hub-Signature-256signature and sends a Talk message with the repository, alert number, and alert link. It handlescreated,fixed,closed_by_user,reopened,reopened_by_user, andupdated_assignment. Signed pings, unrelated events, and other actions such asappeared_in_branchreturn{"status": "ignored"}.For Trivy findings, the message also includes Package, Severity, Installed Version, and Fixed Version when GitHub includes those details in the finding message.
Beszel setup
-
Register a separate bot named Beszel using Nextcloud's bot management commands and enable it in the destination Talk conversation.
-
Set
NEXTCLOUD_URL,BESZEL_NEXTCLOUD_TALK_TOKEN(the destination conversation token), andBESZEL_NEXTCLOUD_TALK_SECRET(the new bot's shared secret) in.env, then recreate the API container to load the settings. Beszel credentials are required; this endpoint does not fall back to the Databasus bot. -
In Beszel, open Settings > Notifications and add this generic webhook URL, replacing the host and API key:
generic://api.example.com/webhook/beszel?template=json&@X-API-KEY=YOUR_URL_ENCODED_API_KEY
The
generic://service uses HTTPS by default. URL-encode the API key if it contains special characters.template=jsonsupplies thetitleandmessagefields, and@X-API-KEYadds the authentication header. -
Send a test notification from Beszel, then enable alerts in its systems table.
GitHub setup
- Enable a Nextcloud Talk bot in the destination conversation. Set
NEXTCLOUD_URL,GITHUB_NEXTCLOUD_TALK_TOKEN,GITHUB_NEXTCLOUD_TALK_SECRET, and a randomGITHUB_WEBHOOK_SECRETin.env, then recreate the API container. - In the GitHub repository or organization, create a webhook with the HTTPS payload URL
https://api.example.com/webhook/github/code-scanningand content typeapplication/json. Use the value ofGITHUB_WEBHOOK_SECRETin GitHub's Secret field and select Code scanning alerts under individual events. GitHub webhook setup
How to Access
Using the compose.yml file, you can access the API at http://<IP>:5000/health-check. If everything is setup correctly, you should see {"status":"ok"}
Metadata
Release files for js-api 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| js_api-0.4.1.tar.gz | 32.6 kB | With provenance | Details for js_api-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| js_api-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for js_api-0.4.1-py3-none-any.whl |
Total release size: 61.7 kB
Release files / js_api-0.4.1.tar.gz
| Download URL | js_api-0.4.1.tar.gz |
|---|---|
| Size | 32.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e365df14c902bae782feeea70849a1940518f62481c4a23af89828bdb41bb97d
|
|
BLAKE2b-256 checksum How to use checksums |
016bb92227a59b84aea4fa9ac9952043608d0e89a770f02b5b41825744e4b5a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / js_api-0.4.1-py3-none-any.whl
| Download URL | js_api-0.4.1-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1894434cb56d3ca6182aae5715c4b03458861ab506ae903c71fbb1f1c7d82bdb
|
|
BLAKE2b-256 checksum How to use checksums |
6909a1cbf6b21afd3c6f8b0121fe1f99b1adabd991fd300c59aa9fcdcc6dd993
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logSecurity for js-api 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for js_api-0.4.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.