Fix: Preserve ContactId and RelatedContactId in GetTranscript items#111
Open
trexnguyen28 wants to merge 1 commit intoamazon-connect:mainfrom
Open
Fix: Preserve ContactId and RelatedContactId in GetTranscript items#111trexnguyen28 wants to merge 1 commit intoamazon-connect:mainfrom
trexnguyen28 wants to merge 1 commit intoamazon-connect:mainfrom
Conversation
formatAndProcessTranscriptItems() reconstructs transcript items from AWSConnectParticipantItem but omits contactId and relatedContactId. Real-time WebSocket messages retain these fields in their JSON envelope, but historical items loaded via GetTranscript lose them during reconstruction. This makes it impossible for consumers to identify which contact a transcript item belongs to after loading history. Add both fields to messageContentDict so they flow through serializedContent consistently with live WebSocket messages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
formatAndProcessTranscriptItems()inWebSocketManager.swiftreconstructsmessageContentDictfromAWSConnectParticipantItemobjects returned by the GetTranscript API, but omitscontactIdandrelatedContactId— even though both properties are available onAWSConnectParticipantItem(fromAWSConnectParticipantModel.h).Real-time WebSocket messages retain
ContactIdin their JSON envelope and it flows throughserializedContentto consumers. However, transcript items loaded via GetTranscript lose these fields during reconstruction, making it impossible for downstream consumers to identify which contact a historical transcript item belongs to.This change adds
"ContactId": item.contactId ?? ""and"RelatedContactId": item.relatedContactId ?? ""to themessageContentDict, so transcript items are consistent with live WebSocket messages.Functional backward compatibility:
Does this change introduce backwards incompatible changes? NO
This is an additive-only change — two new keys are added to an existing JSON dictionary. Existing consumers that do not read these keys are unaffected.
Does this change introduce any new dependency? NO
Testing:
Is the code unit tested?
Yes — two new tests in
WebSocketManagerTests.swift:testFormatTranscriptItems_preservesContactId— verifiesContactIdandRelatedContactIdappear in processed transcript items'serializedContenttestFormatTranscriptItems_nilContactIdDefaultsToEmpty— verifies nil values default to empty strings (matching the?? ""convention used by other fields)Have you tested the changes with a sample UI?
Yes — tested with a custom host app that parses
ContactIdfromserializedContentafter GetTranscript. Confirmed transcript items now carry the correctContactIdafter app kill and relaunch.List manual testing steps:
serializedContentcontainContactIdmatching the session's contact IDRelatedContactIdis present (empty string if not a persistent chat scenario)