From aa8396d4378e69d982302f59155b3f7ee4233877 Mon Sep 17 00:00:00 2001 From: Richards0n Date: Tue, 15 Oct 2024 18:01:57 -0300 Subject: [PATCH] refactor: Update content_attributes in ChatwootService This commit refactors the code in ChatwootService to update the content_attributes when replyToIds are present. Instead of directly spreading the replyToIds object, the code now converts it to a JSON string and appends it to the data object. Refactor the code to improve readability and maintainability. --- .../chatbot/chatwoot/services/chatwoot.service.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts index 5e0d01e5..9b63e46f 100644 --- a/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts +++ b/src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts @@ -954,9 +954,10 @@ export class ChatwootService { const replyToIds = await this.getReplyToIds(messageBody, instance); if (replyToIds.in_reply_to || replyToIds.in_reply_to_external_id) { - data.append('content_attributes', { - ...replyToIds, - }); + const content = JSON.stringify({ + ...replyToIds + }) + data.append('content_attributes', content); } }