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.
This commit is contained in:
Richards0n 2024-10-15 18:01:57 -03:00
parent ec2b7f94f8
commit aa8396d437

View File

@ -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);
}
}