Skip to content

CHI-3872: Fix 'end chat' not launching the post survey for Aselo webchat#4320

Merged
stephenhand merged 6 commits intomasterfrom
CHI-3872-end_chat_postsurvey
May 7, 2026
Merged

CHI-3872: Fix 'end chat' not launching the post survey for Aselo webchat#4320
stephenhand merged 6 commits intomasterfrom
CHI-3872-end_chat_postsurvey

Conversation

@stephenhand
Copy link
Copy Markdown
Collaborator

Description

Checklist

  • Corresponding issue has been opened
  • New tests added
  • Feature flags added
  • Strings are localized
  • Tested for chat contacts
  • Tested for call contacts

Other Related Issues

None

Verification steps

AFTER YOU MERGE

  1. Cut a release tag using the Github workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the Aselo webchat “End chat” flow so that ending a Conversation correctly triggers the post-chat survey behavior, primarily by using conversationSid and the Twilio Conversations API instead of treating a Conversation SID like a Programmable Chat channel SID.

Changes:

  • Webchat UI now sends conversationSid to /endChat (and no longer clears session immediately on “End chat” for finishTask).
  • Account-scoped endChat lambda now posts the “user left” system message via Conversations when conversationSid is provided, and uses getWorkspaceSid.
  • Channel janitor adds clearer conversation/channel branching and improved logging/guardrails.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lambdas/account-scoped/src/conversation/endChat.ts Use conversationSid + Conversations API to send the end-chat message; additional diagnostics around task state/cleanup.
lambdas/account-scoped/src/conversation/chatChannelJanitor.ts Improve conversation vs channel deactivation branching and logging.
aselo-webchat-react-app/src/sessionDataHandler.ts Update end-chat payload typing from channelSid to conversationSid.
aselo-webchat-react-app/src/components/endChat/EndChat.tsx Send conversationSid to /endChat and avoid clearing session during finishTask flow.
aselo-webchat-react-app/src/components/endChat/QuickExit.tsx Update props to use conversationSid for deferred /endChat request.
aselo-webchat-react-app/src/components/endChat/CloseChatButtons.tsx Wire conversation.sid into conversationSid props for EndChat/QuickExit.

Comment on lines 44 to 48
type EndChatPayload = {
channelSid: string;
conversationSid: string;
language?: string;
token: string;
};
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 4ead4ef. Updated both deferredRequest('/endChat', ...) test payloads to use conversationSid: 'CH123' instead of channelSid: 'CH123', matching the updated EndChatPayload type.

Comment thread lambdas/account-scoped/src/conversation/endChat.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@stephenhand stephenhand marked this pull request as ready for review May 7, 2026 12:48
@stephenhand stephenhand merged commit a779081 into master May 7, 2026
26 checks passed
@stephenhand stephenhand deleted the CHI-3872-end_chat_postsurvey branch May 7, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants