From f069045c57e273b9efd32dd8854e3723dad1bf8d Mon Sep 17 00:00:00 2001 From: cauefcr Date: Tue, 11 Oct 2022 14:22:58 -0300 Subject: [PATCH 1/2] [FIX] Actionable blocks are now sent to external integration --- apps/meteor/app/livechat/server/hooks/sendToCRM.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/meteor/app/livechat/server/hooks/sendToCRM.js b/apps/meteor/app/livechat/server/hooks/sendToCRM.js index 6dcb951b0bb2..32963984aa7a 100644 --- a/apps/meteor/app/livechat/server/hooks/sendToCRM.js +++ b/apps/meteor/app/livechat/server/hooks/sendToCRM.js @@ -1,4 +1,5 @@ import { isOmnichannelRoom } from '@rocket.chat/core-typings'; +import { dump } from 'js-yaml'; import { settings } from '../../../settings/server'; import { callbacks } from '../../../../lib/callbacks'; @@ -64,7 +65,8 @@ function sendToCRM(type, room, includeMessages = true) { const msg = { _id: message._id, username: message.u.username, - msg: message.msg, + msg: message.msg || dump(message.blocks), + ...(message.blocks && message.blocks.length > 0 ? { blocks: message.blocks } : {}), ts: message.ts, editedAt: message.editedAt, }; From ff8ee18d3bdb25ee1150106847f23f50172af580 Mon Sep 17 00:00:00 2001 From: cauefcr Date: Tue, 11 Oct 2022 14:59:07 -0300 Subject: [PATCH 2/2] no more yaml, json is the thing --- apps/meteor/app/livechat/server/hooks/sendToCRM.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/meteor/app/livechat/server/hooks/sendToCRM.js b/apps/meteor/app/livechat/server/hooks/sendToCRM.js index 32963984aa7a..1ce109eaf758 100644 --- a/apps/meteor/app/livechat/server/hooks/sendToCRM.js +++ b/apps/meteor/app/livechat/server/hooks/sendToCRM.js @@ -1,5 +1,4 @@ import { isOmnichannelRoom } from '@rocket.chat/core-typings'; -import { dump } from 'js-yaml'; import { settings } from '../../../settings/server'; import { callbacks } from '../../../../lib/callbacks'; @@ -65,7 +64,7 @@ function sendToCRM(type, room, includeMessages = true) { const msg = { _id: message._id, username: message.u.username, - msg: message.msg || dump(message.blocks), + msg: message.msg || JSON.stringify(message.blocks), ...(message.blocks && message.blocks.length > 0 ? { blocks: message.blocks } : {}), ts: message.ts, editedAt: message.editedAt,