From e899945ca3c057b898046cd8f2c8c6ccc2aa7c82 Mon Sep 17 00:00:00 2001 From: server Date: Tue, 27 May 2025 15:57:43 -0600 Subject: [PATCH] =?UTF-8?q?Versi=C3=B3n=202.8.2=20Rutina=20de=20envio=20de?= =?UTF-8?q?=20mensajes=20con=20plantillas=20de=20utilidad=20refactorizado,?= =?UTF-8?q?=20adem=C3=A1s=20tipo=20de=20pago=20'applied=5Fto=5Fpayment'=20?= =?UTF-8?q?en=20en=20analisis=20de=20webhooks=20de=20Stripe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 15 + data/plugin.log | 1634 +++++++++++++++++- manifest.json | 2 +- src/Facade/AbstractMessageNotifierFacade.php | 337 ++-- src/Facade/ClientCallBellAPI.php | 275 +-- src/Plugin.php | 2 +- vendor/composer/installed.php | 4 +- 7 files changed, 1948 insertions(+), 321 deletions(-) diff --git a/README.md b/README.md index de7de33c..8b7ffe93 100755 --- a/README.md +++ b/README.md @@ -2,6 +2,21 @@ Este plugin sincroniza los clientes del sitema UISP CRM con los contactos de WhatsApp en CallBell, además procesa pagos de Stripe como las trasferencias bancarias y genera referencias de pago vía OXXO, además envía comprobantes de pago en formato imagen PNG o texto vía Whatsapp a los clientes +## REGISTRO DE CAMBIOS + +# VERSIÓN 2.8.2 + +## 🟡 Bugs Resueltos +* 1️⃣ No se enviaban las notificaciones de las tareas al instalador. Se cambió la plantilla de CallBell o WhatsApp con 3 variables en lugar de 8 +* 2️⃣ Se agregó un nuevo tipo de pago ("applied_to_payment") en las propiedades de los Webhooks recibidos mediante Stripe por concepto de transferencias bancarias. Ya que sólo se revisaba el tipo de pago "funded" y eso hacía que no enviara los comprobantes de pago a los clientes para todos los casos. + +## REGISTRO DE CAMBIOS +# VERSIÓN 2.8.1 + +## 🟡 Bugs Resueltos +* 1️⃣ No se enviaban las notificaciones de las tareas al instalador. + + # VERSIÓN 2.8.0 ## 🟢 Novedades diff --git a/data/plugin.log b/data/plugin.log index 271d9c87..b7804e30 100755 --- a/data/plugin.log +++ b/data/plugin.log @@ -1,79 +1,1609 @@ -[2025-05-22 0:19:08.747739] [notice] Logging level set to:debug -[2025-05-22 0:19:08.747998] [debug] valor del webhook: {"uuid":"aacaf5c5-2bf4-44ea-864f-a24121b453bb","changeType":"edit","entity":"client","entityId":"171","eventName":"client.edit","extraData":{"entity":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}} +[2025-05-27 19:40:02.717797] [notice] Logging level set to:debug +[2025-05-27 19:40:02.717979] [debug] valor del webhook: {"uuid":"2c3bf59c-e30c-4eed-a81a-5608c37d8a9e","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} -[2025-05-22 0:19:08.832132] [debug] valor el evento recibido por webhook: client.edit +[2025-05-27 19:40:02.754940] [debug] valor el evento recibido por webhook: job.edit -[2025-05-22 0:19:08.832314] [debug] Valor de JSON: {"uuid":"aacaf5c5-2bf4-44ea-864f-a24121b453bb","changeType":"edit","entity":"client","entityId":"171","eventName":"client.edit","extraData":{"entity":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}} +[2025-05-27 19:40:02.755151] [debug] Valor de JSON: {"uuid":"2c3bf59c-e30c-4eed-a81a-5608c37d8a9e","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} -[2025-05-22 0:19:08.832559] [debug] Se actualiza a un cliente -[2025-05-22 0:19:08.832638] [debug] Valor de json_data: {"uuid":"aacaf5c5-2bf4-44ea-864f-a24121b453bb","changeType":"edit","entity":"client","entityId":"171","eventName":"client.edit","extraData":{"entity":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}} -[2025-05-22 0:19:08.882267] [info] El valor de passwordAntenaValue es null o cadena vacía, se manda llamar la función getVaultCredentials +[2025-05-27 19:40:02.755408] [debug] Se actualiza un trabajo -[2025-05-22 0:19:08.882406] [info] El valor de password es: gYAIEK:Be}SK*01z5+/V +[2025-05-27 19:40:02.755462] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:40:18.488338] [notice] Logging level set to:debug +[2025-05-27 19:40:18.488765] [debug] valor del webhook: {"uuid":"20c5620b-ba71-4362-b8c0-c52058ea4bd7","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} -[2025-05-22 0:19:08.908850] [info] Error al hacer el patch al CRM: Client error: `PATCH https://172.16.5.134/crm/api/v1.0/clients/` resulted in a `404 Not Found` response: -{"code":404,"message":"Not Found"} +[2025-05-27 19:40:18.517045] [debug] valor el evento recibido por webhook: job.edit +[2025-05-27 19:40:18.517190] [debug] Valor de JSON: {"uuid":"20c5620b-ba71-4362-b8c0-c52058ea4bd7","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} -[2025-05-22 0:19:08.909379] [info] No se pudo actualizar el atributo personalizado passwordAntenaCliente +[2025-05-27 19:40:18.517429] [debug] Se actualiza un trabajo -[2025-05-22 0:19:08.909471] [debug] El cliente no cambió de potencial a cliente -[2025-05-22 0:19:08.909513] [debug] Validando claves dentro de entity y entityBeforeEdit -[2025-05-22 0:19:08.909550] [debug] Los datos entity y entityBeforeEdit contienen el campo tags -[2025-05-22 0:19:08.909586] [debug] Validando si la etiqueta STRIPE existe en entity pero no en entityBeforeEdit -[2025-05-22 0:19:08.909647] [debug] {"uuid":"aacaf5c5-2bf4-44ea-864f-a24121b453bb","changeType":"edit","entity":"client","entityId":171,"message":null,"clientId":171,"eventName":"client.edit","clientData":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":null} +[2025-05-27 19:40:18.517484] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:40:22.115401] [notice] Logging level set to:debug +[2025-05-27 19:40:22.115725] [debug] valor del webhook: {"uuid":"39c96b62-1a12-411b-af38-fe166a6febf8","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} -[2025-05-22 0:50:23.408159] [notice] Logging level set to:debug -[2025-05-22 0:50:23.408576] [debug] valor del webhook: {"uuid":"facafe19-431f-4067-91e1-337e78b93231","changeType":"edit","entity":"client","entityId":"171","eventName":"client.edit","extraData":{"entity":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}} +[2025-05-27 19:40:22.148391] [debug] valor el evento recibido por webhook: job.edit -[2025-05-22 0:50:23.482923] [debug] valor el evento recibido por webhook: client.edit +[2025-05-27 19:40:22.148564] [debug] Valor de JSON: {"uuid":"39c96b62-1a12-411b-af38-fe166a6febf8","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} -[2025-05-22 0:50:23.483145] [debug] Valor de JSON: {"uuid":"facafe19-431f-4067-91e1-337e78b93231","changeType":"edit","entity":"client","entityId":"171","eventName":"client.edit","extraData":{"entity":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}} +[2025-05-27 19:40:22.148753] [debug] Se actualiza un trabajo -[2025-05-22 0:50:23.483393] [debug] Se actualiza a un cliente -[2025-05-22 0:50:23.483474] [debug] Valor de json_data: {"uuid":"facafe19-431f-4067-91e1-337e78b93231","changeType":"edit","entity":"client","entityId":"171","eventName":"client.edit","extraData":{"entity":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}} -[2025-05-22 0:50:23.530049] [info] ID correspondiente a 'passwordAntenaCliente': 17 +[2025-05-27 19:40:22.148828] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:40:22.148880] [debug] El instalador cambió de null a un valor +[2025-05-27 19:40:22.148942] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** -[2025-05-22 0:50:23.530293] [info] El valor de passwordAntenaValue es null o cadena vacía, se manda llamar la función getVaultCredentials +[2025-05-27 19:40:22.149050] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"39c96b62-1a12-411b-af38-fe166a6febf8","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} -[2025-05-22 0:50:23.530349] [info] El valor de password es: gYAIEK:Be}SK*01z5+/V +[2025-05-27 19:40:22.149111] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"39c96b62-1a12-411b-af38-fe166a6febf8","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":0,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} -[2025-05-22 0:50:23.651010] [info] Se actualizó el custom attribute del cliente 171 +[2025-05-27 19:40:22.149173] [debug] Valor de $reprogramming en verifyJobActionToDo: false -[2025-05-22 0:50:23.651479] [info] Se actualizó el atributo personalizado passwordAntenaCliente con el valor: gYAIEK:Be}SK*01z5+/V +[2025-05-27 19:40:22.149221] [debug] Valor de $changeInstaller en verifyJobActionToDo: false -[2025-05-22 0:50:23.651519] [debug] El cliente no cambió de potencial a cliente -[2025-05-22 0:50:23.651531] [debug] Validando claves dentro de entity y entityBeforeEdit -[2025-05-22 0:50:23.651540] [debug] Los datos entity y entityBeforeEdit contienen el campo tags -[2025-05-22 0:50:23.651549] [debug] Validando si la etiqueta STRIPE existe en entity pero no en entityBeforeEdit -[2025-05-22 0:50:23.651587] [debug] {"uuid":"facafe19-431f-4067-91e1-337e78b93231","changeType":"edit","entity":"client","entityId":171,"message":null,"clientId":171,"eventName":"client.edit","clientData":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":null} +[2025-05-27 19:40:22.149281] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} -[2025-05-22 0:50:23.651621] [info] Procesando tipo de contacto original: 'WhatsNotifica' -[2025-05-22 0:50:23.651632] [info] Tipo de contacto normalizado: 'whatsnotifica' -[2025-05-22 0:50:23.651640] [info] Tipo de contacto no reconocido: 'whatsnotifica' +[2025-05-27 19:40:22.190372] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1019,"unmsId":"75e00242-86c2-436a-b3ac-bd6c31db681e","email":"lionelmuz@gmail.com","firstName":"Mucio","lastName":"Robledo Villegas","username":"muz","avatarColor":"#8bc34a","isActive":true} -[2025-05-22 0:50:23.804236] [notice] Logging level set to:debug -[2025-05-22 0:50:23.804312] [debug] valor del webhook: {"uuid":"aff6b505-571d-4e30-9d18-355a25aaed8a","changeType":"edit","entity":"client","entityId":"171","eventName":"client.edit","extraData":{"entity":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true},{"id":201,"clientId":171,"customAttributeId":17,"name":"Password Antena Cliente","key":"passwordAntenaCliente","value":"gYAIEK:Be}SK*01z5+\/V","clientZoneVisible":false}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}} +[2025-05-27 19:40:22.190506] [debug] Número de WhatsApp del Instalador: 4181878106 -[2025-05-22 0:50:23.907448] [debug] valor el evento recibido por webhook: client.edit +[2025-05-27 19:40:22.221954] [debug] Valor de $installerFullName: Mucio Robledo Villegas -[2025-05-22 0:50:23.907525] [debug] Valor de JSON: {"uuid":"aff6b505-571d-4e30-9d18-355a25aaed8a","changeType":"edit","entity":"client","entityId":"171","eventName":"client.edit","extraData":{"entity":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true},{"id":201,"clientId":171,"customAttributeId":17,"name":"Password Antena Cliente","key":"passwordAntenaCliente","value":"gYAIEK:Be}SK*01z5+\/V","clientZoneVisible":false}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}} +[2025-05-27 19:40:22.287362] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 -[2025-05-22 0:50:23.907630] [debug] Se actualiza a un cliente -[2025-05-22 0:50:23.907670] [debug] Valor de json_data: {"uuid":"aff6b505-571d-4e30-9d18-355a25aaed8a","changeType":"edit","entity":"client","entityId":"171","eventName":"client.edit","extraData":{"entity":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true},{"id":201,"clientId":171,"customAttributeId":17,"name":"Password Antena Cliente","key":"passwordAntenaCliente","value":"gYAIEK:Be}SK*01z5+\/V","clientZoneVisible":false}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}} -[2025-05-22 0:50:23.980391] [info] ID correspondiente a 'passwordAntenaCliente': 17 +[2025-05-27 19:40:22.287406] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] -[2025-05-22 0:50:23.980431] [info] El valor de passwordAntenaValue es: gYAIEK:Be}SK*01z5+/V +[2025-05-27 19:40:22.287491] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] -[2025-05-22 0:50:23.980442] [info] Ya existe un valor de passwordAntenaValue: gYAIEK:Be}SK*01z5+/V +[2025-05-27 19:40:22.291043] [debug] Se encontró un tipo de contacto whatsapp -[2025-05-22 0:50:23.980453] [debug] El cliente no cambió de potencial a cliente -[2025-05-22 0:50:23.980462] [debug] Validando claves dentro de entity y entityBeforeEdit -[2025-05-22 0:50:23.980468] [debug] Los datos entity y entityBeforeEdit contienen el campo tags -[2025-05-22 0:50:23.980474] [debug] Validando si la etiqueta STRIPE existe en entity pero no en entityBeforeEdit -[2025-05-22 0:50:23.980510] [debug] {"uuid":"aff6b505-571d-4e30-9d18-355a25aaed8a","changeType":"edit","entity":"client","entityId":171,"message":null,"clientId":171,"eventName":"client.edit","clientData":{"id":171,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"Campeche 56","street2":null,"city":"Dolores Hidalgo","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Campeche 56, Dolores Hidalgo, 37800","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-05-21T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Archi","lastName":"Isalas","username":"mainstreamm2@gmail.com","contacts":[{"id":177,"clientId":171,"email":"mainstreamm2@gmail.com","phone":"4181878106","name":null,"isBilling":false,"isContact":false,"types":[{"id":1003,"name":"WhatsNotifica"}]}],"attributes":[{"id":198,"clientId":171,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_SM2zH6IsjTz6ol","clientZoneVisible":true},{"id":199,"clientId":171,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"124180950530868794","clientZoneVisible":true},{"id":201,"clientId":171,"customAttributeId":17,"name":"Password Antena Cliente","key":"passwordAntenaCliente","value":"gYAIEK:Be}SK*01z5+\/V","clientZoneVisible":false}],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1572461,"addressGpsLon":-100.9377137,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":true,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":null} +Enviando mensaje de trabajo para el cliente -[2025-05-22 0:50:23.980546] [info] Procesando tipo de contacto original: 'WhatsNotifica' -[2025-05-22 0:50:23.980556] [info] Tipo de contacto normalizado: 'whatsnotifica' -[2025-05-22 0:50:23.980564] [info] Tipo de contacto no reconocido: 'whatsnotifica' +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: false + +DEBUG: Valores antes de la estructura IF - Reprogramming: false, ChangeInstaller: false + +Enviando notificación normal de visita técnica al cliente, valor de reprogramming y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "#️⃣ *54*", "🗓️ *31/05/2025* a las 🕑 *02:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Mucio Robledo Villegas*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "07cfbc6e394044608485b530a27177d0", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"4d5485cf19a1485ead111be93be148a1","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:40:23.157758] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 19:40:23.157871] [debug] Valor de $title en verifyJobActionToDo: [NOTIFICACION-PENDIENTE]Ir a checar instalación + +[2025-05-27 19:40:23.239495] [debug] Valor de $title después de quitar el prefijo en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:40:23.239542] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: false, ChangeInstaller: false + +[2025-05-27 19:40:23.239552] [debug] No se cambió el instalador + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Mucio Robledo Villegas","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*31\/05\/2025* a las \ud83d\udd51 *02:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: false + +Enviando notificación normal de tarea al instalador, valor de reprogramming y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ *Mucio Robledo Villegas* se te ha asignado una tarea con folio #️⃣ *54* para el cliente 👤 *[2] Daniel Humberto Soto Villegas*, para el 🗓️ *31/05/2025* a las 🕑 *02:00 PM* aproximadamente", "5214181878106, 5214181148783", "https://www.google.com/maps?q=21.1564209,-100.9384185", "gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "88eeb6420a214fd8870dd28d741021c4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"f415a5bd6dff4af09ada6e1cc01b43c6","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:40:24.125391] [notice] Logging level set to:debug +[2025-05-27 19:40:24.125544] [debug] valor del webhook: {"uuid":"ec39e43a-c954-40ce-838a-bb70085b8875","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:40:24.166703] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 19:40:24.166842] [debug] Valor de JSON: {"uuid":"ec39e43a-c954-40ce-838a-bb70085b8875","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"[NOTIFICACION-PENDIENTE]Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:40:24.166976] [debug] Se actualiza un trabajo + +[2025-05-27 19:40:24.169734] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:40:24.169838] [debug] No hubo cambio en el instalador ni en la fecha +[2025-05-27 19:40:59.270200] [notice] Logging level set to:debug +[2025-05-27 19:40:59.270286] [debug] valor del webhook: {"uuid":"a6d8aeec-910b-40ad-b0c1-5881b16a31fe","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:40:59.301765] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 19:40:59.301824] [debug] Valor de JSON: {"uuid":"a6d8aeec-910b-40ad-b0c1-5881b16a31fe","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:40:59.306039] [debug] Se actualiza un trabajo + +[2025-05-27 19:40:59.306077] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:40:59.306092] [debug] Se reprogramó el trabajo pero no hubo cambio de instalador +[2025-05-27 19:40:59.306116] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 19:40:59.306178] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"a6d8aeec-910b-40ad-b0c1-5881b16a31fe","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:40:59.306195] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"a6d8aeec-910b-40ad-b0c1-5881b16a31fe","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T14:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:40:59.306205] [debug] Valor de $reprogramming en verifyJobActionToDo: true + +[2025-05-27 19:40:59.306211] [debug] Valor de $changeInstaller en verifyJobActionToDo: false + +[2025-05-27 19:40:59.306229] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 19:40:59.346400] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1019,"unmsId":"75e00242-86c2-436a-b3ac-bd6c31db681e","email":"lionelmuz@gmail.com","firstName":"Mucio","lastName":"Robledo Villegas","username":"muz","avatarColor":"#8bc34a","isActive":true} + +[2025-05-27 19:40:59.346460] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 19:40:59.376843] [debug] Valor de $installerFullName: Mucio Robledo Villegas + +[2025-05-27 19:40:59.441556] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 19:40:59.441606] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:40:59.441694] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:40:59.441740] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +DEBUG: Valores antes de la estructura IF - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al cliente, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "#️⃣ *54*", "🗓️ *31/05/2025* a las 🕒 *03:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Mucio Robledo Villegas*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "bd305d6dba7449e9a6609d5ed434a6c9", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"7a12abbe36914aa891c676991645d07f","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:41:00.242465] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 19:41:00.242716] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:41:00.242844] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:41:00.242968] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: true, ChangeInstaller: false + +[2025-05-27 19:41:00.243113] [debug] No se cambió el instalador + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Mucio Robledo Villegas","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*31\/05\/2025* a las \ud83d\udd52 *03:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al instalador, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ Mucio Robledo Villegas", "#️⃣54", "👤 *[2] Daniel Humberto Soto Villegas*", "☎️ 5214181878106, 5214181148783", "🗓️ *31/05/2025* a las 🕒 *03:00 PM* aproximadamente", "🛠️ Andan mal esos equipos", "📌 https://www.google.com/maps?q=21.1564209,-100.9384185", "🔐 gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "7eb4d8e27cf740779dd6777fad7ffaf4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"6fa8178b72db4e97962c39372ea3d017","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:41:48.988986] [notice] Logging level set to:debug +[2025-05-27 19:41:48.989092] [debug] valor del webhook: {"uuid":"c2e9277f-ab83-4281-9c76-59fd9793ca9d","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:41:49.022665] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 19:41:49.022722] [debug] Valor de JSON: {"uuid":"c2e9277f-ab83-4281-9c76-59fd9793ca9d","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:41:49.022926] [debug] Se actualiza un trabajo + +[2025-05-27 19:41:49.022953] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:41:49.022965] [debug] Se reprogramó el trabajo pero no hubo cambio de instalador +[2025-05-27 19:41:49.023005] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 19:41:49.023061] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"c2e9277f-ab83-4281-9c76-59fd9793ca9d","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:41:49.023078] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"c2e9277f-ab83-4281-9c76-59fd9793ca9d","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:41:49.023089] [debug] Valor de $reprogramming en verifyJobActionToDo: true + +[2025-05-27 19:41:49.023097] [debug] Valor de $changeInstaller en verifyJobActionToDo: false + +[2025-05-27 19:41:49.023113] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 19:41:49.055370] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1019,"unmsId":"75e00242-86c2-436a-b3ac-bd6c31db681e","email":"lionelmuz@gmail.com","firstName":"Mucio","lastName":"Robledo Villegas","username":"muz","avatarColor":"#8bc34a","isActive":true} + +[2025-05-27 19:41:49.055422] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 19:41:49.088267] [debug] Valor de $installerFullName: Mucio Robledo Villegas + +[2025-05-27 19:41:49.152280] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 19:41:49.152425] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:41:49.152553] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:41:49.152632] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +DEBUG: Valores antes de la estructura IF - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al cliente, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "#️⃣ *54*", "🗓️ *01/06/2025* a las 🕒 *03:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Mucio Robledo Villegas*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "bd305d6dba7449e9a6609d5ed434a6c9", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"80891af075ea4666b1f4ee78f6025f2b","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:41:49.910507] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 19:41:49.911957] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:41:49.912060] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:41:49.912112] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: true, ChangeInstaller: false + +[2025-05-27 19:41:49.912153] [debug] No se cambió el instalador + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Mucio Robledo Villegas","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*01\/06\/2025* a las \ud83d\udd52 *03:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al instalador, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ Mucio Robledo Villegas", "#️⃣54", "👤 *[2] Daniel Humberto Soto Villegas*", "☎️ 5214181878106, 5214181148783", "🗓️ *01/06/2025* a las 🕒 *03:00 PM* aproximadamente", "🛠️ Andan mal esos equipos", "📌 https://www.google.com/maps?q=21.1564209,-100.9384185", "🔐 gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "7eb4d8e27cf740779dd6777fad7ffaf4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"3d5205625582496dba10e31b9e160e59","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:43:34.192425] [notice] Logging level set to:debug +[2025-05-27 19:43:34.192593] [debug] valor del webhook: {"uuid":"5caa3376-db6d-4436-9b7c-26a44593ee91","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:43:34.217736] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 19:43:34.217983] [debug] Valor de JSON: {"uuid":"5caa3376-db6d-4436-9b7c-26a44593ee91","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:43:34.218236] [debug] Se actualiza un trabajo + +[2025-05-27 19:43:34.218296] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:43:34.218337] [debug] No hay reprogramación de trabajo pero si hay cambio de instalador +[2025-05-27 19:43:34.218386] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 19:43:34.218468] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"5caa3376-db6d-4436-9b7c-26a44593ee91","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:43:34.218513] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"5caa3376-db6d-4436-9b7c-26a44593ee91","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:43:34.218561] [debug] Valor de $reprogramming en verifyJobActionToDo: false + +[2025-05-27 19:43:34.218596] [debug] Valor de $changeInstaller en verifyJobActionToDo: true + +[2025-05-27 19:43:34.218641] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 19:43:34.250261] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1173,"unmsId":"5cb37ee8-e445-4b2a-87d4-6c83eebb8944","email":"hachi9801@gmail.com","firstName":"\u00c1ngel ","lastName":"Arvizu","username":"mamey","avatarColor":"#4caf50","isActive":true} + +[2025-05-27 19:43:34.250392] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 19:43:34.289427] [debug] Valor de $installerFullName: Ángel Arvizu + +[2025-05-27 19:43:34.380695] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 19:43:34.380831] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:43:34.380950] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:43:34.381031] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: true + +DEBUG: Valores antes de la estructura IF - Reprogramming: false, ChangeInstaller: true + +Enviando notificación de cambio de instalador al cliente, valor de reprogramming y valor de changeInstaller 1 + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "se ha hecho un cambio de técnico 👷🏻‍♂️🔄 para su visita con el folio #️⃣54", "🗓️ *01/06/2025* a las 🕒 *03:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Ángel Arvizu*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "d684e6fa2ba24593a86c98be1815831d", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"82c60cbad5864cf6aefa023f08c031fe","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:43:37.156166] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 19:43:37.156404] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:43:37.156528] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:43:37.156649] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: false, ChangeInstaller: true + +[2025-05-27 19:43:37.156757] [debug] Se cambió el instalador, por lo tanto se procede a enviarle mensaje al que se le desasignó + +[2025-05-27 19:43:37.203649] [debug] Se encontró el Whatsapp del instalador anterior en el JSON y es: 4181878106 + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"\ud83d\udc77\ud83c\udffb\u200d\u2642\ufe0fMucio Robledo Villegas","subjectOfChange":"se te ha desasignado\u274c la tarea con el folio ","jobId":"54","clientFullName":"[2] Daniel Humberto Soto Villegas","additionalChangeData":"En tu lugar asistir\u00e1 el t\u00e9cnico \ud83d\udc77\ud83c\udffb\u200d\u2642\ufe0f\u27a1\ufe0f *\u00c1ngel Arvizu*"} + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: true + +Enviando notificación de cambio de instalador al instalador anterior, valor de reprogramming y valor de changeInstaller 1 + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ 👷🏻‍♂️Mucio Robledo Villegas", "se te ha desasignado❌ la tarea con el folio ", "#️⃣ *54*", "👤 *Cliente:* [2] Daniel Humberto Soto Villegas", "En tu lugar asistirá el técnico 👷🏻‍♂️➡️ *Ángel Arvizu*"], + "template_uuid": "e1aa2b0fd3884595918f4ac2676acd29", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"5ecd5408de09407cb5d94a130f29fb1b","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"\u00c1ngel Arvizu","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*01\/06\/2025* a las \ud83d\udd52 *03:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: false + +Enviando notificación normal de tarea al instalador, valor de reprogramming y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ *Ángel Arvizu* se te ha asignado una tarea con folio #️⃣ *54* para el cliente 👤 *[2] Daniel Humberto Soto Villegas*, para el 🗓️ *01/06/2025* a las 🕒 *03:00 PM* aproximadamente", "5214181878106, 5214181148783", "https://www.google.com/maps?q=21.1564209,-100.9384185", "gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "88eeb6420a214fd8870dd28d741021c4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"47440a12254f47e9aff6c644388dce3a","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:50:08.698178] [notice] Logging level set to:debug +[2025-05-27 19:50:08.698266] [debug] valor del webhook: {"uuid":"730230ec-5c3d-4efc-91e0-077e7cd186b3","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:50:08.722898] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 19:50:08.722955] [debug] Valor de JSON: {"uuid":"730230ec-5c3d-4efc-91e0-077e7cd186b3","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:50:08.723223] [debug] Se actualiza un trabajo + +[2025-05-27 19:50:08.723248] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:50:08.723261] [debug] No hay reprogramación de trabajo pero si hay cambio de instalador +[2025-05-27 19:50:08.723282] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 19:50:08.723334] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"730230ec-5c3d-4efc-91e0-077e7cd186b3","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:50:08.723351] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"730230ec-5c3d-4efc-91e0-077e7cd186b3","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:50:08.723361] [debug] Valor de $reprogramming en verifyJobActionToDo: false + +[2025-05-27 19:50:08.723368] [debug] Valor de $changeInstaller en verifyJobActionToDo: true + +[2025-05-27 19:50:08.723383] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 19:50:08.755670] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1172,"unmsId":"2ac31363-6037-40f3-8196-5cc7c71866b0","email":"amazonrostro@gmail.com","firstName":"Juan","lastName":"Rostro","username":"rostro","avatarColor":"#00695c","isActive":true} + +[2025-05-27 19:50:08.755726] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 19:50:08.791166] [debug] Valor de $installerFullName: Juan Rostro + +[2025-05-27 19:50:08.882389] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 19:50:08.882513] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:50:08.882635] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:50:08.889816] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: true + +DEBUG: Valores antes de la estructura IF - Reprogramming: false, ChangeInstaller: true + +Enviando notificación de cambio de instalador al cliente, valor de reprogramming y valor de changeInstaller 1 + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "se ha hecho un cambio de técnico 👷🏻‍♂️🔄 para su visita con el folio *#️⃣54*", "🗓️ *01/06/2025* a las 🕒 *03:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Juan Rostro*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "d684e6fa2ba24593a86c98be1815831d", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"333acd343aea4583aa8887231437934c","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:50:09.952290] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 19:50:09.952542] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:50:09.952667] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:50:09.952792] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: false, ChangeInstaller: true + +[2025-05-27 19:50:09.952898] [debug] Se cambió el instalador, por lo tanto se procede a enviarle mensaje al que se le desasignó + +[2025-05-27 19:50:09.997595] [debug] Se encontró el Whatsapp del instalador anterior en el JSON y es: 4181878106 + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"\ud83d\udc77\ud83c\udffb\u200d\u2642\ufe0f\u00c1ngel Arvizu","subjectOfChange":"se te ha desasignado\u274c la tarea con el folio ","jobId":"54","clientFullName":"[2] Daniel Humberto Soto Villegas","additionalChangeData":"En tu lugar asistir\u00e1 el t\u00e9cnico \ud83d\udc77\ud83c\udffb\u200d\u2642\ufe0f\u27a1\ufe0f *Juan Rostro*"} + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: true + +Enviando notificación de cambio de instalador al instalador anterior, valor de reprogramming y valor de changeInstaller 1 + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ 👷🏻‍♂️Ángel Arvizu", "se te ha desasignado❌ la tarea con el folio ", "*#️⃣54*", "👤 *Cliente:* [2] Daniel Humberto Soto Villegas", "En tu lugar asistirá el técnico 👷🏻‍♂️➡️ *Juan Rostro*"], + "template_uuid": "e1aa2b0fd3884595918f4ac2676acd29", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"086ab88a6c324fd99e18818eaf813c34","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Juan Rostro","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*01\/06\/2025* a las \ud83d\udd52 *03:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: false + +Enviando notificación normal de tarea al instalador, valor de reprogramming y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ *Juan Rostro* se te ha asignado una tarea con folio #️⃣ *54* para el cliente 👤 *[2] Daniel Humberto Soto Villegas*, para el 🗓️ *01/06/2025* a las 🕒 *03:00 PM* aproximadamente", "5214181878106, 5214181148783", "https://www.google.com/maps?q=21.1564209,-100.9384185", "gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "88eeb6420a214fd8870dd28d741021c4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"84e09dfcabda413a91da94d0c0f15309","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:51:12.870804] [notice] Logging level set to:debug +[2025-05-27 19:51:12.870893] [debug] valor del webhook: {"uuid":"6bf67e7d-27bc-4415-927a-bd3baf024e07","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:51:12.903228] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 19:51:12.903374] [debug] Valor de JSON: {"uuid":"6bf67e7d-27bc-4415-927a-bd3baf024e07","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:51:12.903606] [debug] Se actualiza un trabajo + +[2025-05-27 19:51:12.903666] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:51:12.903707] [debug] No hay reprogramación de trabajo pero si hay cambio de instalador +[2025-05-27 19:51:12.903757] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 19:51:12.903840] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"6bf67e7d-27bc-4415-927a-bd3baf024e07","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:51:12.903883] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"6bf67e7d-27bc-4415-927a-bd3baf024e07","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1172,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:51:12.903932] [debug] Valor de $reprogramming en verifyJobActionToDo: false + +[2025-05-27 19:51:12.903966] [debug] Valor de $changeInstaller en verifyJobActionToDo: true + +[2025-05-27 19:51:12.904011] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 19:51:12.936723] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1173,"unmsId":"5cb37ee8-e445-4b2a-87d4-6c83eebb8944","email":"hachi9801@gmail.com","firstName":"\u00c1ngel ","lastName":"Arvizu","username":"mamey","avatarColor":"#4caf50","isActive":true} + +[2025-05-27 19:51:12.936779] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 19:51:12.969682] [debug] Valor de $installerFullName: Ángel Arvizu + +[2025-05-27 19:51:13.033044] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 19:51:13.033173] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:51:13.033299] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:51:13.036921] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: true + +DEBUG: Valores antes de la estructura IF - Reprogramming: false, ChangeInstaller: true + +Enviando notificación de cambio de instalador al cliente, valor de reprogramming y valor de changeInstaller 1 + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "se ha hecho un cambio de técnico 👷🏻‍♂️🔄 para su visita con el folio *#️⃣54*", "🗓️ *01/06/2025* a las 🕒 *03:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Ángel Arvizu*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "d684e6fa2ba24593a86c98be1815831d", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"2dcb1e3560e04e4fb46b2e1cb713af52","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:51:13.863202] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 19:51:13.863461] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:51:13.863588] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:51:13.863708] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: false, ChangeInstaller: true + +[2025-05-27 19:51:13.863816] [debug] Se cambió el instalador, por lo tanto se procede a enviarle mensaje al que se le desasignó + +[2025-05-27 19:51:13.903022] [debug] Se encontró el Whatsapp del instalador anterior en el JSON y es: 4181878106 + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"\ud83d\udc77\ud83c\udffb\u200d\u2642\ufe0fJuan Rostro","subjectOfChange":"se te ha desasignado\u274c la tarea con el folio ","jobId":"54","clientFullName":"[2] Daniel Humberto Soto Villegas","additionalChangeData":"En tu lugar asistir\u00e1 el t\u00e9cnico \ud83d\udc77\ud83c\udffb\u200d\u2642\ufe0f\u27a1\ufe0f *\u00c1ngel Arvizu*"} + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: true + +Enviando notificación de cambio de instalador al instalador anterior, valor de reprogramming y valor de changeInstaller 1 + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ 👷🏻‍♂️Juan Rostro", "se te ha desasignado❌ la tarea con el folio ", "#️⃣54", "👤 *Cliente:* [2] Daniel Humberto Soto Villegas", "En tu lugar asistirá el técnico 👷🏻‍♂️➡️ *Ángel Arvizu*"], + "template_uuid": "e1aa2b0fd3884595918f4ac2676acd29", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"21388adec3424cfb9aa756866ea72e01","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"\u00c1ngel Arvizu","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*01\/06\/2025* a las \ud83d\udd52 *03:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: false + +Enviando notificación normal de tarea al instalador, valor de reprogramming y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ *Ángel Arvizu* se te ha asignado una tarea con folio #️⃣ *54* para el cliente 👤 *[2] Daniel Humberto Soto Villegas*, para el 🗓️ *01/06/2025* a las 🕒 *03:00 PM* aproximadamente", "5214181878106, 5214181148783", "https://www.google.com/maps?q=21.1564209,-100.9384185", "gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "88eeb6420a214fd8870dd28d741021c4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"5783461740e94e17833903ffe4857953","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:51:39.691133] [notice] Logging level set to:debug +[2025-05-27 19:51:39.691446] [debug] valor del webhook: {"uuid":"98bd750d-1777-4f22-a7fc-f56a0dc51378","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:51:39.722738] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 19:51:39.722908] [debug] Valor de JSON: {"uuid":"98bd750d-1777-4f22-a7fc-f56a0dc51378","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:51:39.723180] [debug] Se actualiza un trabajo + +[2025-05-27 19:51:39.723241] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 19:51:39.723280] [debug] Se reprogramó el trabajo pero no hubo cambio de instalador +[2025-05-27 19:51:39.723331] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 19:51:39.723414] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"98bd750d-1777-4f22-a7fc-f56a0dc51378","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:51:39.723459] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"98bd750d-1777-4f22-a7fc-f56a0dc51378","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-06-01T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 19:51:39.723498] [debug] Valor de $reprogramming en verifyJobActionToDo: true + +[2025-05-27 19:51:39.723531] [debug] Valor de $changeInstaller en verifyJobActionToDo: false + +[2025-05-27 19:51:39.723573] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 19:51:39.757066] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1173,"unmsId":"5cb37ee8-e445-4b2a-87d4-6c83eebb8944","email":"hachi9801@gmail.com","firstName":"\u00c1ngel ","lastName":"Arvizu","username":"mamey","avatarColor":"#4caf50","isActive":true} + +[2025-05-27 19:51:39.757194] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 19:51:39.787755] [debug] Valor de $installerFullName: Ángel Arvizu + +[2025-05-27 19:51:39.850306] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 19:51:39.850421] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:51:39.850542] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 19:51:39.850616] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +DEBUG: Valores antes de la estructura IF - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al cliente, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "*#️⃣54*", "🗓️ *28/05/2025* a las 🕒 *03:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Ángel Arvizu*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "bd305d6dba7449e9a6609d5ed434a6c9", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"f2d2a0b49564490ab8a2b8b1ae50f8ce","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 19:51:40.606304] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 19:51:40.606411] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:51:40.606443] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 19:51:40.606477] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: true, ChangeInstaller: false + +[2025-05-27 19:51:40.606498] [debug] No se cambió el instalador + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"\u00c1ngel Arvizu","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*28\/05\/2025* a las \ud83d\udd52 *03:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al instalador, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ Ángel Arvizu", "#️⃣54", "👤 *[2] Daniel Humberto Soto Villegas*", "☎️ 5214181878106, 5214181148783", "🗓️ *28/05/2025* a las 🕒 *03:00 PM* aproximadamente", "🛠️ Andan mal esos equipos", "📌 https://www.google.com/maps?q=21.1564209,-100.9384185", "🔐 gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "7eb4d8e27cf740779dd6777fad7ffaf4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"56edf338abde417187ce3d229cd1c1ea","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 20:12:04.394680] [notice] Logging level set to:debug +[2025-05-27 20:12:04.394767] [debug] valor del webhook: {"uuid":"db71a6aa-65c0-40e2-90a5-6814ead7c6f2","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:12:04.419981] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 20:12:04.420041] [debug] Valor de JSON: {"uuid":"db71a6aa-65c0-40e2-90a5-6814ead7c6f2","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:12:04.420254] [debug] Se actualiza un trabajo + +[2025-05-27 20:12:04.420275] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 20:12:04.420288] [debug] No hay reprogramación de trabajo pero si hay cambio de instalador +[2025-05-27 20:12:04.420310] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 20:12:04.420361] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"db71a6aa-65c0-40e2-90a5-6814ead7c6f2","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:12:04.420377] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"db71a6aa-65c0-40e2-90a5-6814ead7c6f2","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1173,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:12:04.420387] [debug] Valor de $reprogramming en verifyJobActionToDo: false + +[2025-05-27 20:12:04.420394] [debug] Valor de $changeInstaller en verifyJobActionToDo: true + +[2025-05-27 20:12:04.420413] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 20:12:04.456681] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1019,"unmsId":"75e00242-86c2-436a-b3ac-bd6c31db681e","email":"lionelmuz@gmail.com","firstName":"Mucio","lastName":"Robledo Villegas","username":"muz","avatarColor":"#8bc34a","isActive":true} + +[2025-05-27 20:12:04.456734] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 20:12:04.498831] [debug] Valor de $installerFullName: Mucio Robledo Villegas + +[2025-05-27 20:12:04.571357] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 20:12:04.571481] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 20:12:04.571602] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 20:12:04.575263] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: true + +DEBUG: Valores antes de la estructura IF - Reprogramming: false, ChangeInstaller: true + +Enviando notificación de cambio de instalador al cliente, valor de reprogramming y valor de changeInstaller 1 + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "se ha hecho un cambio de técnico 👷🏻‍♂️🔄 para su visita con el folio *#️⃣54*", "🗓️ *28/05/2025* a las 🕒 *03:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Mucio Robledo Villegas*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "d684e6fa2ba24593a86c98be1815831d", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"d4c46cc34e454659ae86e99ec3e76618","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 20:12:05.456803] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 20:12:05.456967] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 20:12:05.457034] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 20:12:05.457096] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: false, ChangeInstaller: true + +[2025-05-27 20:12:05.457145] [debug] Se cambió el instalador, por lo tanto se procede a enviarle mensaje al que se le desasignó + +[2025-05-27 20:12:05.494877] [debug] Se encontró el Whatsapp del instalador anterior en el JSON y es: 4181878106 + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"\ud83d\udc77\ud83c\udffb\u200d\u2642\ufe0f\u00c1ngel Arvizu","subjectOfChange":"se te ha desasignado\u274c la tarea con el folio ","jobId":"54","clientFullName":"[2] Daniel Humberto Soto Villegas","additionalChangeData":"En tu lugar asistir\u00e1 el t\u00e9cnico \ud83d\udc77\ud83c\udffb\u200d\u2642\ufe0f\u27a1\ufe0f *Mucio Robledo Villegas*"} + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: true + +Enviando notificación de cambio de instalador al instalador anterior, valor de reprogramming y valor de changeInstaller 1 + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ 👷🏻‍♂️Ángel Arvizu", "se te ha desasignado❌ la tarea con el folio ", "#️⃣54", "👤 *Cliente:* [2] Daniel Humberto Soto Villegas", "En tu lugar asistirá el técnico 👷🏻‍♂️➡️ *Mucio Robledo Villegas*"], + "template_uuid": "e1aa2b0fd3884595918f4ac2676acd29", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"7b8e1fc0e3834ef7b287dae99ccfb7d7","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Mucio Robledo Villegas","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*28\/05\/2025* a las \ud83d\udd52 *03:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: false, ChangeInstaller: false + +Enviando notificación normal de tarea al instalador, valor de reprogramming y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ *Mucio Robledo Villegas* se te ha asignado una tarea con folio #️⃣ *54* para el cliente 👤 *[2] Daniel Humberto Soto Villegas*, para el 🗓️ *28/05/2025* a las 🕒 *03:00 PM* aproximadamente", "5214181878106, 5214181148783", "https://www.google.com/maps?q=21.1564209,-100.9384185", "gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "88eeb6420a214fd8870dd28d741021c4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"658d1815456f477aaab7b7ddff9ab994","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 20:13:04.496330] [notice] Logging level set to:debug +[2025-05-27 20:13:04.496668] [debug] valor del webhook: {"uuid":"a7f03056-2de0-4212-88bc-863c8cd81291","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:13:04.523091] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 20:13:04.523272] [debug] Valor de JSON: {"uuid":"a7f03056-2de0-4212-88bc-863c8cd81291","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:13:04.523503] [debug] Se actualiza un trabajo + +[2025-05-27 20:13:04.523554] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 20:13:04.523592] [debug] Se reprogramó el trabajo pero no hubo cambio de instalador +[2025-05-27 20:13:04.523639] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 20:13:04.523718] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"a7f03056-2de0-4212-88bc-863c8cd81291","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:13:04.523768] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"a7f03056-2de0-4212-88bc-863c8cd81291","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-28T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:13:04.523804] [debug] Valor de $reprogramming en verifyJobActionToDo: true + +[2025-05-27 20:13:04.523838] [debug] Valor de $changeInstaller en verifyJobActionToDo: false + +[2025-05-27 20:13:04.523878] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 20:13:04.565129] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1019,"unmsId":"75e00242-86c2-436a-b3ac-bd6c31db681e","email":"lionelmuz@gmail.com","firstName":"Mucio","lastName":"Robledo Villegas","username":"muz","avatarColor":"#8bc34a","isActive":true} + +[2025-05-27 20:13:04.565180] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 20:13:04.595345] [debug] Valor de $installerFullName: Mucio Robledo Villegas + +[2025-05-27 20:13:04.663584] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 20:13:04.663630] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 20:13:04.663721] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 20:13:04.663767] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +DEBUG: Valores antes de la estructura IF - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al cliente, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "*#️⃣54*", "🗓️ *29/05/2025* a las 🕒 *03:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Mucio Robledo Villegas*"], + "template_uuid": "70579353773f4de1836d4f9b6bf6074d", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"95fe2d55728e4f708bf90f017d9718b3","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 20:13:05.414139] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 20:13:05.414346] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 20:13:05.414452] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 20:13:05.414552] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: true, ChangeInstaller: false + +[2025-05-27 20:13:05.414664] [debug] No se cambió el instalador + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Mucio Robledo Villegas","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*29\/05\/2025* a las \ud83d\udd52 *03:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al instalador, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ Mucio Robledo Villegas", "#️⃣54", "👤 *[2] Daniel Humberto Soto Villegas*", "☎️ 5214181878106, 5214181148783", "🗓️ *29/05/2025* a las 🕒 *03:00 PM* aproximadamente", "🛠️ Andan mal esos equipos", "📌 https://www.google.com/maps?q=21.1564209,-100.9384185", "🔐 gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "7eb4d8e27cf740779dd6777fad7ffaf4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"9fd467a777cf458aa24db9bcd4741cc7","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 20:17:47.489377] [notice] Logging level set to:debug +[2025-05-27 20:17:47.489691] [debug] valor del webhook: {"uuid":"4303a3cb-ac3e-44ad-b669-a6f2ce97a58b","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:17:47.514425] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 20:17:47.514569] [debug] Valor de JSON: {"uuid":"4303a3cb-ac3e-44ad-b669-a6f2ce97a58b","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:17:47.514817] [debug] Se actualiza un trabajo + +[2025-05-27 20:17:47.514877] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 20:17:47.514919] [debug] Se reprogramó el trabajo pero no hubo cambio de instalador +[2025-05-27 20:17:47.514971] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 20:17:47.515074] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"4303a3cb-ac3e-44ad-b669-a6f2ce97a58b","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:17:47.515130] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"4303a3cb-ac3e-44ad-b669-a6f2ce97a58b","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T15:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:17:47.515170] [debug] Valor de $reprogramming en verifyJobActionToDo: true + +[2025-05-27 20:17:47.515204] [debug] Valor de $changeInstaller en verifyJobActionToDo: false + +[2025-05-27 20:17:47.515249] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 20:17:47.547489] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1019,"unmsId":"75e00242-86c2-436a-b3ac-bd6c31db681e","email":"lionelmuz@gmail.com","firstName":"Mucio","lastName":"Robledo Villegas","username":"muz","avatarColor":"#8bc34a","isActive":true} + +[2025-05-27 20:17:47.547621] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 20:17:47.578680] [debug] Valor de $installerFullName: Mucio Robledo Villegas + +[2025-05-27 20:17:47.666748] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 20:17:47.666884] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 20:17:47.667027] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 20:17:47.671047] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +DEBUG: Valores antes de la estructura IF - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al cliente, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "*#️⃣54*", "🗓️ *29/05/2025* a las 🕔 *05:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Mucio Robledo Villegas*"], + "template_uuid": "70579353773f4de1836d4f9b6bf6074d", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"a79b407029a64b7bb248b0089f49e356","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 20:17:48.538891] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 20:17:48.539180] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 20:17:48.539361] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 20:17:48.539527] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: true, ChangeInstaller: false + +[2025-05-27 20:17:48.539774] [debug] No se cambió el instalador + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Mucio Robledo Villegas","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*29\/05\/2025* a las \ud83d\udd54 *05:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al instalador, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ Mucio Robledo Villegas", "#️⃣54", "👤 *[2] Daniel Humberto Soto Villegas*", "☎️ 5214181878106, 5214181148783", "🗓️ *29/05/2025* a las 🕔 *05:00 PM* aproximadamente", "🛠️ Andan mal esos equipos", "📌 https://www.google.com/maps?q=21.1564209,-100.9384185", "🔐 gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "42152c07c67b468ba68e581c0283e22e", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"fa0ba526b37c4fc9be2bdaf441947ccd","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 20:45:08.555311] [notice] Logging level set to:debug +[2025-05-27 20:45:08.555406] [debug] valor del webhook: {"uuid":"ff355047-cebb-444b-9c3d-f875d1c4eb80","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-30T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:45:08.591732] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 20:45:08.592159] [debug] Valor de JSON: {"uuid":"ff355047-cebb-444b-9c3d-f875d1c4eb80","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-30T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:45:08.592405] [debug] Se actualiza un trabajo + +[2025-05-27 20:45:08.592467] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 20:45:08.592521] [debug] Se reprogramó el trabajo pero no hubo cambio de instalador +[2025-05-27 20:45:08.592582] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 20:45:08.592700] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"ff355047-cebb-444b-9c3d-f875d1c4eb80","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-30T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:45:08.592749] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"ff355047-cebb-444b-9c3d-f875d1c4eb80","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-30T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-29T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 20:45:08.592788] [debug] Valor de $reprogramming en verifyJobActionToDo: true + +[2025-05-27 20:45:08.592827] [debug] Valor de $changeInstaller en verifyJobActionToDo: false + +[2025-05-27 20:45:08.592875] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 20:45:08.629574] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1019,"unmsId":"75e00242-86c2-436a-b3ac-bd6c31db681e","email":"lionelmuz@gmail.com","firstName":"Mucio","lastName":"Robledo Villegas","username":"muz","avatarColor":"#8bc34a","isActive":true} + +[2025-05-27 20:45:08.629709] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 20:45:08.668134] [debug] Valor de $installerFullName: Mucio Robledo Villegas + +[2025-05-27 20:45:08.750946] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 20:45:08.751235] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 20:45:08.751377] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 20:45:08.759375] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +DEBUG: Valores antes de la estructura IF - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al cliente, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👤 *Daniel Humberto Soto Villegas*", "*#️⃣54*", "🗓️ *30/05/2025* a las 🕔 *05:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Mucio Robledo Villegas*"], + "template_uuid": "70579353773f4de1836d4f9b6bf6074d", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"acbd50c95e304a3393f8e71125442575","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 20:45:09.657078] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 20:45:09.657188] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 20:45:09.657217] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 20:45:09.657242] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: true, ChangeInstaller: false + +[2025-05-27 20:45:09.657258] [debug] No se cambió el instalador + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Mucio Robledo Villegas","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*30\/05\/2025* a las \ud83d\udd54 *05:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al instalador, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ *Mucio Robledo Villegas* se reprogramó una tarea con el folio #️⃣ *54* para el cliente 👤 *[2] Daniel Humberto Soto Villegas*, la nueva fecha será el 🗓️➡️ *30/05/2025* a las 🕔 *05:00 PM* aproximadamente", "5214181878106, 5214181148783", "https://www.google.com/maps?q=21.1564209,-100.9384185", "gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "88eeb6420a214fd8870dd28d741021c4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"630a6169c4664d09890bcdffb0f6c13c","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 21:25:17.930980] [notice] Logging level set to:debug +[2025-05-27 21:25:17.931329] [debug] valor del webhook: {"uuid":"efc7868d-b859-43fb-95a2-a2387ed2fb57","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-30T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 21:25:17.955180] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 21:25:17.955238] [debug] Valor de JSON: {"uuid":"efc7868d-b859-43fb-95a2-a2387ed2fb57","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-30T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 21:25:17.955454] [debug] Se actualiza un trabajo + +[2025-05-27 21:25:17.955487] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 21:25:17.955498] [debug] Se reprogramó el trabajo pero no hubo cambio de instalador +[2025-05-27 21:25:17.955527] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 21:25:17.955575] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"efc7868d-b859-43fb-95a2-a2387ed2fb57","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-30T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 21:25:17.955591] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"efc7868d-b859-43fb-95a2-a2387ed2fb57","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-30T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 21:25:17.955601] [debug] Valor de $reprogramming en verifyJobActionToDo: true + +[2025-05-27 21:25:17.955609] [debug] Valor de $changeInstaller en verifyJobActionToDo: false + +[2025-05-27 21:25:17.955624] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 21:25:17.984384] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1019,"unmsId":"75e00242-86c2-436a-b3ac-bd6c31db681e","email":"lionelmuz@gmail.com","firstName":"Mucio","lastName":"Robledo Villegas","username":"muz","avatarColor":"#8bc34a","isActive":true} + +[2025-05-27 21:25:17.984448] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 21:25:18.014928] [debug] Valor de $installerFullName: Mucio Robledo Villegas + +[2025-05-27 21:25:18.090785] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 21:25:18.090905] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 21:25:18.091043] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 21:25:18.095246] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +DEBUG: Valores antes de la estructura IF - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al cliente, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["Estimado cliente 👤 *Daniel Humberto Soto Villegas* se ha reprogramado su visita técnica con folio *#️⃣54*", "🗓️➡️ *31/05/2025* a las 🕔 *05:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Mucio Robledo Villegas*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "70579353773f4de1836d4f9b6bf6074d", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"f812d72b9bad4b66acc27432b15c8f7f","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 21:25:18.886759] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 21:25:18.887129] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 21:25:18.887351] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 21:25:18.887553] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: true, ChangeInstaller: false + +[2025-05-27 21:25:18.887746] [debug] No se cambió el instalador + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Mucio Robledo Villegas","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*31\/05\/2025* a las \ud83d\udd54 *05:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al instalador, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ *Mucio Robledo Villegas* se reprogramó una tarea con el folio #️⃣ *54* para el cliente 👤 *[2] Daniel Humberto Soto Villegas*, la nueva fecha será el 🗓️➡️ *31/05/2025* a las 🕔 *05:00 PM* aproximadamente", "5214181878106, 5214181148783", "https://www.google.com/maps?q=21.1564209,-100.9384185", "gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "88eeb6420a214fd8870dd28d741021c4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"c0aae270712b4284b1a1d400b138760e","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 21:26:21.929450] [notice] Logging level set to:debug +[2025-05-27 21:26:21.929552] [debug] valor del webhook: {"uuid":"df89b619-ae0d-4b4e-b105-37fc6b6dbfb1","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T18:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 21:26:21.962728] [debug] valor el evento recibido por webhook: job.edit + +[2025-05-27 21:26:21.963088] [debug] Valor de JSON: {"uuid":"df89b619-ae0d-4b4e-b105-37fc6b6dbfb1","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T18:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 21:26:21.963694] [debug] Se actualiza un trabajo + +[2025-05-27 21:26:21.965094] [debug] Validando claves dentro de entityBeforeEdit y entity +[2025-05-27 21:26:21.965198] [debug] Se reprogramó el trabajo pero no hubo cambio de instalador +[2025-05-27 21:26:21.965260] [debug] ******** INCIO DE LA FUNCIÓN verifyJobActionToDo ****** + +[2025-05-27 21:26:21.965368] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"df89b619-ae0d-4b4e-b105-37fc6b6dbfb1","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T18:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 21:26:21.965416] [debug] Valor de $jsonNotificationData en verifyJobActionToDo: {"uuid":"df89b619-ae0d-4b4e-b105-37fc6b6dbfb1","changeType":"edit","entity":"job","entityId":"54","eventName":"job.edit","extraData":{"entity":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-06-01T18:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]},"entityBeforeEdit":{"id":54,"title":"Ir a checar instalaci\u00f3n","description":"Andan mal esos equipos","assignedUserId":1019,"clientId":2,"date":"2025-05-31T17:00:00-0600","duration":60,"status":1,"address":"31 Chiapas, Dolores Hidalgo Cuna de la Independencia Nacional, 37800, Mexico","gpsLat":null,"gpsLon":null,"attachments":[],"tasks":[]}}} + +[2025-05-27 21:26:21.965456] [debug] Valor de $reprogramming en verifyJobActionToDo: true + +[2025-05-27 21:26:21.965516] [debug] Valor de $changeInstaller en verifyJobActionToDo: false + +[2025-05-27 21:26:21.965564] [debug] Valor de $installersData en verifyJobActionToDo: { + "instaladores": [ + { + "id": 1019, + "nombre": "Mucio Robledo", + "whatsapp": "4181878106" + }, + { + "id": 1173, + "nombre": "Angel Arvizu", + "whatsapp": "4181878106" + }, + { + "id": 1172, + "nombre": "Juan Rostro", + "whatsapp": "4181878106" + }, + { + "id": 1015, + "nombre": "Daniel Humberto", + "whatsapp": "4181878106" + } + ] +} + +[2025-05-27 21:26:22.003457] [debug] Valor de $usersInstallers en verifyJobActionToDo: {"id":1019,"unmsId":"75e00242-86c2-436a-b3ac-bd6c31db681e","email":"lionelmuz@gmail.com","firstName":"Mucio","lastName":"Robledo Villegas","username":"muz","avatarColor":"#8bc34a","isActive":true} + +[2025-05-27 21:26:22.003531] [debug] Número de WhatsApp del Instalador: 4181878106 + +[2025-05-27 21:26:22.047250] [debug] Valor de $installerFullName: Mucio Robledo Villegas + +[2025-05-27 21:26:22.113622] [debug] Valor de $clientAllPhonesString en verifyJobActionToDo: 5214181878106,5214181148783 + +[2025-05-27 21:26:22.113756] [debug] Valor de $arrayNumeros en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 21:26:22.113903] [debug] Valor de $resultados en verifyJobActionToDo: ["5214181878106","5214181148783"] + +[2025-05-27 21:26:22.117643] [debug] Se encontró un tipo de contacto whatsapp + +Enviando mensaje de trabajo para el cliente + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +DEBUG: Valores antes de la estructura IF - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al cliente, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181148783", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["Estimado cliente 👤 *Daniel Humberto Soto Villegas* se ha reprogramado su visita técnica con folio *#️⃣54*", "🗓️➡️ *01/06/2025* a las 🕕 *06:00 PM* aproximadamente", "👷🏻‍♂️➡️ *Mucio Robledo Villegas*", "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."], + "template_uuid": "715eed9d6f2d4d90853f25e296202e00", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"2e184edefdb44934bd3b0f70b92976ac","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued + +[2025-05-27 21:26:22.848962] [info] Notificación enviada correctamente al cliente con teléfono 5214181148783 después de 1 intento(s). + +[2025-05-27 21:26:22.849066] [debug] Valor de $title en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 21:26:22.849097] [debug] El título no contiene el prefijo [NOTIFICACION-PENDIENTE] en verifyJobActionToDo: Ir a checar instalación + +[2025-05-27 21:26:22.849138] [debug] DEBUG: Valores después de conversión para mensaje instalador - Reprogramming: true, ChangeInstaller: false + +[2025-05-27 21:26:22.849160] [debug] No se cambió el instalador + +Enviando mensaje de tarea al instalador + +Datos de la notificación de tarea: {"installerName":"Mucio Robledo Villegas","clientFullName":"[2] Daniel Humberto Soto Villegas","jobId":"54","clientAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","clientWhatsApp":"5214181878106, 5214181148783","date":"*01\/06\/2025* a las \ud83d\udd55 *06:00 PM* aproximadamente","jobDescription":"Andan mal esos equipos","gmapsLocation":"https:\/\/www.google.com\/maps?q=21.1564209,-100.9384185"} + +DEBUG: Valores después de conversión - Reprogramming: true, ChangeInstaller: false + +Enviando notificación de reprogramación al instalador, valor de reprogramming 1 y valor de changeInstaller + +La cadena CURL que se envia es: { + "to": "5214181878106", + "from": "whatsapp", + "type": "text", + "content": { + "text": "S/M" + }, + "template_values": ["👷🏻‍♂️ *Mucio Robledo Villegas* se reprogramó una tarea con el folio #️⃣ *54* para el cliente 👤 *[2] Daniel Humberto Soto Villegas*, la nueva fecha será el 🗓️➡️ *01/06/2025* a las 🕕 *06:00 PM* aproximadamente", "5214181878106, 5214181148783", "https://www.google.com/maps?q=21.1564209,-100.9384185", "gYAIEK:Be}SK*01z5+/V"], + "template_uuid": "88eeb6420a214fd8870dd28d741021c4", + "optin_contact": true + } +Response del CallBell: {"message":{"uuid":"6f2d70beaee94baaa7419a135b26aded","status":"enqueued"}} +La notificación fue enviada correctamente con estado: enqueued diff --git a/manifest.json b/manifest.json index c15454b2..fc6ffe9c 100755 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "displayName": "SIIP - Procesador de Pagos en línea con Stripe, Oxxo y Transferencia, Sincronizador de CallBell y Envío de Notificaciones y comprobantes vía WhatsApp", "description": "Este plugin sincroniza los clientes del sistema UISP CRM con los contactos de WhatsApp en CallBell, además procesa pagos de Stripe como las trasferencias bancarias y genera referencias de pago vía OXXO, además envía comprobantes de pago en formato imagen PNG o texto vía Whatsapp a los clientes", "url": "https://siip.mx/", - "version": "2.8.0", + "version": "2.8.2", "unmsVersionCompliancy": { "min": "2.1.0", "max": null diff --git a/src/Facade/AbstractMessageNotifierFacade.php b/src/Facade/AbstractMessageNotifierFacade.php index 0185dabf..1d3085c3 100755 --- a/src/Facade/AbstractMessageNotifierFacade.php +++ b/src/Facade/AbstractMessageNotifierFacade.php @@ -1,6 +1,6 @@ logger = $logger; + $this->logger = $logger; $this->messageTextFactory = $messageTextFactory; - $this->clientPhoneNumber = $clientPhoneNumber; + $this->clientPhoneNumber = $clientPhoneNumber; } @@ -223,23 +223,23 @@ abstract class AbstractMessageNotifierFacade { $this->logger->debug('******** INCIO DE LA FUNCIÓN verifyJobActionToDo ******' . PHP_EOL); - $configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create(); - $config = $configManager->loadConfig(); - $IPServer = $config['ipserver']; - $UCRMAPIToken = $config['apitoken']; + $configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create(); + $config = $configManager->loadConfig(); + $IPServer = $config['ipserver']; + $UCRMAPIToken = $config['apitoken']; $CallBellAPIToken = $config['tokencallbell']; - $IPServer = $config['ipserver']; - $installersData = $config['installersDataWhatsApp']; + $IPServer = $config['ipserver']; + $installersData = $config['installersDataWhatsApp']; $this->logger->debug('Valor de $jsonNotificationData en verifyJobActionToDo: ' . json_encode($jsonNotificationData) . PHP_EOL); $this->logger->debug('Valor de $jsonNotificationData en verifyJobActionToDo: ' . json_encode($jsonNotificationData) . PHP_EOL); - $clientId = $jsonNotificationData['extraData']['entity']['clientId']; - $installerId = $jsonNotificationData['extraData']['entity']['assignedUserId']; - $jobId = $jsonNotificationData['entityId']; + $clientId = $jsonNotificationData['extraData']['entity']['clientId']; + $installerId = $jsonNotificationData['extraData']['entity']['assignedUserId']; + $jobId = $jsonNotificationData['entityId']; $jobDescription = $jsonNotificationData['extraData']['entity']['description'] ?? null; - $reprogrammingValue = var_export($reprogramming, true); + $reprogrammingValue = var_export($reprogramming, true); $changeInstallerValue = var_export($changeInstaller, true); $this->logger->debug('Valor de $reprogramming en verifyJobActionToDo: ' . $reprogrammingValue . PHP_EOL); $this->logger->debug('Valor de $changeInstaller en verifyJobActionToDo: ' . $changeInstallerValue . PHP_EOL); @@ -251,19 +251,64 @@ abstract class AbstractMessageNotifierFacade // Crear un objeto DateTime a partir de la fecha $date = new DateTime($dateString); + + // concaternar emoji de reloj de la hora que más se asemeje a la hora del evento, por ejemplo si la hora es 8:00 am o pm se concatena el emoji de reloj de las 8:00 am o pm como: 🕗 + $hour = $date->format('h'); + $clockEmoji = "🕐"; // Emoji por defecto + // Determinar el emoji del reloj según la hora + switch ($hour) { + case '01': + $clockEmoji = "🕐"; + break; + case '02': + $clockEmoji = "🕑"; + break; + case '03': + $clockEmoji = "🕒"; + break; + case '04': + $clockEmoji = "🕓"; + break; + case '05': + $clockEmoji = "🕔"; + break; + case '06': + $clockEmoji = "🕕"; + break; + case '07': + $clockEmoji = "🕖"; + break; + case '08': + $clockEmoji = "🕗"; + break; + case '09': + $clockEmoji = "🕘"; + break; + case '10': + $clockEmoji = "🕙"; + break; + case '11': + $clockEmoji = "🕚"; + break; + case '12': + $clockEmoji = "🕛"; + break; + } + // Formatear la fecha al formato deseado: día/mes/año a las hora:minuto am/pm aproximadamente - $formattedDate = "*" . $date->format('d/m/Y') . "* a las *" . $date->format('h:i A') . "* aproximadamente"; + $formattedDate = "*" . $date->format('d/m/Y') . "* a las $clockEmoji *" . $date->format('h:i A') . "* aproximadamente"; + // $this->logger->debug('Valor de $formattedDate en verifyJobActionToDo: ' . $formattedDate . PHP_EOL); } else { $this->logger->error('La fecha no está disponible en el JSON' . PHP_EOL); } - // $this->logger->debug('Valor de $installersData en verifyJobActionToDo: ' . $installersData . PHP_EOL); + $this->logger->debug('Valor de $installersData en verifyJobActionToDo: ' . $installersData . PHP_EOL); - $this->ucrmApi = UcrmApi::create(); + $this->ucrmApi = UcrmApi::create(); $usersInstallers = $this->ucrmApi->get('users/admins/' . $installerId, []); - // $this->logger->debug('Valor de $usersInstallers en verifyJobActionToDo: ' . json_encode($usersInstallers) . PHP_EOL); + $this->logger->debug('Valor de $usersInstallers en verifyJobActionToDo: ' . json_encode($usersInstallers) . PHP_EOL); // Inicializar la variable para el nombre completo $installerFullName = ''; @@ -276,7 +321,7 @@ abstract class AbstractMessageNotifierFacade } // Verificar si el nodo "instaladores" existe - if (! isset($jsonInstallersData['instaladores'])) { + if (!isset($jsonInstallersData['instaladores'])) { $this->logger->error('El nodo "instaladores" no existe en el JSON'); return; } @@ -295,31 +340,31 @@ abstract class AbstractMessageNotifierFacade if (empty($installerWhatsApp)) { $this->logger->warning('No se encontró un número de WhatsApp para el instalador con ID 1019'); } else { - // $this->logger->debug('Número de WhatsApp del Instalador: ' . $installerWhatsApp . PHP_EOL); + $this->logger->debug('Número de WhatsApp del Instalador: ' . $installerWhatsApp . PHP_EOL); } - $this->ucrmApi = UcrmApi::create(); + $this->ucrmApi = UcrmApi::create(); $usersInstallers = $this->ucrmApi->get('users/admins/' . $installerId, []); //$this->logger->debug('Valor de $usersInstallers ' . json_encode($usersInstallers) . PHP_EOL); - $firstName = $usersInstallers['firstName'] ?? ''; - $lastName = $usersInstallers['lastName'] ?? ''; + $firstName = $usersInstallers['firstName'] ?? ''; + $lastName = $usersInstallers['lastName'] ?? ''; $installerFullName = trim("$firstName $lastName"); - // $this->logger->debug('Valor de $installerFullName: ' . $installerFullName . PHP_EOL); + $this->logger->debug('Valor de $installerFullName: ' . $installerFullName . PHP_EOL); $baseUri = 'https://' . $IPServer . '/crm/api/v1.0/'; $clientGuzzleHttp = new Client([ 'base_uri' => $baseUri, - 'headers' => [ + 'headers' => [ 'X-Auth-App-Key' => $UCRMAPIToken, - 'Accept' => 'application/json', + 'Accept' => 'application/json', ], - 'verify' => false, + 'verify' => false, ]); $responseClients = $clientGuzzleHttp->request('GET', "clients/" . $clientId); - $arrayClientCRM = json_decode($responseClients->getBody()->getContents(), true); + $arrayClientCRM = json_decode($responseClients->getBody()->getContents(), true); // $this->logger->debug('Valor de $arrayClientCRM en verifyJobActionToDo: ' . json_encode($arrayClientCRM) . PHP_EOL); $clientFullName = sprintf("%s %s", $arrayClientCRM['firstName'], $arrayClientCRM['lastName']); @@ -356,11 +401,11 @@ abstract class AbstractMessageNotifierFacade // Convertir el array de teléfonos en una cadena separada por comas $clientAllPhonesString = implode(',', $arrayAllPhones); - // $this->logger->debug('Valor de $clientAllPhonesString en verifyJobActionToDo: ' . $clientAllPhonesString . PHP_EOL); + $this->logger->debug('Valor de $clientAllPhonesString en verifyJobActionToDo: ' . $clientAllPhonesString . PHP_EOL); // Dividir los números en un array $arrayNumeros = explode(',', $clientAllPhonesString); - // $this->logger->debug('Valor de $arrayNumeros en verifyJobActionToDo: ' . json_encode($arrayNumeros) . PHP_EOL); + $this->logger->debug('Valor de $arrayNumeros en verifyJobActionToDo: ' . json_encode($arrayNumeros) . PHP_EOL); // Procesar cada número $resultados = []; @@ -378,7 +423,7 @@ abstract class AbstractMessageNotifierFacade $resultados[] = $numeroValidado; // Mantener el número sin cambios } } - // $this->logger->debug('Valor de $resultados en verifyJobActionToDo: ' . json_encode($resultados) . PHP_EOL); + $this->logger->debug('Valor de $resultados en verifyJobActionToDo: ' . json_encode($resultados) . PHP_EOL); // Convertir el array de resultados en una cadena separada por comas $resultadoFinalNumerosCliente = implode(', ', $resultados); @@ -389,9 +434,9 @@ abstract class AbstractMessageNotifierFacade // Construir el array asociativo con los datos de la notificación para el cliente $jsonClientJobNotificationData = [ "clientFullName" => $clientFullName, - "jobId" => $jobId, - "date" => $formattedDate, - "installerName" => $installerFullName, + "jobId" => $jobId, + "date" => $formattedDate, + "installerName" => $installerFullName, ]; $clientWhatsApp = ''; @@ -410,9 +455,9 @@ abstract class AbstractMessageNotifierFacade // Verificar si el valor es un array de teléfonos if (is_array($phones)) { - $attempts = 0; + $attempts = 0; $maxAttempts = 3; - $result = false; + $result = false; foreach ($phones as $phone) { //Aquí se enviará la notificación al cliente @@ -439,12 +484,12 @@ abstract class AbstractMessageNotifierFacade $this->logger->debug('Valor de $title en verifyJobActionToDo: ' . $title . PHP_EOL); //la variable $title contiene el título del trabajo con un prefijo "[NOTIFICACION-PENDIENTE]" aquí hay que quitarlo - // $this->ucrmApi = UcrmApi::create(); - // $responsePatch = $this->ucrmApi->patch('scheduling/jobs/' . $jsonNotificationData['entityId'], [ - // 'title' => $title, - // ]); + // $this->ucrmApi = UcrmApi::create(); + // $responsePatch = $this->ucrmApi->patch('scheduling/jobs/' . $jsonNotificationData['entityId'], [ + // 'title' => $title, + // ]); if (strpos($title, '[NOTIFICACION-PENDIENTE]') !== false) { //si el título contiene el prefijo [NOTIFICACION-PENDIENTE] entonces se quita - $title = str_replace('[NOTIFICACION-PENDIENTE]', '', $title); // Quitar el prefijo + $title = str_replace('[NOTIFICACION-PENDIENTE]', '', $title); // Quitar el prefijo $responseClients = $clientGuzzleHttp->request('PATCH', "scheduling/jobs/" . $jsonNotificationData['entityId'], [ 'json' => [ 'title' => $title, @@ -474,7 +519,7 @@ abstract class AbstractMessageNotifierFacade } // --- ¡AÑADE ESTAS LÍNEAS PARA CONVERTIR A BOOLEANO REAL! --- - $reprogramming = filter_var($reprogramming, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + $reprogramming = filter_var($reprogramming, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); $changeInstaller = filter_var($changeInstaller, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); // ----------------------------------------------------------- @@ -490,19 +535,19 @@ abstract class AbstractMessageNotifierFacade //Enviar notificación al instalador anterior $previousinstallerInstallerId = $installerId = $jsonNotificationData['extraData']['entityBeforeEdit']['assignedUserId']; - $usersInstallers = $this->ucrmApi->get('users/admins/' . $previousinstallerInstallerId, []); - $firstNamePreviousInstaller = $usersInstallers['firstName'] ?? ''; //Obtener el nombre del instalador anterior - $lastNamePreviousInstaller = $usersInstallers['lastName'] ?? ''; //Obtener el apellido del instalador anterior - $previousInstallerFullName = trim("$firstNamePreviousInstaller $lastNamePreviousInstaller"); - $attempts = 0; - $maxAttempts = 3; - $result = false; + $usersInstallers = $this->ucrmApi->get('users/admins/' . $previousinstallerInstallerId, []); + $firstNamePreviousInstaller = $usersInstallers['firstName'] ?? ''; //Obtener el nombre del instalador anterior + $lastNamePreviousInstaller = $usersInstallers['lastName'] ?? ''; //Obtener el apellido del instalador anterior + $previousInstallerFullName = trim("$firstNamePreviousInstaller $lastNamePreviousInstaller"); + $attempts = 0; + $maxAttempts = 3; + $result = false; $jsonPreviousInstallerJobNotificationData = [ - "installerName" => "👷🏻‍♂️" . $previousInstallerFullName, - "subjectOfChange" => self::SUBJECT_OF_INSTALLER_CHANGE[1], - "jobId" => $jobId, - "clientFullName" => sprintf("[%s] %s", $arrayClientCRM['id'], $clientFullName), + "installerName" => "👷🏻‍♂️" . $previousInstallerFullName, + "subjectOfChange" => self::SUBJECT_OF_INSTALLER_CHANGE[1], + "jobId" => $jobId, + "clientFullName" => sprintf("[%s] %s", $arrayClientCRM['id'], $clientFullName), "additionalChangeData" => self::ADDITIONAL_CHANGE_DATA[1] . ' *' . $installerFullName . '*', ]; @@ -524,8 +569,8 @@ abstract class AbstractMessageNotifierFacade $result = $client_callbell_api->sendJobNotificationWhatsAppToInstaller( $this->validarNumeroTelefono((string) $previousInstallerWhatsApp), $jsonPreviousInstallerJobNotificationData, - false, - true, + $reprogramming, + $changeInstaller, '' ); @@ -540,21 +585,21 @@ abstract class AbstractMessageNotifierFacade // Construir el array asociativo con los datos de la notificación para el instalador nuevo $jsonInstallerJobNotificationData = [ - "installerName" => $installerFullName, + "installerName" => $installerFullName, "clientFullName" => sprintf("[%s] %s", $arrayClientCRM['id'], $clientFullName), - "jobId" => $jobId, - "clientAddress" => $safeAddress, + "jobId" => $jobId, + "clientAddress" => $safeAddress, "clientWhatsApp" => $resultadoFinalNumerosCliente, - "date" => $formattedDate, + "date" => $formattedDate, "jobDescription" => $jobDescription, - "gmapsLocation" => $googleMapsUrl, + "gmapsLocation" => $googleMapsUrl, ]; //Enviar notificación al instalador nuevo - $attempts = 0; + $attempts = 0; $maxAttempts = 3; - $result = false; + $result = false; // Reintentar hasta 3 veces si la función retorna false while ($attempts < $maxAttempts && $result === false) { @@ -578,20 +623,20 @@ abstract class AbstractMessageNotifierFacade // Construir el array asociativo con los datos de la notificación $jsonInstallerJobNotificationData = [ - "installerName" => $installerFullName, + "installerName" => $installerFullName, "clientFullName" => sprintf("[%s] %s", $arrayClientCRM['id'], $clientFullName), - "jobId" => $jobId, - "clientAddress" => $safeAddress, + "jobId" => $jobId, + "clientAddress" => $safeAddress, "clientWhatsApp" => $resultadoFinalNumerosCliente, - "date" => $formattedDate, + "date" => $formattedDate, "jobDescription" => $jobDescription, - "gmapsLocation" => $googleMapsUrl, + "gmapsLocation" => $googleMapsUrl, ]; - $attempts = 0; + $attempts = 0; $maxAttempts = 3; - $result = false; + $result = false; // // Reintentar hasta 3 veces si la función retorna false while ($attempts < $maxAttempts && $result === false) { @@ -599,8 +644,8 @@ abstract class AbstractMessageNotifierFacade $result = $client_callbell_api->sendJobNotificationWhatsAppToInstaller( $this->validarNumeroTelefono((string) $installerWhatsApp), $jsonInstallerJobNotificationData, - false, - false, + $reprogramming, + $changeInstaller, $this->getVaultCredentials($arrayClientCRM['id']) ); @@ -674,16 +719,16 @@ abstract class AbstractMessageNotifierFacade // $notification_client_data_export = json_encode($notification_client_data); // $this->logger->info("Valor de notification client data export: " . $notification_client_data_export . PHP_EOL); $configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create(); - $config = $configManager->loadConfig(); + $config = $configManager->loadConfig(); // the "exportFormat" key must be defined in plugin's manifest file, see the link above - $IPServer = $config['ipserver']; - $UCRMAPIToken = $config['apitoken']; - $CallBellAPIToken = $config['tokencallbell']; + $IPServer = $config['ipserver']; + $UCRMAPIToken = $config['apitoken']; + $CallBellAPIToken = $config['tokencallbell']; $notificationTypeText = $config['notificationTypeText']; $client_callbell_api = new ClientCallBellAPI($UCRMAPIToken, $IPServer, $CallBellAPIToken); - //$clientPhoneNumber = $this->clientPhoneNumber->getUcrmClientNumber($notificationData); + //$clientPhoneNumber = $this->clientPhoneNumber->getUcrmClientNumber($notificationData); $clientPhoneNumber = $this->validarNumeroTelefono($phoneToNotify); //Obtiene el número de celular del cliente que sea del tipo de contacto "WhatsApp" //$this->logger->debug("Numero de cel obtenido " . $clientPhoneNumber . PHP_EOL); @@ -695,15 +740,15 @@ abstract class AbstractMessageNotifierFacade if ($notificationTypeText) { try { - $attempts = 0; + $attempts = 0; $maxAttempts = 3; - $result = false; + $result = false; - while ($attempts < $maxAttempts && ! $result) { + while ($attempts < $maxAttempts && !$result) { $attempts++; $result = $client_callbell_api->sendTextPaymentNotificationWhatsApp($clientPhoneNumber, $notificationData); - if (! $result) { + if (!$result) { $this->logger->warning("Intento $attempts fallido para enviar notificación de texto al cliente con número $clientPhoneNumber." . PHP_EOL); } } @@ -719,15 +764,15 @@ abstract class AbstractMessageNotifierFacade } else { try { - $attempts = 0; + $attempts = 0; $maxAttempts = 3; - $result = false; + $result = false; - while ($attempts < $maxAttempts && ! $result) { + while ($attempts < $maxAttempts && !$result) { $attempts++; $result = $client_callbell_api->sendPaymentNotificationWhatsApp($clientPhoneNumber, $notificationData); - if (! $result) { + if (!$result) { $this->logger->warning("Intento $attempts fallido para enviar notificación al cliente con número $clientPhoneNumber." . PHP_EOL); } } @@ -766,11 +811,11 @@ abstract class AbstractMessageNotifierFacade // $this->logger->info("Valor de notification client data export: " . $notification_client_data_export . PHP_EOL); //$this->logger->debug("Creando instancia callbell ".PHP_EOL); $configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create(); - $config = $configManager->loadConfig(); + $config = $configManager->loadConfig(); // the "exportFormat" key must be defined in plugin's manifest file, see the link above - $IPServer = $config['ipserver']; - $UCRMAPIToken = $config['apitoken']; - $CallBellAPIToken = $config['tokencallbell']; + $IPServer = $config['ipserver']; + $UCRMAPIToken = $config['apitoken']; + $CallBellAPIToken = $config['tokencallbell']; $notificationTypeText = $config['notificationTypeText']; $client_callbell_api = new ClientCallBellAPI($UCRMAPIToken, $IPServer, $CallBellAPIToken); @@ -844,10 +889,10 @@ abstract class AbstractMessageNotifierFacade // $this->logger->info("Valor de notification client data export: " . $notification_client_data_export . PHP_EOL); //$this->logger->debug("Creando instancia callbell ".PHP_EOL); $configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create(); - $config = $configManager->loadConfig(); + $config = $configManager->loadConfig(); // the "exportFormat" key must be defined in plugin's manifest file, see the link above - $IPServer = $config['ipserver']; - $UCRMAPIToken = $config['apitoken']; + $IPServer = $config['ipserver']; + $UCRMAPIToken = $config['apitoken']; $CallBellAPIToken = $config['tokencallbell']; $client_callbell_api = new ClientCallBellAPI($UCRMAPIToken, $IPServer, $CallBellAPIToken); @@ -895,15 +940,15 @@ abstract class AbstractMessageNotifierFacade // $this->logger->info("Valor de notification client data export: " . $notification_client_data_export . PHP_EOL); $configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create(); - $config = $configManager->loadConfig(); + $config = $configManager->loadConfig(); // the "exportFormat" key must be defined in plugin's manifest file, see the link above - $IPServer = $config['ipserver']; - $UCRMAPIToken = $config['apitoken']; + $IPServer = $config['ipserver']; + $UCRMAPIToken = $config['apitoken']; $CallBellAPIToken = $config['tokencallbell']; - $StripeToken = $config['tokenstripe']; + $StripeToken = $config['tokenstripe']; $attributes = $notificationData->clientData['attributes']; //Obtener los atributos del cliente - // Variable para almacenar los valores de los atributos que comienzan con "clabe" + // Variable para almacenar los valores de los atributos que comienzan con "clabe" // Iterar sobre los atributoss foreach ($attributes as $attribute) { @@ -912,7 +957,7 @@ abstract class AbstractMessageNotifierFacade // Agregar el valor al array $clabeValues $customerStripeID = $attribute['value']; } else if (strpos($attribute['key'], 'clabe') === 0) { // Verificar si la "key" comienza con "clabe" - // Agregar el valor al array $clabeValues + // Agregar el valor al array $clabeValues $clabeInterbancaria = $attribute['value']; } @@ -957,7 +1002,7 @@ abstract class AbstractMessageNotifierFacade //$this->sendWhatsApp($notificationData, $clientSmsNumber); //$client_callbell_api->sendMessageWhatsApp($clientPhoneNumber, $notificationData); - $client_callbell_api = new ClientCallBellAPI($UCRMAPIToken, $IPServer, $CallBellAPIToken); + $client_callbell_api = new ClientCallBellAPI($UCRMAPIToken, $IPServer, $CallBellAPIToken); $response_getContactCallBell = json_decode($client_callbell_api->getContactWhatsapp($clientPhoneNumber), true); //$this->logger->debug('Se hizo la petición al callbell para obtener el uuid' . PHP_EOL); $client_callbell_api->patchWhatsapp($response_getContactCallBell, $notificationData, $clabeInterbancaria); @@ -992,14 +1037,14 @@ abstract class AbstractMessageNotifierFacade //$this->logger->info("client id " .$clientID. PHP_EOL); $configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create(); - $config = $configManager->loadConfig(); + $config = $configManager->loadConfig(); // the "exportFormat" key must be defined in plugin's manifest file, see the link above - $IPServer = $config['ipserver']; - $UCRMAPIToken = $config['apitoken']; + $IPServer = $config['ipserver']; + $UCRMAPIToken = $config['apitoken']; $CallBellAPIToken = $config['tokencallbell']; $clientPhoneNumber = $this->validarNumeroTelefono($phoneToUpdate); //Obtiene el número de celular del cliente que sea del tipo de contacto "WhatsApp" - //$this->logger->info("Número de telefono obtenido para actualizar:" .$clientPhoneNumber. PHP_EOL); + //$this->logger->info("Número de telefono obtenido para actualizar:" .$clientPhoneNumber. PHP_EOL); if (empty($clientPhoneNumber)) { $this->logger->warning('No se encontró un teléfono celular válido para el cliente: ' . $notificationData->clientId); @@ -1011,7 +1056,7 @@ abstract class AbstractMessageNotifierFacade //$this->sendMessage($notificationData, $clientSmsNumber, $messageBody); //$this->sendWhatsApp($notificationData, $clientSmsNumber); - $client_callbell_api = new ClientCallBellAPI($UCRMAPIToken, $IPServer, $CallBellAPIToken); + $client_callbell_api = new ClientCallBellAPI($UCRMAPIToken, $IPServer, $CallBellAPIToken); $response_getContactCallBell = json_decode($client_callbell_api->getContactWhatsapp($clientPhoneNumber), true); $client_callbell_api->patchServiceStatusWhatsApp($response_getContactCallBell, $notificationData); @@ -1079,11 +1124,11 @@ abstract class AbstractMessageNotifierFacade function patchClientCustomAttribute($clientId, $attributeId, $value): bool { - $logger = \Ubnt\UcrmPluginSdk\Service\PluginLogManager::create(); + $logger = \Ubnt\UcrmPluginSdk\Service\PluginLogManager::create(); $configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create(); - $config = $configManager->loadConfig(); - $ucrmBaseUri = $config['ipserver']; - $authToken = $config['apitoken']; + $config = $configManager->loadConfig(); + $ucrmBaseUri = $config['ipserver']; + $authToken = $config['apitoken']; $ucrmBaseUri = 'https://' . $ucrmBaseUri . '/crm/api/v1.0/'; $clientguzz = new Client(); //instancia de cliente GuzzleHttp para consumir API UISP CRM @@ -1107,10 +1152,10 @@ abstract class AbstractMessageNotifierFacade 'X-Auth-Token' => $authToken, 'Content-Type' => 'application/json', ], - 'body' => $json_data_patch, + 'body' => $json_data_patch, 'verify' => false, // Deshabilitar la verificación del certificado SSL ], - + ); //evaluar el código de respuesta HTTP y si es 200 se retorna true if ($responseCRM->getStatusCode() === 200) { @@ -1126,15 +1171,15 @@ abstract class AbstractMessageNotifierFacade $this->logger->info("Error al hacer el patch al CRM: " . $error->getMessage() . PHP_EOL); return false; // Return false if patch fails } - + } function getVaultCredentials($dataToSearch): string { - $logger = \Ubnt\UcrmPluginSdk\Service\PluginLogManager::create(); + $logger = \Ubnt\UcrmPluginSdk\Service\PluginLogManager::create(); $configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create(); - $config = $configManager->loadConfig(); - $ucrmBaseUri = $config['ipserver']; - $authToken = $config['apitoken']; + $config = $configManager->loadConfig(); + $ucrmBaseUri = $config['ipserver']; + $authToken = $config['apitoken']; if ($ucrmBaseUri === '172.16.5.134') { //opción solo para el servidor de pruebas return 'gYAIEK:Be}SK*01z5+/V'; @@ -1147,19 +1192,19 @@ abstract class AbstractMessageNotifierFacade // Crear una instancia del cliente Guzzle $clientUnms = new Client([ 'base_uri' => $unmsBaseUri, - 'verify' => false, // Deshabilitar la verificación del certificado SSL + 'verify' => false, // Deshabilitar la verificación del certificado SSL ]); $clientUcrm = new Client([ 'base_uri' => $ucrmBaseUri, - 'verify' => false, // Deshabilitar la verificación del certificado SSL + 'verify' => false, // Deshabilitar la verificación del certificado SSL ]); //validar si dataToSearch es una dirección IP o una dirección MAC if (filter_var($dataToSearch, FILTER_VALIDATE_IP)) { // La variable es una dirección IP válida // $logger->appendLog('Consulta por dirección IP: ' . $dataToSearch); - print('Consulta por dirección IP: ' . $dataToSearch . PHP_EOL); + print ('Consulta por dirección IP: ' . $dataToSearch . PHP_EOL); $IpAddressClientId = filter_var($dataToSearch, FILTER_VALIDATE_IP); @@ -1172,7 +1217,7 @@ abstract class AbstractMessageNotifierFacade if ($responseSitesByIP->getStatusCode() === 200) { - $datasSitesByIP = json_decode((string) $responseSitesByIP->getBody(), true); + $datasSitesByIP = json_decode((string) $responseSitesByIP->getBody(), true); $jsonDevicesBySite = json_encode($datasSitesByIP, JSON_PRETTY_PRINT); //print_r($jsonDevicesBySite . PHP_EOL); //Devices por ID del sitio @@ -1263,9 +1308,9 @@ abstract class AbstractMessageNotifierFacade } catch (RequestException $requestException) { // Manejar errores de la solicitud, si hay error 404 entonces responder que no se encontró niguna IP asociada a alguna antena o dispositivo de red if ($requestException->hasResponse()) { - $response = $requestException->getResponse(); + $response = $requestException->getResponse(); $statusCode = $response->getStatusCode(); - $reason = $response->getReasonPhrase(); + $reason = $response->getReasonPhrase(); // echo "Error: {$statusCode} - {$reason}" . PHP_EOL; // echo $response->getBody(); if ($statusCode == 404) { @@ -1287,7 +1332,7 @@ abstract class AbstractMessageNotifierFacade } else if (preg_match('/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/', $dataToSearch)) { // La variable es una dirección MAC válida // $logger->appendLog('Consulta por dirección MAC: ' . $dataToSearch); - print('Consulta por dirección MAC: ' . $dataToSearch . PHP_EOL); + print ('Consulta por dirección MAC: ' . $dataToSearch . PHP_EOL); try { // //para mandarla al endpoint de dispositivos por MAC se necesita convertir la cadena de la direccion mac en un formato como el siguiente ejemplo: para la dirección mac 60:22:32:c8:b2:c3 quedaría como 60%3A22%3A32%3Ac8%3Ab2%3Ac3 @@ -1351,9 +1396,9 @@ abstract class AbstractMessageNotifierFacade } catch (RequestException $requestException) { // Manejar errores de la solicitud, si hay error 404 entonces responder que no se encontró niguna MAC asociada a alguna antena o dispositivo de red if ($requestException->hasResponse()) { - $response = $requestException->getResponse(); + $response = $requestException->getResponse(); $statusCode = $response->getStatusCode(); - $reason = $response->getReasonPhrase(); + $reason = $response->getReasonPhrase(); // echo "Error: {$statusCode} - {$reason}" . PHP_EOL; // echo $response->getBody(); if ($statusCode == 404) { @@ -1389,14 +1434,14 @@ abstract class AbstractMessageNotifierFacade } catch (RequestException $requestException) { // Manejar errores de la solicitud if ($requestException->hasResponse()) { - $response = $requestException->getResponse(); + $response = $requestException->getResponse(); $statusCode = $response->getStatusCode(); - $reason = $response->getReasonPhrase(); + $reason = $response->getReasonPhrase(); //si el statusCode es 404 significa que no se encontró el cliente if ($statusCode == 404) { echo "No se encontró el cliente con el ID proporcionado." . PHP_EOL; $logger->appendLog('No se encontró el cliente con el ID proporcionado: ' . $IpAddressClientId); - // print_r('No se encontró el cliente con el ID proporcionado: ' . $IpAddressClientId . PHP_EOL); + // print_r('No se encontró el cliente con el ID proporcionado: ' . $IpAddressClientId . PHP_EOL); return 'Error: No se encontró el cliente con el ID proporcionado: ' . $IpAddressClientId; // Return early if the client is not found } return 'Error: ' . $reason; // Return early if the request fails @@ -1404,7 +1449,7 @@ abstract class AbstractMessageNotifierFacade } else { // echo "Error: " . $requestException->getMessage() . PHP_EOL; $logger->appendLog('Error: ' . $requestException->getMessage()); - // print_r('Error: ' . $requestException->getMessage() . PHP_EOL); + // print_r('Error: ' . $requestException->getMessage() . PHP_EOL); return 'Error: ' . $requestException->getMessage(); // Return early if the request fails } @@ -1420,7 +1465,7 @@ abstract class AbstractMessageNotifierFacade } else { // echo "No se encontraron servicios para el cliente proporcionado." . PHP_EOL; $logger->appendLog('No se encontraron servicios para el cliente proporcionado: ' . $IpAddressClientId); - // print_r('No se encontraron servicios para el cliente proporcionado: ' . $IpAddressClientId . PHP_EOL); + // print_r('No se encontraron servicios para el cliente proporcionado: ' . $IpAddressClientId . PHP_EOL); return "Error: No se encontraron servicios para el cliente proporcionado: " . $IpAddressClientId; // Return early if no services are found } @@ -1440,14 +1485,14 @@ abstract class AbstractMessageNotifierFacade } catch (RequestException $requestException) { // Manejar errores de la solicitud if ($requestException->hasResponse()) { - $response = $requestException->getResponse(); + $response = $requestException->getResponse(); $statusCode = $response->getStatusCode(); - $reason = $response->getReasonPhrase(); + $reason = $response->getReasonPhrase(); //si el statusCode es 404 significa que no se encontró el cliente if ($statusCode == 404) { // echo "No se encontró el cliente con el ID proporcionado." . PHP_EOL; $logger->appendLog('No se encontró el cliente con el ID proporcionado: ' . $IpAddressClientId); - // print_r('No se encontró el devicie con el ID proporcionado: ' . $IpAddressClientId . PHP_EOL); + // print_r('No se encontró el devicie con el ID proporcionado: ' . $IpAddressClientId . PHP_EOL); return 'Error: No se encontró el devicie con el ID proporcionado: ' . $IpAddressClientId; // Return early if the client is not found } return 'Error: ' . $reason; // Return early if the request fails @@ -1455,7 +1500,7 @@ abstract class AbstractMessageNotifierFacade } else { // echo "Error: " . $requestException->getMessage() . PHP_EOL; $logger->appendLog('Error: ' . $requestException->getMessage()); - // print_r('Error: ' . $requestException->getMessage() . PHP_EOL); + // print_r('Error: ' . $requestException->getMessage() . PHP_EOL); return 'Error: ' . $requestException->getMessage(); // Return early if the request fails } @@ -1472,18 +1517,18 @@ abstract class AbstractMessageNotifierFacade //verificar con iiset si existe la clave 'identification' y 'apDevice' en el primer elemento del array if (isset($dataDevicesBySite[0]['identification']) && isset($dataDevicesBySite[0]['attributes']['apDevice'])) { $idClientDevice = $dataDevicesBySite[0]['identification']['id']; - $deviceID = $dataDevicesBySite[0]['attributes']['apDevice']['id']; + $deviceID = $dataDevicesBySite[0]['attributes']['apDevice']['id']; } else { // echo "No se encontró la clave 'identification' o 'apDevice' en la respuesta." . PHP_EOL; $logger->appendLog('No se encontró la clave \'identification\' o \'apDevice\' en la respuesta.'); - // print_r('Este cliente es un repetidor.' . PHP_EOL); + // print_r('Este cliente es un repetidor.' . PHP_EOL); return "Este cliente es un repetidor."; // Return early if the key is not found } } else { // echo "No se encontraron dispositivos para el sitio proporcionado." . PHP_EOL; $logger->appendLog('No se encontraron dispositivos para el sitio proporcionado: ' . $unmsSiteID); - // print_r('No se encontraron dispositivos para el sitio proporcionado: ' . $unmsSiteID . PHP_EOL); + // print_r('No se encontraron dispositivos para el sitio proporcionado: ' . $unmsSiteID . PHP_EOL); return "Error: No se encontraron dispositivos para el sitio proporcionado."; // Return early if no devices are found } @@ -1503,14 +1548,14 @@ abstract class AbstractMessageNotifierFacade } catch (RequestException $requestException) { // Manejar errores de la solicitud if ($requestException->hasResponse()) { - $response = $requestException->getResponse(); + $response = $requestException->getResponse(); $statusCode = $response->getStatusCode(); - $reason = $response->getReasonPhrase(); + $reason = $response->getReasonPhrase(); //si el statusCode es 404 significa que no se encontró el cliente if ($statusCode == 404) { // echo "No se encontró el cliente con el ID proporcionado." . PHP_EOL; $logger->appendLog('No se encontró el cliente con el ID proporcionado: ' . $IpAddressClientId); - // print_r('No se encontró el device con el ID proporcionado: ' . $IpAddressClientId . PHP_EOL); + // print_r('No se encontró el device con el ID proporcionado: ' . $IpAddressClientId . PHP_EOL); return 'Error: No se encontró el device con el ID proporcionado: ' . $IpAddressClientId; // Return early if the client is not found } return 'Error: ' . $reason; // Return early if the request fails @@ -1518,7 +1563,7 @@ abstract class AbstractMessageNotifierFacade } else { // echo "Error: " . $requestException->getMessage() . PHP_EOL; $logger->appendLog('Error: ' . $requestException->getMessage()); - // print_r('Error: ' . $requestException->getMessage() . PHP_EOL); + // print_r('Error: ' . $requestException->getMessage() . PHP_EOL); return 'Error: ' . $requestException->getMessage(); // Return early if the request fails } @@ -1540,14 +1585,14 @@ abstract class AbstractMessageNotifierFacade } catch (RequestException $requestException) { // Manejar errores de la solicitud if ($requestException->hasResponse()) { - $response = $requestException->getResponse(); + $response = $requestException->getResponse(); $statusCode = $response->getStatusCode(); - $reason = $response->getReasonPhrase(); + $reason = $response->getReasonPhrase(); //si el statusCode es 404 significa que no se encontró el cliente if ($statusCode == 404) { // echo "No se encontró el cliente con el ID proporcionado." . PHP_EOL; $logger->appendLog('No se encontró el cliente con el ID proporcionado: ' . $IpAddressClientId); - // print_r('No se encontró el device con el ID proporcionado: ' . $IpAddressClientId . PHP_EOL); + // print_r('No se encontró el device con el ID proporcionado: ' . $IpAddressClientId . PHP_EOL); return 'Error: No se encontró el device con el ID proporcionado: ' . $IpAddressClientId; // Return early if the client is not found } return 'Error: ' . $reason; // Return early if the request fails @@ -1555,7 +1600,7 @@ abstract class AbstractMessageNotifierFacade } else { // echo "Error: " . $requestException->getMessage() . PHP_EOL; $logger->appendLog('Error: ' . $requestException->getMessage()); - // print_r('Error: ' . $requestException->getMessage() . PHP_EOL); + // print_r('Error: ' . $requestException->getMessage() . PHP_EOL); return 'Error: ' . $requestException->getMessage(); // Return early if the request fails } } @@ -1569,21 +1614,21 @@ abstract class AbstractMessageNotifierFacade } else { // echo "No se encontró la contraseña en la respuesta de la API." . PHP_EOL; $logger->appendLog('No se encontró una contraseña en la bóveda para la antena de este cliente, es altamente probable que conserve una contraseña conocida.'); - // print_r('No se encontró una contraseña en la bóveda para la antena de este cliente, es altamente probable que conserve una contraseña conocida.' . PHP_EOL); + // print_r('No se encontró una contraseña en la bóveda para la antena de este cliente, es altamente probable que conserve una contraseña conocida.' . PHP_EOL); return "Error: No se encontró una contraseña en la bóveda para la antena de este cliente, es altamente probable que conserve una contraseña conocida."; // Return early if the password is not found } } else { // echo "Error en la solicitud. Código de estado HTTP: " . $responsePasswordVault->getStatusCode() . PHP_EOL; $logger->appendLog('Error en la solicitud. Código de estado HTTP: ' . $responsePasswordVault->getStatusCode()); - // print_r('Error en la solicitud. Código de estado HTTP: ' . $responsePasswordVault->getStatusCode() . PHP_EOL); + // print_r('Error en la solicitud. Código de estado HTTP: ' . $responsePasswordVault->getStatusCode() . PHP_EOL); return 'Error: Falla en la solicitud. Código de estado HTTP: ' . $responsePasswordVault->getStatusCode(); // Return early if the request fails } } else { // echo "Error en la solicitud. Código de estado HTTP: " . $responseDevicesBySite->getStatusCode() . PHP_EOL; $logger->appendLog('Error en la solicitud. Código de estado HTTP: ' . $responseDevicesBySite->getStatusCode()); - // print_r('Error en la solicitud. Código de estado HTTP: ' . $responseDevicesBySite->getStatusCode() . PHP_EOL); + // print_r('Error en la solicitud. Código de estado HTTP: ' . $responseDevicesBySite->getStatusCode() . PHP_EOL); return 'Error: Falla en la solicitud. Código de estado HTTP: ' . $responseDevicesBySite->getStatusCode(); // Return early if the request fails } diff --git a/src/Facade/ClientCallBellAPI.php b/src/Facade/ClientCallBellAPI.php index 68fa8b1b..d4b593ad 100755 --- a/src/Facade/ClientCallBellAPI.php +++ b/src/Facade/ClientCallBellAPI.php @@ -57,13 +57,14 @@ class ClientCallBellAPI $IPServer, $CallBellAPIToken ) { - $this->UCRMAPIToken = $UCRMAPIToken; - $this->IPServer = $IPServer; + $this->UCRMAPIToken = $UCRMAPIToken; + $this->IPServer = $IPServer; $this->CallBellAPIToken = $CallBellAPIToken; } public function updateContact($client_uuid) - {} + { + } public function printPrueba($clientWhatsAppNumber, $notificationData) { @@ -118,7 +119,7 @@ class ClientCallBellAPI // $log->appendLog("Datos de la notificación de trabajo: " . $jsonJobNotificationData . PHP_EOL); // --- ¡AÑADE ESTAS LÍNEAS PARA CONVERTIR A BOOLEANO REAL! --- - $reprogramming = filter_var($reprogramming, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + $reprogramming = filter_var($reprogramming, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); $changeInstaller = filter_var($changeInstaller, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); // ----------------------------------------------------------- @@ -134,37 +135,52 @@ class ClientCallBellAPI 'Content-Type: application/json', ]); - $campo1 = sprintf(' *%s*', $jobNotificationData['clientFullName']); - $campo2 = sprintf('*#%s*', $jobNotificationData['jobId']); - $campo3 = sprintf('%s', $jobNotificationData['date']); - $campo4 = sprintf('*%s*', $jobNotificationData['installerName']); + $campo1 = '👤 ' . sprintf(' *%s*', $jobNotificationData['clientFullName']); + if ($changeInstaller && !$reprogramming) { + $campo2 = sprintf('se ha hecho un cambio de técnico 👷🏻‍♂️🔄 para su visita con el folio *#️⃣%s*', $jobNotificationData['jobId']); + } else { + $campo2 = sprintf('*#️⃣%s*', $jobNotificationData['jobId']); + } + $campo3 = '🗓️ ' . sprintf('%s', $jobNotificationData['date']); + if ($changeInstaller && $reprogramming) { + $campo4 = 'Además se ha hecho un cambio de técnico por el siguiente 👷🏻‍♂️➡️ ' . sprintf('*%s*', $jobNotificationData['installerName']); + } else { + $campo4 = '👷🏻‍♂️➡️ ' . sprintf('*%s*', $jobNotificationData['installerName']); + } + + $campo5 = "asegúrese de que alguien esté presente en el domicilio 🏠 para permitir el acceso y confirme su disponibilidad."; $log->appendLog("DEBUG: Valores antes de la estructura IF - Reprogramming: " . var_export($reprogramming, true) . ", ChangeInstaller: " . var_export($changeInstaller, true) . PHP_EOL); - if ($reprogramming && ! $changeInstaller) { + if ($reprogramming && !$changeInstaller) { + //{{1}}, se ha reprogramado su visita técnica con el folio {{2}} + + $campo3 = '🗓️➡️ ' . sprintf('%s', $jobNotificationData['date']); + $campo1_combinado = "Estimado cliente $campo1 se ha reprogramado su visita técnica con folio $campo2"; + // Case: true, false //Enviar notificación de reprogramación al cliente $log->appendLog("Enviando notificación de reprogramación al cliente, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL); - $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\"],\n \"template_uuid\": \"323631bf578e43fb8a0095f55978aae8\",\n \"optin_contact\": true\n }"; - } else if (! $reprogramming && $changeInstaller) { + $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1_combinado\", \"$campo3\", \"$campo4\", \"$campo5\"],\n \"template_uuid\": \"715eed9d6f2d4d90853f25e296202e00\",\n \"optin_contact\": true\n }"; + } else if (!$reprogramming && $changeInstaller) { // Case: false, true //Enviar notificación de cambio de instalador $log->appendLog("Enviando notificación de cambio de instalador al cliente, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL); - $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\"],\n \"template_uuid\": \"c59c3ce2c9c6439b941b0d42d1435605\",\n \"optin_contact\": true\n }"; - } else if (! $reprogramming && ! $changeInstaller) { // <--- Ahora este else if está correctamente encadenado - // Case: false, false - //Enviar notificación normal de visita técnica al cliente + $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\"],\n \"template_uuid\": \"d684e6fa2ba24593a86c98be1815831d\",\n \"optin_contact\": true\n }"; + } else if (!$reprogramming && !$changeInstaller) { // <--- Ahora este else if está correctamente encadenado + // Case: false, false + //Enviar notificación normal de visita técnica al cliente $log->appendLog("Enviando notificación normal de visita técnica al cliente, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL); - $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\"],\n \"template_uuid\": \"c0ef8228b50a4d9690a2e87bc11e9ab3\",\n \"optin_contact\": true\n }"; - }else if ($reprogramming && $changeInstaller) { // <--- Ahora este else if está correctamente encadenado + $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\"],\n \"template_uuid\": \"07cfbc6e394044608485b530a27177d0\",\n \"optin_contact\": true\n }"; + } else if ($reprogramming && $changeInstaller) { // <--- Ahora este else if está correctamente encadenado // Case: true, true //Enviar notificación de cambio de instalador y reprogramación al cliente $log->appendLog("Enviando notificación de cambio de instalador y reprogramación al cliente, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL); - $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\"],\n \"template_uuid\": \"99e2629a3be2421687037c001222bfe4\",\n \"optin_contact\": true\n }"; - } else { + $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\"],\n \"template_uuid\": \"145885d15323414f978f1e3f249c2ae1\",\n \"optin_contact\": true\n }"; + } else { // Case: true, true (la única combinación restante con booleanos) $log->appendLog("No se encontró una opción válida para enviar la notificación (reprogramming y changeInstaller son true)." . PHP_EOL); - // Decide qué hacer aquí, ¿Quizás devolver false? ¿O manejar esta combinación? + // Decide qué hacer aquí, ¿Quizás devolver false? ¿O manejar esta combinación? return false; // O el manejo adecuado para true/true } @@ -211,7 +227,7 @@ class ClientCallBellAPI $log->appendLog("Datos de la notificación de tarea: " . $jsonJobNotificationData . PHP_EOL); // --- ¡AÑADE ESTAS LÍNEAS PARA CONVERTIR A BOOLEANO REAL! --- - $reprogramming = filter_var($reprogramming, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + $reprogramming = filter_var($reprogramming, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); $changeInstaller = filter_var($changeInstaller, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); // ----------------------------------------------------------- @@ -227,39 +243,60 @@ class ClientCallBellAPI 'Content-Type: application/json', ]); - $campo1 = $jobInstallerNotificationData['installerName']; - if ($changeInstaller) { + $campo1 = '👷🏻‍♂️ ' . $jobInstallerNotificationData['installerName']; + if (!$reprogramming && $changeInstaller) { $campo2 = $jobInstallerNotificationData['subjectOfChange']; - $campo3 = sprintf("#%s", $jobInstallerNotificationData['jobId']); - $campo4 = $jobInstallerNotificationData['clientFullName']; + $campo3 = sprintf("#️⃣%s", $jobInstallerNotificationData['jobId']); + $campo4 = '👤 *Cliente:* ' . $jobInstallerNotificationData['clientFullName']; $campo5 = $jobInstallerNotificationData['additionalChangeData']; } else { - $campo2 = sprintf("#%s", $jobInstallerNotificationData['jobId']); - $campo3 = $jobInstallerNotificationData['clientFullName']; + $campo2 = sprintf("#️⃣%s", $jobInstallerNotificationData['jobId']); + $campo3 = '👤 *' . $jobInstallerNotificationData['clientFullName'] . '*'; // $campo4 = $jobInstallerNotificationData['clientAddress']; - $campo4 = $jobInstallerNotificationData['clientWhatsApp']; - $campo5 = $jobInstallerNotificationData['date']; - $campo6 = $jobInstallerNotificationData['jobDescription']; - $campo7 = $jobInstallerNotificationData['gmapsLocation']; - $campo8 = $passwordAntenaCliente; + $campo4 = '☎️ ' . $jobInstallerNotificationData['clientWhatsApp']; + $campo5 = '🗓️ ' . $jobInstallerNotificationData['date']; + $campo6 = '🛠️ ' . $jobInstallerNotificationData['jobDescription']; + $campo7 = '📌 ' . $jobInstallerNotificationData['gmapsLocation']; + $campo8 = '🔐 ' . $passwordAntenaCliente; } - if ($reprogramming && ! $changeInstaller) { + if ($reprogramming && !$changeInstaller) { + $jobId = sprintf("#️⃣ *%s*", $jobInstallerNotificationData['jobId']); + $clientFullName = sprintf("👤 *%s*", $jobInstallerNotificationData['clientFullName']); + $date = sprintf("🗓️➡️ %s", $jobInstallerNotificationData['date']); + $installerName = sprintf("👷🏻‍♂️ *%s*", $jobInstallerNotificationData['installerName']); + + $campo1_combinado = "$installerName se reprogramó una tarea con el folio $jobId para el cliente $clientFullName, la nueva fecha será el $date"; + $campo2 = $jobInstallerNotificationData['clientWhatsApp']; + $campo3 = $jobInstallerNotificationData['gmapsLocation']; + $campo4 = $passwordAntenaCliente; + //Enviar notificación de reprogramación $log->appendLog("Enviando notificación de reprogramación al instalador, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL); - $curl_string = "{\n \"to\": \"$installerWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\", \"$campo6\", \"$campo7\", \"$campo8\"],\n \"template_uuid\": \"7eb4d8e27cf740779dd6777fad7ffaf4\",\n \"optin_contact\": true\n }"; - } else if (! $reprogramming && $changeInstaller) { + $curl_string = "{\n \"to\": \"$installerWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1_combinado\", \"$campo2\", \"$campo3\", \"$campo4\"],\n \"template_uuid\": \"88eeb6420a214fd8870dd28d741021c4\",\n \"optin_contact\": true\n }"; + } else if (!$reprogramming && $changeInstaller) { //Enviar notificación de cambio de instalador $log->appendLog("Enviando notificación de cambio de instalador al instalador anterior, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL); $curl_string = "{\n \"to\": \"$installerWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\"],\n \"template_uuid\": \"e1aa2b0fd3884595918f4ac2676acd29\",\n \"optin_contact\": true\n }"; - }else if ($reprogramming && $changeInstaller) { + } else if ($reprogramming && $changeInstaller) { //Enviar notificación de cambio de instalador $log->appendLog("Enviando notificación de cambio de instalador al instalador y notificación de reprogramación al instalador, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL); $curl_string = "{\n \"to\": \"$installerWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\"],\n \"template_uuid\": \"e1aa2b0fd3884595918f4ac2676acd29\",\n \"optin_contact\": true\n }"; - } else if (! $reprogramming && ! $changeInstaller) { - //Enviar notificación normal de asignación de tarea - $log->appendLog("Enviando notificación normal de asignación de tarea al instalador, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL); - $curl_string = "{\n \"to\": \"$installerWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\", \"$campo6\", \"$campo7\", \"$campo8\"],\n \"template_uuid\": \"670bedde35b3416f8c1a27f995ebe350\",\n \"optin_contact\": true\n }"; + } else if (!$reprogramming && !$changeInstaller) { + + //combinar el campo3, campo4, campo5, campo6, campo7 y campo8 en un solo campo con saltos de línea + $jobId = sprintf("#️⃣ *%s*", $jobInstallerNotificationData['jobId']); + $clientFullName = sprintf("👤 *%s*", $jobInstallerNotificationData['clientFullName']); + $date = sprintf("🗓️ %s", $jobInstallerNotificationData['date']); + $installerName = sprintf("👷🏻‍♂️ *%s*", $jobInstallerNotificationData['installerName']); + + $campo1_combinado = "$installerName se te ha asignado una tarea con folio $jobId para el cliente $clientFullName, para el $date"; + $campo2 = $jobInstallerNotificationData['clientWhatsApp']; + $campo3 = $jobInstallerNotificationData['gmapsLocation']; + $campo4 = $passwordAntenaCliente; + + $log->appendLog("Enviando notificación normal de tarea al instalador, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL); + $curl_string = "{\n \"to\": \"$installerWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1_combinado\", \"$campo2\", \"$campo3\", \"$campo4\"],\n \"template_uuid\": \"88eeb6420a214fd8870dd28d741021c4\",\n \"optin_contact\": true\n }"; } $log->appendLog("La cadena CURL que se envia es: " . $curl_string); @@ -311,23 +348,23 @@ class ClientCallBellAPI $pdf_payment_path = ''; $this->ucrmApi = UcrmApi::create(); - $payments = $this->ucrmApi->get( + $payments = $this->ucrmApi->get( 'payments/', [ - 'clientId' => $notificationData->clientData['id'], - 'limit' => 1, + 'clientId' => $notificationData->clientData['id'], + 'limit' => 1, 'direction' => 'DESC', ] ); - $payment_id = $payments[0]['id']; + $payment_id = $payments[0]['id']; $payment_amount = '$' . $payments[0]['amount']; //$saldo = '$' . $notificationData->clientData['accountBalance']; $nombre_cliente = sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']); $accountBalance = $notificationData->clientData['accountBalance']; - $saldoTexto = ''; + $saldoTexto = ''; if ($accountBalance < 0) { // Si el saldo es negativo, quitar el signo y poner "Pendientes" @@ -343,11 +380,11 @@ class ClientCallBellAPI // Configuración del cliente GuzzleHttp $clientGuzzleHttp = new Client([ 'base_uri' => $baseUri, - 'headers' => [ + 'headers' => [ 'X-Auth-App-Key' => $token, // Cambia el nombre de la cabecera de autorización - 'Accept' => 'application/pdf', // Indica que esperamos una respuesta en formato JSON + 'Accept' => 'application/pdf', // Indica que esperamos una respuesta en formato JSON ], - 'verify' => false, + 'verify' => false, ]); try { @@ -359,7 +396,7 @@ class ClientCallBellAPI // Construir el nombre del archivo PDF basado en el cliente $fileNameComprobante = 'Comprobante_' . str_replace(' ', '_', $nombre_cliente) . '.pdf'; - $rutaArchivo = __DIR__ . '/../../comprobantes/' . $fileNameComprobante; + $rutaArchivo = __DIR__ . '/../../comprobantes/' . $fileNameComprobante; // Guardar el contenido del PDF en un archivo local if (file_put_contents($rutaArchivo, $contenidoArchivo) !== false) { @@ -369,7 +406,7 @@ class ClientCallBellAPI return false; } - if (! file_exists($rutaArchivo)) { + if (!file_exists($rutaArchivo)) { $log->appendLog("El archivo PDF no existe: $rutaArchivo" . PHP_EOL); return false; } @@ -402,8 +439,8 @@ class ClientCallBellAPI } $fileNameComprobanteImage = str_replace('.pdf', '.png', $fileNameComprobante); - $url_file = $this->UploadReceiptToWordpressByImageFileName($fileNameComprobanteImage); //Carga del comprobante PDF a Wordpress para su posterior envío - // $url_file = $this->UploadReceiptToWordpressByImageFileName($fileNameComprobante);//Carga del comprobante PDF a Wordpress para su posterior envío + $url_file = $this->UploadReceiptToWordpressByImageFileName($fileNameComprobanteImage); //Carga del comprobante PDF a Wordpress para su posterior envío + // $url_file = $this->UploadReceiptToWordpressByImageFileName($fileNameComprobante);//Carga del comprobante PDF a Wordpress para su posterior envío $log->appendLog("Se terminó de subir comprobante a wordpress " . PHP_EOL); @@ -463,18 +500,18 @@ class ClientCallBellAPI public function sendTextPaymentNotificationWhatsApp($clientWhatsAppNumber, $notificationData): bool { - $nombre_cliente = sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']); - $folio = $notificationData->paymentData['id']; - $client_id = $notificationData->clientData['id']; - $fecha_pago = ''; + $nombre_cliente = sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']); + $folio = $notificationData->paymentData['id']; + $client_id = $notificationData->clientData['id']; + $fecha_pago = ''; $cantidad_pagada = $notificationData->paymentData['amount']; - $metodo_pago = ''; + $metodo_pago = ''; //$invoice_id= null; $total_factura = null; - $pago_factura = $notificationData->paymentData['amount']; + $pago_factura = $notificationData->paymentData['amount']; // $saldoTexto= null; - $creditoPorPago = $notificationData->paymentData['creditAmount']; - $texto_credito = null; + $creditoPorPago = $notificationData->paymentData['creditAmount']; + $texto_credito = null; $creditoClienteBase = $notificationData->clientData['accountCredit']; switch ($notificationData->paymentData['methodId']) { @@ -525,11 +562,11 @@ class ClientCallBellAPI $pdf_payment_path = ''; $this->ucrmApi = UcrmApi::create(); - $payments = $this->ucrmApi->get( + $payments = $this->ucrmApi->get( 'payments/', [ - 'clientId' => $notificationData->clientData['id'], - 'limit' => 1, + 'clientId' => $notificationData->clientData['id'], + 'limit' => 1, 'direction' => 'DESC', ] @@ -549,7 +586,7 @@ class ClientCallBellAPI $fecha_pago = $paymentDate->format('d/m/Y g:ia'); $accountBalance = $notificationData->clientData['accountBalance']; - $saldoTexto = ''; + $saldoTexto = ''; if ($accountBalance < 0) { // Si el saldo es negativo, quitar el signo y poner "Pendientes" @@ -565,7 +602,7 @@ class ClientCallBellAPI $log->appendLog("Datos client data credit amount: " . $notificationData->paymentData['creditAmount'] . PHP_EOL); $cantidad_pagadaFormateada = '$' . number_format($cantidad_pagada, 2, ',', '.') . ' MXN'; - $creditoPorPagoFormateado = '$' . number_format($creditoPorPago, 2, ',', '.') . ' MXN'; + $creditoPorPagoFormateado = '$' . number_format($creditoPorPago, 2, ',', '.') . ' MXN'; if ($creditoClienteBase > 0 && empty($notificationData->paymentData['paymentCovers'])) { @@ -585,22 +622,22 @@ class ClientCallBellAPI // Configuración del cliente GuzzleHttp $clientGuzzleHttp = new Client([ 'base_uri' => $baseUri, - 'headers' => [ + 'headers' => [ 'X-Auth-App-Key' => $token, // Cambia el nombre de la cabecera de autorización - 'Accept' => 'application/pdf', // Indica que esperamos una respuesta en formato JSON + 'Accept' => 'application/pdf', // Indica que esperamos una respuesta en formato JSON ], - 'verify' => false, + 'verify' => false, ]); $log->appendLog("Verificar paymentCovers " . PHP_EOL); $log->appendLog("payment covers" . json_encode($notificationData->paymentData['paymentCovers']) . PHP_EOL); - if (! empty($notificationData->paymentData['paymentCovers'])) { + if (!empty($notificationData->paymentData['paymentCovers'])) { $log->appendLog('Datos del payment covers:' . PHP_EOL); $invoiceIds = ''; // Variable para almacenar los invoiceId - $amounts = ''; // Variable para almacenar los amounts formateados + $amounts = ''; // Variable para almacenar los amounts formateados foreach ($notificationData->paymentData['paymentCovers'] as $paymentCover) { $log->appendLog('Invoice ID pagado: ' . $paymentCover['invoiceId'] . ' de esta cantidad: ' . $paymentCover['amount'] . PHP_EOL); @@ -615,9 +652,9 @@ class ClientCallBellAPI $amounts .= $formattedAmount . ', '; } - // Eliminar la última coma y el espacio extra usando substr + // Eliminar la última coma y el espacio extra usando substr $invoiceIds = substr($invoiceIds, 0, -2); // Elimina los últimos dos caracteres (coma y espacio) - $amounts = substr($amounts, 0, -2); // Elimina los últimos dos caracteres (coma y espacio) + $amounts = substr($amounts, 0, -2); // Elimina los últimos dos caracteres (coma y espacio) // Mostrar las cadenas finales $log->appendLog('Todos los Invoice IDs: ' . $invoiceIds . PHP_EOL); @@ -629,7 +666,7 @@ class ClientCallBellAPI $response = $clientGuzzleHttp->request('GET', "invoices/$invoiceIds"); // Realizar la solicitud a la API y guardar el contenido en un archivo local - $responseInvoices = $response->getBody()->getContents(); + $responseInvoices = $response->getBody()->getContents(); $responseInvoicesJSON = json_decode($responseInvoices, true); $log->appendLog('Numero de factura: ' . $responseInvoicesJSON['number'] . PHP_EOL); $log->appendLog('TOTAL de factura: ' . $responseInvoicesJSON['total'] . PHP_EOL); @@ -640,14 +677,14 @@ class ClientCallBellAPI } } else { $log->appendLog("no hay datos en payment covers" . PHP_EOL); - $invoiceIds = $notificationData->paymentData['id']; - $amounts = $notificationData->paymentData['amount']; + $invoiceIds = $notificationData->paymentData['id']; + $amounts = $notificationData->paymentData['amount']; $total_factura = 0; } //$cantidad_pagadaFormateada = '$' . number_format($cantidad_pagada, 2, ',', '.') . ' MXN'; $log->appendLog("Se terminó de verificar payment covers" . PHP_EOL); $total_facturaFormateada = '$' . number_format($total_factura, 2, ',', '.') . ' MXN'; - $pagoFacturaFormateado = '$' . $amounts . ' MXN'; + $pagoFacturaFormateado = '$' . $amounts . ' MXN'; $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"John Doe\"\n },\n \"template_values\": [\"$nombre_cliente\", \"$folio\", \"$client_id\", \"$fecha_pago\", \"$cantidad_pagadaFormateada\", \"$metodo_pago\", \"$invoiceIds\", \"$total_facturaFormateada\", \"$pagoFacturaFormateado\", \"$saldoTexto\", \"$texto_credito\"],\n \"template_uuid\": \"c1396a6ad3cb4192916d4ac2bfb782a5\",\n \"optin_contact\": true\n }"; } @@ -739,7 +776,7 @@ class ClientCallBellAPI // $invoice_id = $invoices[0]['id']; // $invoices_amount = '$' . $invoices[0]['amount']; - $saldo = '$' . $notificationData->clientData['accountBalance']; + $saldo = '$' . $notificationData->clientData['accountBalance']; $nombre_cliente = sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']); // Configuración del cliente GuzzleHttp @@ -826,13 +863,13 @@ class ClientCallBellAPI { $log = PluginLogManager::create(); //Initialize Logger - //imprimir notificacionData + //imprimir notificacionData $log->appendLog("Notificacion data: " . json_encode($notificationData) . PHP_EOL); //ejemplo de $notificationData: {"uuid":"cad4fa25-176e-4823-9f4c-1421d05d2a31","changeType":"edit","entity":"client","entityId":2,"message":null,"clientId":2,"eventName":"client.edit","clientData":{"id":2,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"31 Chiapas","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"Cliente espacial, el m\u00e1s chido","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2024-01-25T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":true,"firstName":"Daniel Humberto","lastName":"Soto Villegas Pollerias2","username":"danydhsv","contacts":[{"id":2,"clientId":2,"email":"dhsv.141089@gmail.com","phone":"5214181878106","name":"Personal","isBilling":false,"isContact":false,"types":[{"id":1000,"name":"WhatsApp"}]},{"id":170,"clientId":2,"email":null,"phone":"5214181817609","name":"Bussiness","isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":112,"clientId":2,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_PetN1dhr4rx0kX","clientZoneVisible":true},{"id":113,"clientId":2,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"0021804341999569810","clientZoneVisible":true},{"id":178,"clientId":2,"customAttributeId":15,"name":"Site","key":"site","value":"0LOCS","clientZoneVisible":false},{"id":179,"clientId":2,"customAttributeId":16,"name":"Antena\/Sectorial","key":"antenaSectorial","value":"Sectorial-4b 172.16.13.16\/24","clientZoneVisible":false}],"accountBalance":1553.33,"accountCredit":1553.33,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[{"id":2,"name":"NS EXENTO","colorBackground":"#42a3df","colorText":"#fff"}],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1564209,"addressGpsLon":-100.9384185,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":true,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":null} - //buscar el attribute con el key site y antenaSectorial - $attributes = $notificationData->clientData['attributes']; //Obtener los atributos del cliente - $site = ''; + //buscar el attribute con el key site y antenaSectorial + $attributes = $notificationData->clientData['attributes']; //Obtener los atributos del cliente + $site = ''; $antenaSectorial = ''; // Iterar sobre los atributos @@ -849,11 +886,11 @@ class ClientCallBellAPI $log->appendLog("Dentro del proceso del patch: " . PHP_EOL); $this->ucrmApi = UcrmApi::create(); - $payments = $this->ucrmApi->get( + $payments = $this->ucrmApi->get( 'payments/', [ - 'clientId' => $notificationData->clientData['id'], - 'limit' => 1, + 'clientId' => $notificationData->clientData['id'], + 'limit' => 1, 'direction' => 'DESC', ] @@ -867,7 +904,7 @@ class ClientCallBellAPI // $log->appendLog("Esto es lo que trae la fecha mas reciente de los pagos opcion 2: " . $payments[0]['createdDate'] . PHP_EOL); $uuid = $response_getContactCallBell['contact']['uuid']; - $ch = curl_init(); + $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH'); curl_setopt($ch, CURLOPT_HTTPHEADER, [ @@ -890,7 +927,7 @@ class ClientCallBellAPI $log->appendLog("UUID: " . $uuid . PHP_EOL); $payment_method_id = $payments[0]['methodId']; - $payment_method = ''; + $payment_method = ''; switch ($payment_method_id) { case '11721cdf-a498-48be-903e-daa67552e4f6': @@ -953,7 +990,7 @@ class ClientCallBellAPI // } $accountBalance = $notificationData->clientData['accountBalance']; - $saldoTexto = ''; + $saldoTexto = ''; if ($accountBalance < 0) { // Si el saldo es negativo, quitar el signo y poner "Pendientes" @@ -967,11 +1004,11 @@ class ClientCallBellAPI } $resumenClienteJSON = '{' . - '"Cliente": "' . $notificationData->clientData['id'] . '",' . - '"Domicilio": "' . - //(($notificationData->clientData['fullAddress'] == null) ? 'Sin domicilio' : '' . $notificationData->clientData['fullAddress']) . '",' . - '"Nombre": "' . sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']) . '",' . - '"URL": "https://sistema.siip.mx/crm/client/' . $notificationData->clientId . '",' . + '"Cliente": "' . $notificationData->clientData['id'] . '",' . + '"Domicilio": "' . + //(($notificationData->clientData['fullAddress'] == null) ? 'Sin domicilio' : '' . $notificationData->clientData['fullAddress']) . '",' . + '"Nombre": "' . sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']) . '",' . + '"URL": "https://sistema.siip.mx/crm/client/' . $notificationData->clientId . '",' . '"Saldo Actual": "' . $saldoTexto . '",' . '"Monto Ultimo Pago": "$ ' . $payments[0]['amount'] . '",' . '"Estado": "' . @@ -985,22 +1022,22 @@ class ClientCallBellAPI $data_CRM = [ //"uuid" => $json_responseAPI->contact->uuid, - "name" => sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']), + "name" => sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']), "custom_fields" => [ - "Cliente" => $notificationData->clientData['id'], - "Domicilio" => ($notificationData->clientData['fullAddress'] == null) ? '📍❌ Sin domicilio' : '📍 ' . $notificationData->clientData['fullAddress'], - "Nombre" => sprintf("👤 %s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']), - "URL" => '🌐 https://sistema.siip.mx/crm/client/' . $notificationData->clientId, - "Saldo Actual" => $saldoTexto, - "Monto Ultimo Pago" => '💲 ' . $payments[0]['amount'], - "Estado" => ($notificationData->clientData['hasSuspendedService']) ? '🔴 Suspendido' : '🟢 Activo ', - "Resumen" => $resumenClienteJSON, - "Fecha Ultimo Pago" => '📆💸 ' . $fecha_ultimoPago_ajustada . ' con ' . $payment_method, + "Cliente" => $notificationData->clientData['id'], + "Domicilio" => ($notificationData->clientData['fullAddress'] == null) ? '📍❌ Sin domicilio' : '📍 ' . $notificationData->clientData['fullAddress'], + "Nombre" => sprintf("👤 %s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']), + "URL" => '🌐 https://sistema.siip.mx/crm/client/' . $notificationData->clientId, + "Saldo Actual" => $saldoTexto, + "Monto Ultimo Pago" => '💲 ' . $payments[0]['amount'], + "Estado" => ($notificationData->clientData['hasSuspendedService']) ? '🔴 Suspendido' : '🟢 Activo ', + "Resumen" => $resumenClienteJSON, + "Fecha Ultimo Pago" => '📆💸 ' . $fecha_ultimoPago_ajustada . ' con ' . $payment_method, "Fecha Ultima Actualizacion" => '📆🔄️ ' . $fecha_actual_ajustada, - "Clabe Interbancaria" => $clabeInterbancaria, - "Site" => $site, - "Antena/Sectorial" => $antenaSectorial, + "Clabe Interbancaria" => $clabeInterbancaria, + "Site" => $site, + "Antena/Sectorial" => $antenaSectorial, ], ]; @@ -1080,7 +1117,7 @@ class ClientCallBellAPI $log->appendLog("Actualizando estado del servicio " . PHP_EOL); $uuid = $response_getContactCallBell['contact']['uuid']; - $ch = curl_init(); + $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH'); curl_setopt($ch, CURLOPT_HTTPHEADER, [ @@ -1098,9 +1135,9 @@ class ClientCallBellAPI $fecha_actual_ajustada = $fecha_actual->format("d/m/Y H:i"); $data_CRM = [ - "name" => $nombre_cliente, + "name" => $nombre_cliente, "custom_fields" => [ - "Estado" => ( + "Estado" => ( isset($notificationData->serviceData['status']) && $notificationData->serviceData['status'] == 3 ) ? '🟠 Suspendido' : ( @@ -1126,14 +1163,14 @@ class ClientCallBellAPI function UploadReceiptToWordpressByImageFileName($imageFileName): string { - $log = PluginLogManager::create(); //Initialize Logger + $log = PluginLogManager::create(); //Initialize Logger $configManager = PluginConfigManager::create(); - $config = $configManager->loadConfig(); + $config = $configManager->loadConfig(); // Configuración de conexión FTP - $ftp_server = $config['hostServerFTP']; - $ftp_username = $config['usernameServerFTP']; - $ftp_password = $config['passServerFTP']; + $ftp_server = $config['hostServerFTP']; + $ftp_username = $config['usernameServerFTP']; + $ftp_password = $config['passServerFTP']; $remote_folder = "/public_html/wp/wp-content/uploads/img/"; $log->appendLog("Subiendo comprobante a worpdpress " . PHP_EOL); @@ -1141,15 +1178,15 @@ class ClientCallBellAPI // $ftp_server = "siip.mx"; // $ftp_username = "siip0001"; // $ftp_password = '$spGiT,[wa)n'; - $remote_file = "/public_html/wp/wp-content/uploads/img/" . $imageFileName; + $remote_file = "/public_html/wp/wp-content/uploads/img/" . $imageFileName; $file_to_upload = __DIR__ . '/../../comprobantes/' . $imageFileName; - $url = 'https://siip.mx/wp/wp-content/uploads/img/' . $imageFileName; + $url = 'https://siip.mx/wp/wp-content/uploads/img/' . $imageFileName; $log->appendLog("file_to_upload: " . $file_to_upload . PHP_EOL); // Conexión FTP $ftp_conn = ftp_connect($ftp_server) or die("No se pudo conectar al servidor FTP"); - $login = ftp_login($ftp_conn, $ftp_username, $ftp_password); + $login = ftp_login($ftp_conn, $ftp_username, $ftp_password); ftp_pasv($ftp_conn, true); // Verificar conexión y login if ($ftp_conn && $login) { @@ -1161,7 +1198,7 @@ class ClientCallBellAPI $log->appendLog("La URL es: " . $url . PHP_EOL); $this->deleteFilesWordpressExceptLastHundred($log, $ftp_conn, $remote_file); - // Cerrar conexión FTP + // Cerrar conexión FTP ftp_close($ftp_conn); //COMENTAR AQUÍ SI SE BORRAN LOS ARCHIVOS DE WORDPRESS DESCOMENTANDO EL CÓDIGO DE MÁS ABAJO return $url; //COMENTAR AQUÍ SI SE BORRAN LOS ARCHIVOS DE WORDPRESS DESCOMENTANDO EL CÓDIGO DE MÁS ABAJO @@ -1269,10 +1306,10 @@ class ClientCallBellAPI */ function deleteFilesExceptLastHundred() { - $log = PluginLogManager::create(); //Initialize Logger + $log = PluginLogManager::create(); //Initialize Logger $directory = __DIR__ . '/../../comprobantes/'; // Verificar si el directorio existe - if (! is_dir($directory)) { + if (!is_dir($directory)) { $log->appendLog('El directorio no existe.'); die("El directorio no existe."); } diff --git a/src/Plugin.php b/src/Plugin.php index e2deba24..6e0481ff 100755 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -129,7 +129,7 @@ class Plugin switch ($jsonData['type']) { case 'customer_cash_balance_transaction.created': $this->logger->info('Evento de transfencia al cliente encontrado: ' . json_encode($jsonData) . PHP_EOL); - if ($jsonData['data']['object']['type'] === 'funded') { + if ($jsonData['data']['object']['type'] === 'funded' || $jsonData['data']['object']['type'] === 'applied_to_payment') { $this->pluginNotifierFacade->createPaymentIntent($jsonData); } break; diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 1c2460bc..533e1e6d 100755 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '7cb26fe7358fc5b3d7671f2db68235f6bb07ef3f', + 'reference' => 'e34b3ec0f84e1274c6c6bbed67f8aacd933f0807', 'name' => 'ucrm-plugins/sms-twilio', 'dev' => false, ), @@ -307,7 +307,7 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '7cb26fe7358fc5b3d7671f2db68235f6bb07ef3f', + 'reference' => 'e34b3ec0f84e1274c6c6bbed67f8aacd933f0807', 'dev_requirement' => false, ), ),