Kernel::WebApp::Util::Chat::Base

NAME

Kernel::WebApp::Util::Chat::Base – Chat utility base class.

PUBLIC INTERFACE

has ChatterID

Attribute that holds the Id of the chat user (chatter).

has DefaultChannel

Attribute that holds the information about the default channel.

has AvailableChannels

Attribute that holds the list of available channels.

AcceptRequest()

Changes the status of the chat to 'active' and sets the user (ChatterID) as an active participant.

    my $Result = $ChatUtil->AcceptRequest(
        ChatID => '...' # Id of the chat
    );

Returns

    { Success => 1, }   - in case the operation was successful.
    { Error => '...', } - in case any error has occurred.

IsClosed()

Checks if the chat is closed.

    my $Result = $ChatUtil->IsClosed(
        ChatID => '...' # id of the chat
    );

Returns

    1 - is closed
    0 - is not closed

IsParticipant()

Check if the user (ChatterID) is a participant for the given ChatID.

    my $Result = $ChatUtil->IsParticipant(
        ChatID => '...' # id of the chat
        Active => 1|0   # to check is if an active participant
    );

Returns

    1 - is participant
    0 - is not participant

SendMail()

Sends an email with the chat history to the given Email.

    my $Result = $ChatUtil->SendMail(
        ChatID => '...', # ID of the chat.
        Email  => '...'  # email address to send to.
    );

Returns

    { Success => 1, }   - in case the operation was successful.
    { Error => '...', } - in case any error has occurred.

ActiveUsers()

Returns the list of the active users for the given ChatID.

    my $List = $ChatUtil->ActiveUsers(
        ChatID    => '...' # ID of the chat.
        NoDefault => 0     # (optional) Do not replace agent names with config 'DefaultAgentName'
    );

Returns

    [
        {
            ChatterID   => '...',
            ChatterType => '...',
            ChatterNam  => '...',

            ...
        },
    ]

Close()

Closes an chat.

    my $Result = $ChatUtil->Close(
        ChatID => '...',
    );

Returns

    { Success => 1, }   - in case the operation was successful.
    { Error => '...', } - in case any error has occurred.

SendMessage()

Send a new message to the given chat id.

    my $Result = $ChatUtil->SendMessage(
        ChatID  => '...' # ID of the chat.
        Message => '...' # message to send.
    );

Returns

    { Success => 1, }   - in case the operation was successful.
    { Error => '...', } - in case any error has occurred.

RequestCreate()

Creates a new chat request and returns the chat id.

    my $ChatID = $ChatUtil->RequestCreate(
        ChannelID => '...' # ID fo the channel.
        Message   => '...' # initial message to add the chat.
    );

History()

Returns the chat history for the user (ChatterID).

    my $History = $ChatUtil->History();

Returns

    {
        IncomingRequests => [ ... ],
        OutgoingRequests => [ ... ],
        Active           => [ ... ],
        Closed           => [ ... ],
    }

IsChannelAvailable()

Verifies if the given ChannelID is available.

    my $IsAvailable = $ChatUtil->IsChannelAvailable(
        ChannelID => '...' # ID of the channel.
    );

Returns

    1 - is available
    0 - is not available

ChatterType()

Indicates what is the chatter type.

    my $Type = $ChatUtil->ChatterType();

ShouldCheckAvailability()

Indicates if during the guessing of the available channels the system should check if any agent is available in the channels or not.

    my $Check = $ChatUtil->ShouldCheckAvailability();

Returns

    1 - system checks for agents.
    0 - system does not check for agents.

AreChannelsAllowed()

Indicates if the channels selection is available or not.

    my $ChannelsAllowed = $ChatUtil->AreChannelsAllowed();

Returns

    1 - channels selection is available.
    2 - channels selection is not available.

PRIVATE INTERFACE

_BuildAvailableChannels()

Builder of the AvailableChannels attribute.

_Channels()

List of channels.

_BuildDefaultChannel()

Builder of the DefaultChannel attribute.

_LogError()

Writes an error message to the system log.

Scroll to Top