Aura Groot operational flows

Description of aura-groot main operational flows

Introduction

The current document includes the main operational flows in the aura-groot component.

Blocked skill

This flow describes the control of the messages received by aura-groot from the skill and the sending of the error message to the user in case the skill does not respond.

sequenceDiagram
title: BLOCKED-SKILL

    actor Channel
    participant AuraGroot #ebdff7
    participant AuraBot #ebdff7

    Channel ->> AuraGroot: request message1
    AuraGroot ->> AuraGroot: create skillConversation1, begin timeout in targetSkill
    AuraGroot ->> AuraBot: request message1
    AuraBot -->> AuraGroot: response message1
    AuraGroot ->> AuraGroot: delete timeout, update targetSkill
    AuraGroot -->> Channel: response message1
    AuraBot -->> AuraGroot: response endOfConversation
    AuraGroot ->> AuraGroot: delete targetSkill

    Channel ->> AuraGroot: request message2
    AuraGroot ->> AuraGroot: create skillConversation2, begin timeout in targetSkill
    AuraGroot ->> AuraBot: request message2
    Channel -->> AuraGroot: request message3
    AuraGroot ->> AuraGroot: control timeout (active targetSkill)

    alt timeout targetSkill < TIMEOUT
        AuraGroot ->> AuraBot: request message3
        AuraBot -->> AuraGroot: response message2
        AuraGroot ->> AuraGroot: delete timeout, update targetSkill
        AuraGroot -->> Channel: response message2

        AuraBot -->> AuraGroot: response message3
        AuraGroot ->> AuraGroot: delete timeout, update targetSkill
        AuraGroot -->> Channel: response message3
        AuraBot -->> AuraGroot: response endOfConversation message2
        AuraGroot ->> AuraGroot: delete targetSkill
        AuraBot -->> AuraGroot: response endOfConversation message3
        AuraGroot ->> AuraGroot: discard endOfConversation in conversation2
    end

    alt timeout targetSkill > TIMEOUT
        AuraGroot -->> Channel: Error
        AuraGroot ->> AuraGroot: begin timeout, in targetSkill
        AuraGroot ->> AuraBot: request message3
        AuraBot -->> AuraGroot: response message2
        AuraGroot ->> AuraGroot: delete timeout, update targetSkill
        AuraGroot -->> Channel: response message2
        AuraBot -->> AuraGroot: response endOfConversation message2
        AuraGroot ->> AuraGroot: delete targetSkill
        AuraBot -->> AuraGroot: response message3
        AuraGroot ->> AuraGroot: discard delete timeout in targetSkill
        AuraGroot -->> Channel: response message3
        AuraBot -->> AuraGroot: response endOfConversation message3
        AuraGroot ->> AuraGroot: discard endOfConversation in targetSkill
    end

Use case with asynchronous calls

This diagram describes the flow of a user’s request that is resolved through a dialog with asynchronous calls.

Further information regarding how asynchronous APIs are handled by Aura can be found in the Guidelines for building a dialog that uses async APIs.

