From 6000b63a913baaa8ed368127a29c6712c0d7a2f6 Mon Sep 17 00:00:00 2001 From: ldebowczyk Date: Mon, 20 Nov 2023 14:41:51 +0100 Subject: [PATCH] fix: Visitor message not being sent to webhook (#30933) Co-authored-by: Kevin Aleman <11577696+KevLehman@users.noreply.github.com> --- .changeset/loud-foxes-grin.md | 5 +++++ apps/meteor/app/livechat/server/hooks/sendToCRM.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/loud-foxes-grin.md diff --git a/.changeset/loud-foxes-grin.md b/.changeset/loud-foxes-grin.md new file mode 100644 index 000000000000..3fa989aa0dd2 --- /dev/null +++ b/.changeset/loud-foxes-grin.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +fix: Visitor message not being sent to webhook due to wrong validation of settings diff --git a/apps/meteor/app/livechat/server/hooks/sendToCRM.ts b/apps/meteor/app/livechat/server/hooks/sendToCRM.ts index d435da17e8ec..44b55e1b82f8 100644 --- a/apps/meteor/app/livechat/server/hooks/sendToCRM.ts +++ b/apps/meteor/app/livechat/server/hooks/sendToCRM.ts @@ -269,7 +269,7 @@ callbacks.add( if (message.token && !settings.get('Livechat_webhook_on_visitor_message')) { return message; } - if (!settings.get('Livechat_webhook_on_agent_message')) { + if (!message.token && !settings.get('Livechat_webhook_on_agent_message')) { return message; } // if the message has a type means it is a special message (like the closing comment), so skips