Skip to content

Commit

Permalink
Merge pull request #1044 from Richards0nd/newPhoneNumberContent
Browse files Browse the repository at this point in the history
Adiciona o número de telefone do remetente nas mensagens recebidas do WhatsApp antes do nome do contato (GRUPOS)
  • Loading branch information
DavidsonGomes authored Nov 11, 2024
2 parents 997acee + 3d51b45 commit 084be1c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1970,11 +1970,16 @@ export class ChatwootService {

if (body.key.remoteJid.includes('@g.us')) {
const participantName = body.pushName;
const rawPhoneNumber = body.key.remoteJid.split('@')[0];
const formattedPhoneNumber = `+${rawPhoneNumber.slice(0, 2)} (${rawPhoneNumber.slice(
2,
4,
)}) ${rawPhoneNumber.slice(4, 8)}-${rawPhoneNumber.slice(8)}`;

let content: string;

if (!body.key.fromMe) {
content = `**${participantName}:**\n\n${bodyMessage}`;
content = `**${formattedPhoneNumber} - ${participantName}:**\n\n${bodyMessage}`;
} else {
content = `${bodyMessage}`;
}
Expand Down Expand Up @@ -2099,11 +2104,16 @@ export class ChatwootService {

if (body.key.remoteJid.includes('@g.us')) {
const participantName = body.pushName;
const rawPhoneNumber = body.key.remoteJid.split('@')[0];
const formattedPhoneNumber = `+${rawPhoneNumber.slice(0, 2)} (${rawPhoneNumber.slice(
2,
4,
)}) ${rawPhoneNumber.slice(4, 8)}-${rawPhoneNumber.slice(8)}`;

let content: string;

if (!body.key.fromMe) {
content = `**${participantName}**\n\n${bodyMessage}`;
content = `**${formattedPhoneNumber} - ${participantName}:**\n\n${bodyMessage}`;
} else {
content = `${bodyMessage}`;
}
Expand Down

0 comments on commit 084be1c

Please sign in to comment.