sequenceDiagram
title: MESSAGE_ASYNC_USECASE
    actor User
    User ->> WA: User request
    WA ->> 4P: User request
    4P ->> AuraBridge: User request
    AuraBridge ->> 4P: 200 OK
    AuraBridge ->> AuraGroot: User request
    AuraGroot ->> AuraBridge: 200 OK
    AuraGroot ->> AuraGroot: create skillConversation1, begin timeout in targetSkill
    AuraGroot ->> AuraSkill: User request
    AuraSkill ->> AuraGroot: 200 OK
    AuraSkill ->> AuraSkill: basic whatsapp flow
    AuraSkill ->> LocalDialog: message
    LocalDialog ->> 4P: request async + callback bridge
    4P ->> LocalDialog: 200 OK
    Note right of 4P: when 4p finishes the request sends the response to the indicated callback (AuraBridge)
    4P ->> AuraBridge: response request async
    AuraBridge ->> 4P: 200 OK
    AuraBridge ->> AuraGroot: response request async
    AuraGroot ->> AuraBridge: 200 OK
    Note right of AuraBridge: the response is sent as payload
    AuraGroot ->> AuraGroot: control timeout
    alt targetSkill.timeout < TIMEOUT
        AuraGroot ->> AuraSkill: response request async
        AuraSkill ->> AuraGroot: 200 OK
        AuraSkill ->> LocalDialog: response request async
        LocalDialog ->> LocalDialog: process response
        LocalDialog ->> AuraSkill: response processing
        AuraSkill ->> AuraGroot: async response processed
        AuraSkill ->> AuraGroot: response endOfConversation
        AuraGroot ->> AuraSkill: 200 OK
        AuraGroot ->> AuraGroot: delete targetSkill
        AuraGroot ->> AuraGroot: delete skillConversation1
        AuraGroot ->> AuraBridge: async response processed
        AuraBridge ->> AuraGroot: 200 OK
        AuraBridge ->> 4P: async response processed
        4P ->> AuraBridge: 200 OK
        4P ->> WA: async response processed
        WA ->> User: async response processed
    else
        AuraGroot ->> AuraBridge: error
        AuraBridge ->> AuraGroot: 200 OK
        AuraBridge ->> 4P: async error
        4P ->> AuraBridge: 200 OK
        4P ->> WA: error
        WA ->> User: error
        AuraGroot -> AuraSkill: request async endOfConversation
        AuraGroot -> AuraGroot: delete skillConversation1
        AuraGroot -> AuraGroot: create skillConversation2, begin timeout in targetSkill
        AuraGroot ->> AuraSkill: response request async
        AuraSkill ->> AuraGroot: 200 OK
        AuraSkill ->> AuraSkill: Not recognize
        AuraSkill ->> AuraGroot: none
        AuraSkill ->> AuraGroot: response endOfConversation
        AuraGroot ->> AuraSkill: 200 OK
        AuraGroot ->> AuraGroot: delete targetSkill
        AuraGroot ->> AuraGroot: delete skillConversation2
        AuraGroot ->> AuraBridge: none
        AuraBridge ->> AuraGroot: 200 OK
        AuraBridge ->> 4P: none
        4P ->> AuraBridge: 200 OK
        4P ->> WA: none
        WA ->> User: none
    end

Use case with files sending by the user

This diagram describes the flow of a use case that includes sending a file by the user (WhatsApp channel).

Further information regarding how to receive a file from the user can be found in:

