```js // Custom action in Botpress async function ...
# 🌎general
c
Copy code
js
// Custom action in Botpress
async function waitForUserInput() {
    const delay = ms => new Promise(res => setTimeout(res, ms));
    const waitingTime = 300000; // 5 minutes in milliseconds

    // Set a flag in the user's session to indicate waiting for input
    temp.waitingForInput = true;

    // Wait for the specified time
    await delay(waitingTime);

    // Check if the user has responded in the meantime
    if (temp.waitingForInput) {
        // User hasn't responded, send the reminder message
        const eventDestination = { channel: event.channel, target: event.target, botId: event.botId, threadId: event.threadId };
        bp.events.replyToEvent(eventDestination, [{ type: 'text', text: "I'm still waiting here" }]);
    }
}

// Reset the flag when the user sends a message
function onUserMessage() {
    temp.waitingForInput = false;
    // Continue with the conversation flow based on user input
}

// Register this function to execute when the user sends a message
// This depends on how your Botpress setup handles incoming messages