Genesys Cloud - Developer Community!

 View Only

Sign Up

Expand all | Collapse all

how to handle repeated button clicks / duplicated customer messages without triggering the same path twice?

  • 1.  how to handle repeated button clicks / duplicated customer messages without triggering the same path twice?

    Posted 4 hours ago

    Hi everyone,
    In a Digital Bot Flow, I'm using quick replies/buttons (and sometimes free-text). In some cases, customers tap the same button multiple times or the channel delivers duplicate messages (latency/retry), and the bot ends up running the same action twice (e.g., calling a Data Action twice, creating two tickets, sending duplicated confirmations).

    What's the best way to implement idempotency / deduplication logic in a DBF?

    • Do you store the last selection + timestamp in Participant Data and ignore repeats within X seconds?

    • Is there a reliable message/turn identifier we can reference in the flow?

    • Any recommended pattern for "lock" behavior (e.g., set processing=true until the action finishes) to prevent double execution?


    #Architect

    ------------------------------
    Alex Sander Felicio
    ------------------------------


  • 2.  RE: how to handle repeated button clicks / duplicated customer messages without triggering the same path twice?

    Posted 3 hours ago

    Olá @Alex Sander Felicio!

    In Digital Bot Flows, using the slot itself as a guard is a valid and commonly adopted way to prevent the same step from being executed multiple times when customers click the same button repeatedly or when the channel delivers duplicate messages.

    The basic idea is to treat the slot as an indicator that a step has already been completed: if the slot is empty, the flow executes the action and then populates the slot; if the slot already contains a value, the flow skips the action and continues. This approach works well for steps that are expected to run only once per conversation, such as capturing a menu selection, collecting an identifier, or triggering a single downstream operation like creating a ticket.

    • se o slot estiver vazio, o fluxo executa a ação e então preenche o slot;
    • se o slot já contém um valor, o flow pula a ação e continua.

    Essa abordagem funciona bem para etapas que devem ser executadas apenas uma vez por conversa, como capturar uma seleção de menu, coletar um identificador ou acionar uma única operação downstream, como criar um ticket.

    Encapsulating the quick replies and slot collection logic inside a reusable task is also a good design practice. It centralizes the menu logic, reduces duplication across the flow, and makes it easier to consistently apply guard checks (for example, only presenting quick replies when the slot is still empty). In practice, the task can check whether the slot already has a value and either return it immediately or present the menu and collect the selection.

    In summary, slot-based guards are effective for preventing repeated execution of conversational steps, reusable tasks help enforce consistency and governance, and critical external actions should still be protected with an additional locking or idempotency mechanism to ensure robustness.



    ------------------------------
    Fernando Sotto dos Santos
    Consultor Grupo Casas Bahia
    ------------------------------