Author Topic: How to Extract the "message-Text" and "Sender" from the Event "EventSessionInfo  (Read 3629 times)

Offline shahzeb

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
Hi,
I am writting a customization for [b]Interaction workspace (Chat Channel)[/b], which will make it capable of sending an automated chat message to the customer if the Agent doesn't answer him for a centern timeout. With each message between Customer and Agent [b]"EventSessionInfo" is broadcasted[/b]. All i am asking is that When "EventSessionInfo" is broadcasted, the "EventSessionInfo" contains the "Message-Text" and "Sender". But i do not find a way to extract the "message-Text" and the "Sender" from the Event.

I want to know how, and need a code example of how.

Debug logs show this.

15-01-30 09:05:49.602 [ia.XmlProducer] DEBUG lMessageProducerImpl - XML Message:
offset = 4
length = 1024
content = <?xml version="1.0" encoding="UTF-16BE"?><envelope><header><protocol-info protocol-id="Basic Chat Protocol" version-major="2" version-minor="0" /></header><body><eventSessionInfo refId="0" occurAt="2015-01-30T08:05:49Z" sessionStatus="ALIVE"><chatTranscript startAt="2015-01-30T08:04:56Z" sessionId="00091aABW2UQ017W"><message userId="011B54CB3B2874F0" eventId="13" timeShift="53" visibility="ALL"><msgText>Customer customer needs help :)</msgText></message></chatTranscript></eventSessionInfo></body></envelope>
15-01-30 09:05:49.602 [ia.XmlProducer] DEBUG lMessagePackagerImpl - New message #101
15-01-30 09:05:49.603 [ia.XmlProducer] DEBUG eceiver.QueueSupport - Enqueue object. Counter=[11]. Queue size =

15-01-30 09:05:49.603 [ia.XmlProducer] DEBUG 11-9b62-f6ab60167de2 - Completed handling psdkendpoint - tcp://vda1cs2010.qaoneadr.local:7022(Socket#4648) message...
'EventSessionInfo' ('101')
message attributes:
ReferenceId [int] = 0
OccurredAt [str] = "2015-01-30T08:05:49Z"
SessionStatus [str] = ALIVE
ChatTranscript  = ComplexClass(ChatTranscript):
    StartAt [str]  = "2015-01-30T08:04:56Z"
    SessionId [str] = "00091aABW2UQ017W"
    ChatEventList [BasicChatList] =
    {
        element[0] = MessageInfo:
            UserId [str]    = "011B54CB3B2874F0"
            EventId [int]  = 13
            TimeShift [int] = 53
            Visibility [str] = ALL
            MessageText    = ComplexClass(MessageText):
                Text [str]      = "Customer customer needs help :)"

    }
Modify message

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Did you try to look into EventSessionInfo variables? If the message-text is not contained within them

Offline gstkein

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 4
I´m not sure if this translates to IWS but for BasicChat in psdk you can do the following:

ChatTranscript chatTranscript = eventSessionInfo.getChatTranscript();
for (int i = 0; i < chatTranscript.getChatEventList().size(); i++) {

/* Try to read event as text */
MessageInfo messageInfo = chatTranscript.getChatEventList().getAsMessageInfo(i);
if (null != messageInfo && null != messageInfo.getMessageText()) {
String message = messageInfo.getMessageText().getText(); //THE TEXT
                                String userId = messageInfo.getUserId(); //THE USER
                        }
                       

}
« Last Edit: February 11, 2015, 01:01:48 AM by gstkein »

Offline shahzeb

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
Hi, and thanks, that did the trick... worked just fine :)