NAME
Kernel::System::Ticket::Article::Backend::Chat – backend class for chat based articles
DESCRIPTION
This class provides functions to manipulate chat based articles in the database.
Inherits from Kernel::System::Ticket::Article::Backend::Base, please have a look there for its base API, and below for the additional functions this backend provides.
PUBLIC INTERFACE
ArticleCreate()
Create a chat article.
my $ArticleID = $ArticleBackendObject->ArticleCreate(
TicketID => 123, # (required)
SenderTypeID => 1, # (required)
# or
SenderType => 'agent', # (required) agent|system|customer
ChatMessageList => [ # (required) Output from ChatMessageList()
{
ID => 1,
MessageText => 'My chat message',
CreateTime => '2014-04-04 10:10:10',
SystemGenerated => 0,
ChatterID => '123',
ChatterType => 'User',
ChatterName => 'John Doe',
},
...
],
IsVisibleForCustomer => 1, # (required) Is article visible to customer?
UserID => 123, # (required)
HistoryType => 'OwnerUpdate', # EmailCustomer|Move|AddNote|PriorityUpdate|WebRequestCustomer|...
HistoryComment => 'Some free text!',
);
Events: ArticleCreate
ArticleGet()
Returns single article data.
my %Article = $ArticleBackendObject->ArticleGet(
TicketID => 123, # (required)
ArticleID => 123, # (required)
DynamicFields => 1, # (optional) To include the dynamic field values for this article on the return structure.
MaskAgentName => 1, # (optional) Set it if external frontend is used. It masks agent names in the chat if needed.
# Default 0.
);
Returns:
%Article = (
TicketID => 123,
ArticleID => 123,
ChatMessageList => [
{
MessageText => 'My chat message',
CreateTime => '2014-04-04 10:10:10',
SystemGenerated => 0,
ChatterID => '123',
ChatterType => 'User',
ChatterName => 'John Doe',
},
...
],
SenderTypeID => 1,
SenderType => 'agent',
IsVisibleForCustomer => 1,
CreateBy => 1,
CreateTime => '2017-03-28 08:33:47',
# If DynamicFields => 1 was passed, you'll get an entry like this for each dynamic field:
DynamicField_X => 'value_x',
);
ArticleUpdate()
Update article data.
Note: Keys ChatMessageList
, SenderType
, SenderTypeID
and IsVisibleForCustomer
are implemented.
my $Success = $ArticleBackendObject->ArticleUpdate(
TicketID => 123, # (required)
ArticleID => 123, # (required)
Key => 'ChatMessageList', # (optional)
Value => [ # (optional)
{
MessageText => 'My chat message (edited)',
CreateTime => '2014-04-04 10:10:10',
SystemGenerated => 0,
ChatterID => '123',
ChatterType => 'User',
ChatterName => 'John Doe',
},
...
],
UserID => 123, # (required)
);
my $Success = $ArticleBackendObject->ArticleUpdate(
TicketID => 123,
ArticleID => 123,
Key => 'SenderType',
Value => 'agent',
UserID => 123,
);
Events: ArticleUpdate
ArticleDelete()
Delete article data.
my $Success = $ArticleBackendObject->ArticleDelete(
TicketID => 123,
ArticleID => 123,
UserID => 123,
);
BackendSearchableFieldsGet()
Get the definition of the searchable fields as a hash.
my %SearchableFields = $ArticleBackendObject->BackendSearchableFieldsGet();
Returns:
my %SearchableFields = (
'Chat_ChatterName' => {
Label => 'Article Chat Participant',
Key => 'Chat_ChatterName',
Type => 'Text',
Filterable => 0,
},
'Chat_MessageText' => {
Label => 'Article Chat Message Text',
Key => 'Chat_MessageText',
Type => 'Text',
Filterable => 1,
},
);
ArticleSearchableContentGet()
Get article attachment index as hash.
my %Index = $ArticleBackendObject->ArticleSearchableContentGet(
TicketID => 123, # (required)
ArticleID => 123, # (required)
DynamicFields => 1, # (optional) To include the dynamic field values for this article on the return structure.
RealNames => 1, # (optional) To include the From/To/Cc fields with real names.
UserID => 123, # (required)
);
Returns:
my %ArticleSearchData = { 'ChatterName' => { String => 'John Doe Jane Doe Joe Doe', Key => 'ChatterName', Type => 'Text', Filterable => 0, }, 'ChatterType' => { String => 'User User1 User2 User3', Key => 'ChatterType', Type => 'Text', Filterable => 0, }, 'MessageText' => { String => 'Chat message Second chat message Third chat message', Key => 'Body', Type => 'Text', Filterable => 1, } };
ArticleHasHTMLContent()
Returns 1 if article has HTML content.
my $ArticleHasHTMLContent = $ArticleBackendObject->ArticleHasHTMLContent(
TicketID => 1,
ArticleID => 2,
UserID => 1,
);
Result:
$ArticleHasHTMLContent = 1;