Hi!
I’m integrating the HITL (Human in the Loop) API into my own backend service, and I need to programmatically generate a valid X-User-Key so I can send messages through the HITL endpoint without manually refreshing the key every time it expires.
After inspecting the network traffic from the Botpress Cloud dashboard (via browser DevTools), I identified the following behavior and endpoints being used:
I can successfully send messages to the HITL integration when using a valid X-User-Key:
POST
https://hitl.botpress.cloud/
/messages
Authorization: Bearer
X-User-Key:
Content-Type: application/json
This works perfectly from my backend once I have a valid x-user-key.
Problem: Generating the X-User-Key
The web dashboard appears to generate the key by calling one of the following internal endpoints, but neither of them works from a backend environment:
POST
https://hitl.botpress.cloud/
/login
Authorization: Bearer
Content-Type: application/json
Body: {}
And I get response: 403 Forbidden ("Invalid credentials")
From the DevTools traces, it seems that the Botpress web app calls a private internal service which authenticates the user session and then internally generates the HITL key via the /login endpoint.
However, these routes are not available publicly on api.botpress.cloud, even when using a valid Personal Access Token (PAT) generated from my workspace settings.
I have a Plus plan and a valid PAT and I am calling from my own Node.js backend (server-side only, no browser context).
What I need:
I would like to programmatically obtain a valid X-User-Key for the HITL integration using my workspace PAT or another stable API key, so that my backend can refresh the key automatically without requiring cookies or browser context.