mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 20:22: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')) {
|
if (body.key.remoteJid.includes('@g.us')) {
|
||||||
const participantName = body.pushName;
|
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;
|
let content: string;
|
||||||
|
|
||||||
if (!body.key.fromMe) {
|
if (!body.key.fromMe) {
|
||||||
content = `**${participantName}:**\n\n${bodyMessage}`;
|
content = `**${formattedPhoneNumber} - ${participantName}:**\n\n${bodyMessage}`;
|
||||||
} else {
|
} else {
|
||||||
content = `${bodyMessage}`;
|
content = `${bodyMessage}`;
|
||||||
}
|
}
|
||||||
@ -2099,11 +2104,16 @@ export class ChatwootService {
|
|||||||
|
|
||||||
if (body.key.remoteJid.includes('@g.us')) {
|
if (body.key.remoteJid.includes('@g.us')) {
|
||||||
const participantName = body.pushName;
|
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;
|
let content: string;
|
||||||
|
|
||||||
if (!body.key.fromMe) {
|
if (!body.key.fromMe) {
|
||||||
content = `**${participantName}**\n\n${bodyMessage}`;
|
content = `**${formattedPhoneNumber} - ${participantName}:**\n\n${bodyMessage}`;
|
||||||
} else {
|
} else {
|
||||||
content = `${bodyMessage}`;
|
content = `${bodyMessage}`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user