https://discord.gg/botpress logo
What is the encryption key to create an x_user_key...
# 🤝help
e
Hi! I'm using the HITL integration via a request to the HITL API. To assign a "human" user to a conversation, I need an x-user-key for a user designated for that purpose. I already have that user's user ID; I'm just missing the encryption key to dynamically generate the JWT (x-user-key).
l
Hey @early-state-34882 Do you absolutely need an X user key? I just tested on my end and it worked fine (following the basic guide here): https://www.botpress.com/docs/integrations/integration-guides/hitl
w
looks like they're using the API, and the x-user-key might be required as a JWT token as it is in the CHAT API integration
the issue is, in the chat api you can set that secret yourself
doesn't look like there's anything of the sort in HITL
e
I'm using it on my React page, and to use the HITL integration, I use API requests with the conversation ID. The problem is, I need the x-user-key of the user assigned as the "human agent" to send in the request header. const url =
https://hitl.botpress.cloud/<bot-id>/conversations/${conversationId}
await fetch(url, { method: "POST", headers: { "Authorization":
Bearer ${<api-key>}
, "Content-Type": "application/json", "X-User-Key":
${x-user-key of the hitl assigned user}
, }, body: JSON.stringify({ status: "assigned", assignee: { workspaceMemberId: , } }) });
w
ooh hang on
which integration are you using to manage the conversations?
when they're not on HITL yet
e
I use HITL but I have to hardcode the x-user-key for it to work, but as you say, it's a simple JWT, so it expires and I have to keep changing it.
I tried to create the x-user-key myself like in the chat API, but my encryption key doesn't work.
w
no i mean before the conversation gets passed to hitl
what api is used before the Start HITL block
e
Chat API
w
that might be the solution then
the x-user-key already exists and is being set in your behalf
you have to change the webhook-secret in the chat api integration
no sorry not webhook secret
this
(if you're signing them yourself)
since they're coming from the Chat integration, they are probably using the same x-user-key
e
Yes, I have tried to sign it with that key but it tells me that the key is not correct, even when I take an already generated x-user-key and decoded it, it does not encrypt with that signature
w
hmm that's a shame
how did you even figure out the correct endpoint haha
i see nothing in the docs