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)