mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-15 19:52:54 -06:00
feat: format participant phone number in messages
This commit is contained in:
parent
1665654676
commit
3d51b45e2b
@ -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}`;
|
||||
}
|
||||
@ -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}`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user