https://discord.gg/botpress logo
HITL Plugin Blocking Message Propagation to Upstre...
# 🤝help
b
Hello Botpress Support Team, I'm experiencing a critical issue with the HITL (Human-in-the-Loop) integration when taking over conversations from our mobile application. Technical Implementation Details: 1. Integration Architecture We've developed a custom Botpress integration (helloresto-hitl) that implements the HITL module pattern. Our integration defines 5 actions: Standard HITL Actions: - startHitl: Creates HITL conversation with upstream mapping - stopHitl: Closes HITL session - createUser: Maps external users to Botpress users via externalId tags Custom Helper Actions (called from Supabase Edge Functions): - takeConversationControl: Logs agent takeover events - sendHumanMessage: Sends agent messages to conversations - stopConversationControl: Logs agent release events 2. Message Sending Flow (The Problematic Part) When an agent sends a message from our React Native mobile app: Mobile App → Supabase Edge Function (send-human-message) → Botpress Client.callAction() → Integration Action: sendHumanMessage → client.createMessage() with tags: { sender: 'human', agentId, agentName } sendHumanMessage: async ({ input, client, logger }) => { // Get or create user for the agent const { user } = await client.getOrCreateUser({ tags: { externalId: agentId } }); // Create message in conversation const messageResult = await client.createMessage({ conversationId, userId: user.id, type: 'text', payload: { text: message }, tags: { sender: 'human', agentId, agentName } }); return { success: true, messageId: messageResult.message.id }; } (next in comment)
3. Conversation Setup (take-conversation-control flow) When takeover starts: 1. Call createUser to map Botpress user to external system 2. Call startHitl with: - conversationId: Original conversation ID - userId: Customer user ID - messageHistory: Past messages - hitlSession.upstreamConversationId: Original conversation ID 3. Add 'upstream' tag to HITL conversation : await botpressClient.updateConversation({ id: hitlConversationId, tags: { upstream: body.botpressConversationId } }); 4. The Problem When sendHumanMessage creates a message via client.createMessage(): - The message is successfully created in Botpress (we get a messageId back) - BUT: The message never reaches the upstream conversation (original customer conversation) - The customer never receives the agent's response Error in Botpress logs: Event propagation was stopped. Reason - Hitl plugin stopped the event propagation in hook before_incoming_message. 5. What We've Tried ✅ Verified the upstream tag is correctly set on the HITL conversation ✅ Confirmed upstreamConversationId is passed in hitlSession during startHitl ✅ Tried different message sending approaches (direct createMessage, via actions) ✅ Verified user mapping with externalId tags ✅ Added explicit tags to messages (sender: 'human') ✅ Tested both automatic and manual HITL takeover flows 6. Expected Behavior Based on the HITL module documentation, messages sent by agents in the HITL conversation should be automatically forwarded to the upstream conversation so customers can receive agent responses.
Our questions: How should we configure the HITL integration or structure our sendHumanMessage implementation so that messages created via client.createMessage() in the HITL conversation are properly forwarded to the upstream conversation instead of being blocked by the HITL plugin's before_incoming_message hook? Is there a specific message property, tag, or event we need to set to indicate that a message should be routed upstream?
l
It is possible there are errors because of the AWS outage @brainy-river-21984 please read #announcements
b
Yes we saw, but this was happening before the AWS outage (we have the issue since last Thursday)
?
l
Which plan are you on @brainy-river-21984 especially for more urgent customer support I urge you to reach out to our Technical support live chat!
On my end I can only guide you towards the proper documentation we have on HITL
Can you try re configurataion the integration?
b
On plus, ok I will
3 Views