Skip to content

Conversation

@escapemanuele
Copy link
Contributor

@escapemanuele escapemanuele commented Nov 3, 2025

Fix https://linear.app/a8c/issue/DOTCOM-15086/do-not-open-a-new-interaction-every-time

When a user reaches /odie, we create a new support interaction, with a first event 'help-center'.
After the first message to Odie, we add another event to the same interaction, 'odie'. The same thing happens when we escalate to live chat.

Problem: Every time a user lands in /odie, a new support interaction is created. That is probably useless, it happens a lot that users go away and then return and then open /odie by mistake. Those are all new, forgotten, support interactions in the database.

This PR tries to improve that by not using the 'help-center' event anymore, thus creating a new support interaction only when we talk with Odie or we directly escalate to live chat.

Testing steps

  1. The Help Center should work as usual: AI chats, direct escalation (?help-center=happiness-engineer), multiple chats, normal escalation
  2. sandbox widgets and yarn dev --sync from apps/help-center. Test wp-admin and the editor

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • help-center

To test WordPress.com changes, run install-plugin.sh $pluginSlug DOTCOM-15086/do-not-open-a-new-interaction-every-time on your sandbox.

@escapemanuele escapemanuele marked this pull request as ready for review November 4, 2025 13:39
@escapemanuele escapemanuele requested a review from a team November 4, 2025 13:40
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 4, 2025
Copy link
Member

@alshakero alshakero left a comment

Choose a reason for hiding this comment

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

Great great change. Thank you!! I left some comments.


try {
if ( ! supportInteraction && chatIdString ) {
const newInteraction = await startNewInteraction( {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const newInteraction = await startNewInteraction( {
supportInteraction = await startNewInteraction( {

event_external_id: returnedChat.chat_id.toString(),
const chatIdString = returnedChat.chat_id?.toString?.() ?? String( returnedChat.chat_id );
let supportInteraction = currentSupportInteraction;
let interactionOdieId = odieId;
Copy link
Member

Choose a reason for hiding this comment

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

Do we need interactionOdieId at all?

( interaction: SupportInteraction ) => {
setChat( ( prevChat ) => ( {
...prevChat,
supportInteractionId: interaction.uuid,
Copy link
Member

Choose a reason for hiding this comment

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

Probably for later. Maybe we can always rely on the event ID on the URL and get rid of the one in the chat.

interactionId: currentSupportInteraction!.uuid,
eventData: {
event_external_id: returnedChat.chat_id.toString(),
const chatIdString = returnedChat.chat_id?.toString?.() ?? String( returnedChat.chat_id );
Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand this line. Both parts seem to return chat_id.

updateInteractionContext( updatedInteraction );
}
} catch ( error ) {
// eslint-disable-next-line no-console
Copy link
Member

Choose a reason for hiding this comment

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

Deserves an event for sure.

} );
}
activeInteractionId = interaction.uuid;
updateInteractionContext( interaction );
Copy link
Member

Choose a reason for hiding this comment

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

This line worries me. It will redirect to another URL and re-render everything. I wonder what problems will that bring. Maybe we can do it at the very end of the function when everything is done?

if ( interactionId && ! interactionIdFromURL) {
    // update the URL
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants