fix: save contact by remote whatsapp session

feat-scaling-ticket-remote-creation
adriano 2024-03-07 19:38:22 -03:00
parent e020a5f75d
commit 279c4697dd
2 changed files with 9 additions and 4 deletions

View File

@ -25,7 +25,7 @@ const GetDefaultWhatsApp = async ({
where: { isDefault: true } where: { isDefault: true }
}); });
if (!defaultWhatsapp && !ignoreNoWhatsappFound) { if (!defaultWhatsapp) {
if (userId) { if (userId) {
let whatsapps = await wbotByUserQueue({ userId, queueId }); let whatsapps = await wbotByUserQueue({ userId, queueId });

View File

@ -30,6 +30,9 @@ const CheckIsValidContact = async (
let _status: any; let _status: any;
if (!isValidNumber) { if (!isValidNumber) {
console.log('kkkkkkkkkkkkkkkkkkkkkkkkkkkkk ')
const { data, status } = await axios.post( const { data, status } = await axios.post(
`${process.env.WHATS_NUMBER_VALIDATOR_URL}/api/validate`, `${process.env.WHATS_NUMBER_VALIDATOR_URL}/api/validate`,
{ mobile: number }, { mobile: number },
@ -45,6 +48,8 @@ const CheckIsValidContact = async (
} }
if (ignoreThrow) return isValidNumber?.number; if (ignoreThrow) return isValidNumber?.number;
console.log('_status: ', _status)
if (_status && _status == 422) throw new AppError("ERR_NO_WAPP_FOUND"); if (_status && _status == 422) throw new AppError("ERR_NO_WAPP_FOUND");
if (!isValidNumber || (isValidNumber && !isValidNumber.isValid)) { if (!isValidNumber || (isValidNumber && !isValidNumber.isValid)) {