Chat recordings - Mapping participant names with messages

Hi,

I am working on archiving chat recordings for regulatory needs. I would basically need to email them in the given format

Customer1: Hello
Agent1: Hi, How can I help you
Customer1: ***
Agent1: *****
Customer1: *****

I could get the chat transcripts from the RecordingAPI as below
'transcript': [{'body': 'Hi - How may I help you',
'chat': '5a9f0024000013a81956c80a',
'id': '5a9f0032000013a8206a233e',
'message': None,
'pcFrom': '5a77a67dff20401da37c14c4@XXXX.XXXX..com',
'to': 'acd-f22245c2-1573-4e95-a743-04b7d565dae9@XXXX.XXXX.XXX.com',
'type': 'message',
'user': None,
'utc': '2018-03-06T20:55:14.407Z'},
*****

And I could get the participants details from the ConversationAPIs (participant IDs, name)

But I am not able to match participant details from the details in the transcript. In the above transcript, I have pcFrom and to. But how I do get the names of whoever sent the message?

Thanks,
Kathir

In the response from GET /api/v2/conversations/{conversationId}/recordings, the from property in a message in the transcript corresponds to the address property of a participant from GET /api/v2/conversations/chats/{conversationId}.

Thanks Tim, it worked for some. But some conversations have "None" for address for few participants. Hence not able to map some of the from property with an address. How do we handle them?

Can you provide the full participant object that doesn't have an address? I'm guessing that it's just a participant that didn't actually participate in the chat messages (like the ACD participant), but I can tell for sure with an example.

Here's the message for which I am trying to find the participant
'self_uri': '/api/v2/conversations/9b24066d-e26f-4a9e-bc01-5fb12e6e5692/recordings/8b028341-01e7-4236-b3cb-41e2d8171fe8',
'session_id': None,
'start_time': None,
'transcript': [{'body': 'Hi - How may I help you',
'chat': '5a9f0024000013a81956c80a',
'id': '5a9f0032000013a8206a233e',
'message': None,
'pcFrom': '5a77a67dff20401da37c14c4@axadev.orgspan.com',
'to': 'acd-f22245c2-1573-4e95-a743-04b7d565dae9@conference.16416.orgspan.com',
'type': 'message',
'user': None,
'utc': '2018-03-06T20:55:14.407Z'},

Got 4 participants for this conversation. Not able map "5a77a67dff20401da37c14c4" with the addresses returned
Participants: {'address': '5a9f001b000013ec1a0db8b3@guest.orgspan.com',
'attributes': {'context.browserSupported': 'false',
'context.firstName': 'Sean Johnson',
'context.hasChromeExtension': 'true',
'context.isChrome': 'false',
'context.isFirefox': 'false',
'context.lastName': 'Sean Johnson',
'context.purecloud': 'true',
'ivr.DistributionGroup': '47851f51-7538-48e4-952d-7fff79bb28d1'},
'connected_time': datetime.datetime(2018, 3, 6, 20, 54, 52, 554000, tzinfo=tzutc()),
'direction': None,
'disconnect_type': 'client',
'end_time': datetime.datetime(2018, 3, 6, 21, 3, 47, 725000, tzinfo=tzutc()),
'error_info': None,
'external_contact': {'id': 'ffd0f02b-cae3-41d2-b578-b454925a8b1a',
'name': None,
'self_uri': '/api/v2/externalcontacts/contacts/ffd0f02b-cae3-41d2-b578-b454925a8b1a'},
'external_organization': None,
'held': False,
'id': 'bcced873-eb0c-410b-91b1-fda357d42f0c',
'name': 'Sean Johnson Sean Johnson',
'peer': None,
'provider': 'PureCloud Webchat',
'purpose': 'customer',
'queue': {'id': '47851f51-7538-48e4-952d-7fff79bb28d1',
'name': None,
'self_uri': '/api/v2/routing/queues/47851f51-7538-48e4-952d-7fff79bb28d1'},
'room_id': 'acd-f22245c2-1573-4e95-a743-04b7d565dae9@conference.16416.orgspan.com',
'script': None,
'start_hold_time': None,
'start_time': datetime.datetime(2018, 3, 6, 20, 54, 52, 480000, tzinfo=tzutc()),
'state': 'disconnected',
'user': None,
'wrapup': None,
'wrapup_prompt': None,
'wrapup_required': False,
'wrapup_skipped': None,
'wrapup_timeout_ms': None}
Participants: {'address': None,
'attributes': {},
'connected_time': datetime.datetime(2018, 3, 6, 20, 54, 52, 569000, tzinfo=tzutc()),
'direction': None,
'disconnect_type': 'transfer',
'end_time': datetime.datetime(2018, 3, 6, 20, 54, 59, 987000, tzinfo=tzutc()),
'error_info': None,
'external_contact': None,
'external_organization': None,
'held': False,
'id': '0924b6cd-11e6-4093-b511-350882143bcb',
'name': 'PCPG Triple Play Chat',
'peer': None,
'provider': 'PureCloud Webchat',
'purpose': 'acd',
'queue': {'id': '47851f51-7538-48e4-952d-7fff79bb28d1',
'name': None,
'self_uri': '/api/v2/routing/queues/47851f51-7538-48e4-952d-7fff79bb28d1'},
'room_id': 'acd-f22245c2-1573-4e95-a743-04b7d565dae9@conference.16416.orgspan.com',
'script': None,
'start_hold_time': None,
'start_time': datetime.datetime(2018, 3, 6, 20, 54, 52, 513000, tzinfo=tzutc()),
'state': 'disconnected',
'user': None,
'wrapup': None,
'wrapup_prompt': None,
'wrapup_required': False,
'wrapup_skipped': None,
'wrapup_timeout_ms': None}
Participants: {'address': None,
'attributes': {},
'connected_time': datetime.datetime(2018, 3, 6, 20, 54, 59, 948000, tzinfo=tzutc()),
'direction': None,
'disconnect_type': 'transfer',
'end_time': datetime.datetime(2018, 3, 6, 21, 2, 50, 449000, tzinfo=tzutc()),
'error_info': None,
'external_contact': None,
'external_organization': None,
'held': False,
'id': 'bfcb021f-5064-43f3-a04c-b9b6ce0a755e',
'name': None,
'peer': None,
'provider': 'PureCloud Webchat',
'purpose': 'agent',
'queue': {'id': '47851f51-7538-48e4-952d-7fff79bb28d1',
'name': None,
'self_uri': '/api/v2/routing/queues/47851f51-7538-48e4-952d-7fff79bb28d1'},
'room_id': 'acd-f22245c2-1573-4e95-a743-04b7d565dae9@conference.16416.orgspan.com',
'script': None,
'start_hold_time': None,
'start_time': datetime.datetime(2018, 3, 6, 20, 54, 52, 684000, tzinfo=tzutc()),
'state': 'disconnected',
'user': {'id': '70faa7c3-5b14-4af4-8da9-61398215823c',
'name': None,
'self_uri': '/api/v2/users/70faa7c3-5b14-4af4-8da9-61398215823c'},
'wrapup': {'code': 'ba1a0fcc-37c7-4235-bebf-be13c2c64d99',
'duration_seconds': 3,
'end_time': datetime.datetime(2018, 3, 6, 21, 2, 53, 801000, tzinfo=tzutc()),
'name': None,
'notes': '',
'provisional': None,
'tags': []},
'wrapup_prompt': 'optional',
'wrapup_required': True,
'wrapup_skipped': None,
'wrapup_timeout_ms': None}
Participants: {'address': None,
'attributes': {},
'connected_time': None,
'direction': None,
'disconnect_type': 'system',
'end_time': datetime.datetime(2018, 3, 6, 21, 3, 47, 810000, tzinfo=tzutc()),
'error_info': None,
'external_contact': None,
'external_organization': None,
'held': False,
'id': 'a1541805-1f9a-4461-94ce-fe5cb3f0c9e4',
'name': None,
'peer': None,
'provider': 'PureCloud Webchat',
'purpose': 'agent',
'queue': {'id': '47851f51-7538-48e4-952d-7fff79bb28d1',
'name': None,
'self_uri': '/api/v2/routing/queues/47851f51-7538-48e4-952d-7fff79bb28d1'},
'room_id': 'acd-f22245c2-1573-4e95-a743-04b7d565dae9@conference.16416.orgspan.com',
'script': None,
'start_hold_time': None,
'start_time': datetime.datetime(2018, 3, 6, 21, 2, 50, 446000, tzinfo=tzutc()),
'state': 'disconnected',
'user': {'id': 'ca1b3515-851f-4527-8918-476d41f86820',
'name': None,
'self_uri': '/api/v2/users/ca1b3515-851f-4527-8918-476d41f86820'},
'wrapup': None,
'wrapup_prompt': 'optional',
'wrapup_required': False,
'wrapup_skipped': None,
'wrapup_timeout_ms': None}

It looks like I was mistaken that the address should be set; that's only the case for the customer participant. The rest of the participants will not have a value for address.

The ids from the recording transcript that you are not seeing in the conversation object can be found by getting the user/agent's configuration using GET /api/v2/users/{userId} (or any of the set of APIs that return a user's configuration). You'll find that from address in the property chat.jabberId on the user's configuration. The conversation participant with "purpose": "agent" will also have the property user.id set indicating the user's ID.

1 Like

Thanks very much Tim, it worked.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.