sequenceDiagram
title: MESSAGE_FILE_USECASE
    User ->> WA: Phrase to init UC file dialog
    WA ->> 4P: Phrase to init UC file dialog
    4P ->> AuraBridge:Phrase to init UC file dialog
    AuraBridge ->> 4P: 200 OK
    AuraBridge ->> AuraGroot: Phrase to init UC file dialog
    AuraGroot ->> AuraBridge: 200 OK
    AuraGroot ->> AuraGroot: create skillConversation1, begin timeout in targetSkill
    AuraGroot ->> AuraSkill: Phrase to init UC file dialog
    AuraSkill ->> AuraGroot: 200 OK
    AuraSkill ->> AuraSkill: Basic whatsapp flow for authenticated user
    AuraSkill ->> FileDialog: Start UC file dialog
    FileDialog ->> AuraSkill: Send me a file
    AuraSkill ->> AuraGroot:  Send me a file
    AuraGroot ->> AuraSkill: 200 OK
    AuraGroot ->> AuraGroot: delete timeout in targetSkill
    AuraGroot ->> AuraBridge: Send me a file
    AuraBridge ->> AuraGroot: 200 OK
    AuraBridge ->> 4P: Send me a file
    4P ->> AuraBridge: 200 OK
    4P ->> WA: Send a file
    WA ->> User: Send a file
    User ->> WA: Send the attachment
    WA ->> 4P: Send the attachment
    4P ->> AuraBridge: Send the attachment
    AuraBridge ->> 4P: 200 OK
    AuraBridge ->> AuraGroot: Send the attachment
    AuraGroot ->> AuraBridge: 200 OK
    AuraGroot ->> AuraSkill: Send the attachment
    AuraSkill ->> AuraGroot: 200 OK
    AuraSkill ->> FileApi: Validate / process the attachment
    FileApi ->> AuraBot: 200 OK
    FileApi ->> AuraBridge: Attachment processed, validated and ready (async-callback)
    AuraBridge ->> FileApi: 200 OK
    AuraBridge ->> AuraGroot: Send attachment processed
    AuraGroot ->> AuraBridge: 200 OK
    AuraGroot ->> AuraGroot: control timeout
    Note right of AuraSkill: we could control that it is a system message, but the case would be the same if a message from the user arrives before the asynchronous response
    alt targetSkill.timeout < TIMEOUT
        AuraGroot ->> AuraSkill: Send attachment processed
        AuraSkill ->> AuraGroot: 200 OK
        AuraGroot ->> FileDialog: Send attachment processed
        FileDialog ->> FileDialog: process attachment
        FileDialog ->> AuraSkill: response processed attachment
        AuraSkill ->> AuraGroot: response processed attachment
        AuraSkill ->> AuraGroot: response endOfConversation
        AuraGroot ->> AuraSkill: 200 OK
        AuraGroot ->> AuraGroot: delete targetSkill
        AuraGroot ->> AuraGroot: delete skillConversation1
        AuraGroot ->> AuraBridge: response processed attachment
        AuraBridge ->> AuraGroot: 200 OK
        AuraBridge ->> 4P: response processed attachment
        4P ->> AuraBridge: 200 OK
        4P ->> WA: response processed attachment
        WA ->> User: response processed attachment
    else
        AuraGroot ->> AuraBridge: error
        AuraBridge ->> AuraGroot: 200 OK
        AuraBridge ->> 4P: async error
        4P ->> AuraBridge: 200 OK
        4P ->> WA: error
        WA ->> User: error
        AuraGroot -> AuraSkill: request endOfConversation
        AuraGroot -> AuraGroot: delete skillConversation1
        AuraGroot -> AuraGroot: create skillConversation2, begin timeout in targetSkill
        AuraGroot ->> AuraSkill: response processed attachment
        AuraSkill ->> AuraGroot: 200 OK
        AuraSkill ->> AuraSkill: UnexpectedFile
        AuraSkill ->> AuraGroot: UnexpectedFile
        AuraSkill ->> AuraGroot: response endOfConversation
        AuraGroot ->> AuraSkill: 200 OK
        AuraGroot ->> AuraGroot: delete targetSkill
        AuraGroot ->> AuraGroot: delete skillConversation2
        AuraGroot ->> AuraBridge: UnexpectedFile
        AuraBridge ->> AuraGroot: 200 OK
        AuraBridge ->> 4P: UnexpectedFile
        4P ->> AuraBridge: 200 OK
        4P ->> WA: UnexpectedFile
        WA ->> User: UnexpectedFile
    end

Handover use case

This diagram describes the flow of the handover use case.

Further information regarding about handover use case handover-genesys dialog.

sequenceDiagram

title: handover
actor Channel
participant Bridge #ebdff7
participant AuraGroot #ebdff7
participant AuraBot #ebdff7
participant Genesys #ebdff7

Channel ->> AuraGroot: request message1
AuraGroot ->> AuraGroot: create skillConversation1, begin timeout in targetSkill
AuraGroot ->> AuraBot: request message1
AuraBot -->> AuraGroot: response message1
AuraGroot ->> AuraGroot: delete timeout in targetSkill
AuraGroot -->> Channel: response message1
AuraBot -->> AuraGroot: response endOfConversation
AuraGroot ->> AuraGroot: delete targetSkill
AuraBot ->> Genesys: request chat "init"
Genesys ->> AuraBot: response chat "init"
AuraBot ->> Genesys: message history
Genesys ->> AuraBot: response message history
Genesys -->> Bridge: pushNotification: starter messages with genesys

Bridge ->> AuraGroot: request message2
AuraGroot ->> AuraGroot: create skillConversation2, begin timeout in targetSkill
AuraGroot ->> AuraBot: request message2
AuraBot -->> AuraGroot: response message2
AuraGroot ->> AuraGroot: delete timeout in targetSkill
AuraGroot -->> Bridge: response message2
Bridge -->> Channel: response message2
AuraBot -->> AuraGroot: response endOfConversation
AuraGroot ->> AuraGroot: delete targetSkill