Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Send Close Chat Message to Client #172

Merged
merged 9 commits into from
Oct 6, 2022

Conversation

AlexanderKanakis
Copy link
Collaborator

@AlexanderKanakis AlexanderKanakis commented Sep 23, 2022

Comment on lines 152 to 160
export enum CloseChatDescription {
CLOSED_BY_VISITOR = 'Closed by visitor',
CUSTOMER_IDLE_TIMEOUT = 'Customer Timeout',
INVALID_TARGET_DEPARTMENT = 'Escalation failed due to invalid target department',
SAME_TARGET_DEPARTMENT = 'Escalation failed due to same target department',
LIVEAGENT_BOT_OFFLINE_OR_DISABLED = 'Escalation failed due to liveagent bot offline or disabled',
NETWORK_OR_APP_ERROR = 'Escalation failed due to network or app error',
AGENT_UNASSIGNED = 'Agent is unassigned',
INVALID_EVENT_DATA = 'Invalid Dialogflow event data',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will these messages end up in the widget appearing to visitors?

Can we keep the message more specific? i.e. Chat close after the escalation failed due to invalid target department

Copy link
Collaborator Author

@AlexanderKanakis AlexanderKanakis Sep 29, 2022

Choose a reason for hiding this comment

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

No, these messages only appear when examining the omnichannel rooms in the server.
image

I can make the new descriptions more specific, but we will always have the Conversation closed prefix.

@@ -52,7 +52,7 @@ export class IncomingEndpoint extends ApiEndpoint {
const room = (await read.getRoomReader().getById(sessionId)) as ILivechatRoom;
switch (action) {
case EndpointActionNames.CLOSE_CHAT:
await closeChat(modify, read, sessionId);
await closeChat(modify, read, sessionId, this.app, CloseChatDescription.CLOSED_BY_VISITOR);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is confusing. Chat closed by the /incoming endpoint is not necessarily closed by the visitor.

@@ -77,7 +78,7 @@ export const handlePayloadActions = async (
} else if (actionName === ActionIds.CLOSE_CHAT) {
const livechatRoom = (await read.getRoomReader().getById(rid)) as ILivechatRoom;
if (livechatRoom && livechatRoom.isOpen) {
await closeChat(modify, read, rid);
await closeChat(modify, read, rid, app, CloseChatDescription.CLOSED_BY_VISITOR);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also confusing, it's closed when we receive close chat action from DF Agent. So it's not closed by visitor

Copy link
Collaborator

@Shailesh351 Shailesh351 left a comment

Choose a reason for hiding this comment

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

@ear-dev This PR is for Setting proper close chat messages. We will need separate story to send close chat event with proper close_method as well

enum/Dialogflow.ts Outdated Show resolved Hide resolved
lib/Room.ts Outdated Show resolved Hide resolved
enum/Dialogflow.ts Outdated Show resolved Hide resolved
enum/Dialogflow.ts Outdated Show resolved Hide resolved
@ear-dev
Copy link

ear-dev commented Oct 6, 2022

@AlexanderKanakis most of my tests showed that this PR works as designed. I did find one that is still not correct yet.

  • If you break the sf endpoint in the SF Admin UI, by adding some bogus path at the end, the closed message shows "closed by visitor" when it should show NETWORK_OR_APP_ERROR I think.

Actually that should be handled by the SF app shouldn't it..... just ignore this please.

@AlexanderKanakis
Copy link
Collaborator Author

@AlexanderKanakis I also found that then the Salesforce agent closes the chat, it now says "closed by visitor". Previously it was > working to show "closed by agent" but I think we broke it in this PR? thanks...

Is that issue still something I should look into? I cannot find your comment.

@ear-dev
Copy link

ear-dev commented Oct 6, 2022

Ok, I tested as much of these conditions as I could and it looks good. Thanks @AlexanderKanakis

@ear-dev
Copy link

ear-dev commented Oct 6, 2022

@AlexanderKanakis I also found that then the Salesforce agent closes the chat, it now says "closed by visitor". Previously it was > working to show "closed by agent" but I think we broke it in this PR? thanks...

Is that issue still something I should look into? I cannot find your comment.

yeah, I removed it because I realize that that is an issue in the SF.app and will be included in the SF PR.

@ear-dev ear-dev merged commit db96900 into master Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants