mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 17:38:40 -06:00
Feat Reject Message If is not a valid wpp number
This commit is contained in:
parent
b09546577a
commit
b3adde3a7a
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"qrgeneratedsuccesfully": "QRCode successfully generated!",
|
"qrgeneratedsuccesfully": "QRCode successfully generated!",
|
||||||
"scanqr": "Scan this QR code within the next 40 seconds.",
|
"scanqr": "Scan this QR code within the next 40 seconds.",
|
||||||
"qrlimitreached": "QRCode generation limit reached, to generate a new QRCode, send the 'init' message again."
|
"qrlimitreached": "QRCode generation limit reached, to generate a new QRCode, send the 'init' message again.",
|
||||||
|
"numbernotinwhatsapp": "The message was not sent as the contact is not a valid Whatsapp number."
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"qrgeneratedsuccesfully": "QRCode gerado com sucesso!",
|
"qrgeneratedsuccesfully": "QRCode gerado com sucesso!",
|
||||||
"scanqr": "Escanei o QRCode com o Whatsapp nos próximos 40 segundos.",
|
"scanqr": "Escanei o QRCode com o Whatsapp nos próximos 40 segundos.",
|
||||||
"qrlimitreached": "Limite de geração de QRCode atingido! Para gerar um novo QRCode, envie o texto 'init' nesta conversa."
|
"qrlimitreached": "Limite de geração de QRCode atingido! Para gerar um novo QRCode, envie o texto 'init' nesta conversa.",
|
||||||
|
"numbernotinwhatsapp": "A mensagem não foi enviada, pois o contato não é um número válido do Whatsapp."
|
||||||
}
|
}
|
@ -1684,6 +1684,27 @@ export class ChatwootService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event === 'contact.is_not_in_wpp') {
|
||||||
|
const getConversation = await this.createConversation(instance, body);
|
||||||
|
|
||||||
|
if (!getConversation) {
|
||||||
|
this.logger.warn('conversation not found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
client.messages.create({
|
||||||
|
accountId: this.provider.account_id,
|
||||||
|
conversationId: getConversation,
|
||||||
|
data: {
|
||||||
|
content: `🚨 ${i18next.t('numbernotinwhatsapp')}`,
|
||||||
|
message_type: 'incoming',
|
||||||
|
private: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event === 'messages.upsert' || event === 'send.message') {
|
if (event === 'messages.upsert' || event === 'send.message') {
|
||||||
this.logger.verbose('event messages.upsert');
|
this.logger.verbose('event messages.upsert');
|
||||||
|
|
||||||
|
@ -2357,7 +2357,15 @@ export class WAStartupService {
|
|||||||
const isWA = (await this.whatsappNumber({ numbers: [number] }))?.shift();
|
const isWA = (await this.whatsappNumber({ numbers: [number] }))?.shift();
|
||||||
|
|
||||||
this.logger.verbose(`Exists: "${isWA.exists}" | jid: ${isWA.jid}`);
|
this.logger.verbose(`Exists: "${isWA.exists}" | jid: ${isWA.jid}`);
|
||||||
|
|
||||||
if (!isWA.exists && !isJidGroup(isWA.jid) && !isWA.jid.includes('@broadcast')) {
|
if (!isWA.exists && !isJidGroup(isWA.jid) && !isWA.jid.includes('@broadcast')) {
|
||||||
|
if (this.localChatwoot.enabled) {
|
||||||
|
const body = {
|
||||||
|
key: { remoteJid: isWA.jid },
|
||||||
|
};
|
||||||
|
|
||||||
|
this.chatwootService.eventWhatsapp('contact.is_not_in_wpp', { instanceName: this.instance.name }, body);
|
||||||
|
}
|
||||||
throw new BadRequestException(isWA);
|
throw new BadRequestException(isWA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user