O lead criado por uma conversa não emitia lead.created, então nenhum fluxo
podia começar nesse momento. O seletor passa a oferecer Lead criado.
Recorte do PR #1471 (branch develop do fork de @IanCouto): só o gatilho
"Lead criado". A infraestrutura de deploy da VPS do fork
(.github/scripts/deploy-vps-develop.sh, .github/workflows/deploy-vps-develop.yml,
tests/unit/deploy-vps-develop.test.ts e as entradas dela em
workflows-tem-permissions e gatilho-dos-jobs-de-entrega) fica fora: é da
VPS dele, não do produto.
Refs: #1471
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N9fyW7pXJCsyDPtu5PoQpN
Occupancy de wait_started recem-estacionado nao e timeout; inbound_woke sem texto desta pergunta permanece na espera; o kick acorda a espera existente antes de aplicar o texto.
O lint recusava ler ref no render dos cartões de lembrete — e isso escondia a suíte unitária. A leitura de contacts.email estourava nos invariantes (cliente só com rpc) e o Meet nascia failed. O rótulo 'Quem será atendido' não apontava para o input com o id do contato.
Introduced a new feature that allows users to schedule appointments up to two months in advance. The calendar now dynamically adjusts to the visible month, ensuring that users can see available slots without the previous limitation of a 30-day window. Updated related components and added tests to verify the new functionality. Documentation has been updated to reflect these changes.
Now, when scheduling an appointment, the client's email from their profile will receive a Google Calendar invite alongside any external guests. This change ensures that clients are notified via email, improving communication. Existing appointments will sync the client email in the next update. Updated related documentation and comments for clarity.
O formulário de edição foi reorganizado para separar claramente os campos de nome, duração e responsável dos campos de aviso no WhatsApp. Agora, os lembretes são apresentados em uma seção distinta, facilitando a leitura e a usabilidade. Além disso, foram adicionados testes para garantir que a disposição dos campos esteja correta.
A frase do aviso no WhatsApp deixa de ser só a padrão do cron: quem edita o tipo escreve o texto, com {{nome}}, {{titulo}}, {{dia}}, {{hora}} e {{endereco}}. Em branco, continua a frase de antes.
O sync com o upstream apagou o workflow que constrói :develop e faz pull na HostGator. Sem ele o push na develop não gera artefato e o servidor fica na versão antiga sem erro.
The `followup_stale` error now raises a `P0001` instead of `40001`, which previously caused clients to retry indefinitely, leading to high CPU usage. This change includes updates to the follow-up engine and database functions to reflect the new error handling. Additionally, tests have been added to ensure the new behavior is enforced and that the system no longer attempts retries for permanent errors.
This update integrates the enviarTextoFixoPendente function into the followup-flow-worker, ensuring that pending fixed text is drained to prevent messages from getting stuck in a pending state. Additionally, tests have been updated to verify the correct invocation of this function under various scenarios.
O follow-up ficava preso em waiting_reply porque so o cron diario de LGPD estava registrado. vercel.json na raiz agenda a mesma cadencia do scheduler, e o CRON_SECRET nativo deixa de tomar 403.
This update introduces a new function, alinharNomeAoTetoWaha, to ensure that session names conform to WAHA's maximum length requirement. The function generates a new session name if the current one exceeds the limit, preventing HTTP 400 errors during session creation. Additionally, tests have been added to validate the new naming constraints and ensure proper functionality across the application.
ruleName faltava nos fixtures do ActionCtx; push_subscriptions entrava
com policy ALL sem role_at_least; o extrator de vocabulario lia o type
alias sem literais; o FakeQuery do webhook nao tinha .in(); e o kick
local quebrava o 200 da captacao depois do lead gravado.
- Updated `inboundEhDestaPergunta` to utilize `enrollment.updated_at` for better message filtering.
- Modified `ultimoInboundDoContato` to return both message text and sent timestamp.
- Adjusted `aplicarTextoAosEnrollmentsEmEspera` to apply messages conditionally based on the new timestamp logic.
- Refactored tests to cover new behavior, ensuring proper handling of inbound messages without reusing old text.
- Improved test descriptions for clarity and added checks for message application logic.
- Deleted the `relogio.yml` GitHub Actions workflow file, which was responsible for scheduling HTTP requests to a specified application. This file is no longer needed as part of the project configuration.
- Enhanced the CRMSidePanel to display and edit custom fields for leads directly within the inbox conversation interface.
- Introduced a new InboxLeadEditor component to manage lead selection and custom field editing.
- Updated the CustomFieldsEditor to support dynamic class names and improved rendering of input fields based on lead data.
- Added functionality to save custom fields alongside lead updates, ensuring seamless integration with existing lead management processes.
- Implemented tests to validate the new functionality and ensure proper behavior of the custom fields editing feature.
- Added `actionTurnCompleted` function to determine if an action has been completed based on event history.
- Updated `processNode` to advance enrollment when an action has been completed, preventing unnecessary rechecks.
- Enhanced tests for `actionTurnCompleted` and `processNode` to validate new behavior and ensure correct handling of action states.
- Introduced `out.txt` to store application URLs for easier configuration.
/api/v1/system/relogio/tick authenticates with Bearer INTERNAL_SECRET
inside the route. Without a PUBLIC_PATHS entry the proxy returned 401
before the handler ran, so GitHub Actions could never advance follow-ups.
- Updated `relogio.yml` to clarify scheduling requirements and added concurrency settings for better job management.
- Introduced a new runbook `vercel-hobby-relogio.md` detailing setup instructions for external cron jobs and GitHub Actions.
- Enhanced `executarTickDoRelogio` to improve logging of follow-up advancements, ensuring better tracking of inbound responses.
- Added PowerShell and Bash scripts to facilitate the activation of the clock with necessary commands for GitHub Actions and cron-job.org.
- Implemented tests to validate the clock workflow and URL generation for external cron jobs, ensuring reliability in scheduled task execution.
- Renamed `aplicarTextoNosFollowups` to `aplicarTextoAosEnrollmentsEmEspera` for clarity and updated its parameters to improve functionality.
- Introduced a new test suite for `aplicarTextoNosFollowups`, ensuring proper application of text to follow-ups and validating the expected behavior.
- Enhanced existing tests to verify the integration of the new text application logic, improving overall test coverage and reliability.
- Updated the `matchNode` function to accept an optional `extra` parameter, allowing for dynamic configuration of `FlowNode` properties.
- Simplified test cases by utilizing the updated `matchNode` function to create nodes with specific configurations, improving code readability and maintainability.
- Adjusted related tests to ensure correct behavior with the new flexible node creation approach.
- Introduced a new workflow `relogio.yml` to handle scheduled HTTP requests every 5 minutes, allowing for external triggering of tasks.
- Added a new endpoint `POST /api/v1/system/relogio/tick` to process clock ticks, supporting both admin session and bearer token authentication.
- Implemented task execution logic in `executarTickDoRelogio`, enabling the processing of follow-up tasks and event log drainage without relying on cron jobs.
- Enhanced audit logging for clock tick actions to track task execution and outcomes.
- Created tests for the clock functionality to ensure reliability and correctness of scheduled task processing.
- Added a DELETE endpoint to remove followup flows, including associated enrollments and versions, ensuring proper cascading deletion.
- Introduced `DeleteFollowupFlowButton` component for UI integration, allowing users to delete flows from the interface.
- Updated `FlowsList` to include the delete button for each flow, enhancing user experience.
- Implemented necessary hooks and error handling for the deletion process, including success and error notifications.
- Enhanced audit logging to track deletion actions for followup flows.
- Added tests to verify the functionality of the DELETE endpoint and its integration in the UI.
- Updated `kickLocalPipeline` to accept an optional contact parameter, allowing for targeted processing of follow-ups for specific contacts.
- Modified `POST` request handling in `route.ts` to pass contact details to the pipeline, improving lead processing efficiency.
- Introduced `aplicarEfeitosPosEntrada` in the ingestion process to ensure follow-ups are correctly applied based on inbound messages, enhancing overall responsiveness.
- Enhanced unit tests to verify the new behavior and ensure proper handling of contact-specific follow-up actions.
A captação e o WhatsApp geravam dois contatos (grafias do nono dígito BR); o enrollment ficava waiting_reply no cadastro errado e o job de confirmação reenviava a pergunta. Casa gêmeos de telefone no inbound, não avança match_reply no sent, e canoniza o número na ingestão.
- Added `aplicarTextoNosFollowups` function to apply inbound text to active follow-ups for a contact.
- Updated `kick-local-pipeline.ts` to handle errors when applying inbound text and waking up follow-ups, improving robustness.
- Introduced unit tests for `textoDoPayloadInbound` to ensure correct extraction of text from inbound payloads.
- Registered `followupReactivityHandler` to process inbound messages and apply text to follow-ups, enhancing event handling.
- Updated `MatchReplyForm` to include an `ifExists` state, allowing users to specify behavior when a value already exists (skip, overwrite, or confirm).
- Enhanced the `commit` function to handle the new `ifExists` parameter, ensuring proper processing of match replies based on user input.
- Modified the `describeNodeConfig` function to reflect the new conditional logic in the match reply configuration.
- Updated the `matchReplyConfigSchema` to validate the new `if_exists` field, ensuring correct schema enforcement.
- Enhanced unit tests to cover new scenarios for handling existing values in match replies, improving overall reliability.
- Updated `acelerarPipelineDeEventos` to accept an optional inbound parameter, allowing for targeted follow-up wake-up based on specific message context.
- Introduced `acordarFollowupPorInbound` to handle follow-up events more efficiently, improving responsiveness during inbound lead processing.
- Enhanced unit tests to verify the correct invocation of event acceleration with the new parameters, ensuring proper follow-up behavior.
- Updated `tickFollowupAteParar` to return the number of claimed jobs, improving tracking of processed follow-ups.
- Introduced `enviarTextoFixoPendente` to handle sending fixed messages without relying on cron jobs or agent workers.
- Enhanced error handling in message sending to ensure jobs return to pending status on failure, improving reliability.
- Adjusted `acelerarPipelineDeEventos` to iterate through follow-up ticks and fixed message sending, optimizing event processing.
- Updated comments in `route.ts` to clarify the lead capture process and its implications in production environments.
- Modified `kickLocalPipeline` to ensure immediate processing of events in Vercel's Hobby plan, addressing the lack of a cron job.
- Adjusted `enroll.ts` to omit `next_eval_at` during enrollment, allowing the database's default behavior to manage timing.
- Enhanced unit tests to reflect changes in enrollment behavior and ensure proper handling of lead processing.
- Added `acelerarPipelineDeEventos` function to streamline event processing during inbound lead responses, improving responsiveness.
- Updated `kickLocalPipeline` to utilize the new event acceleration function.
- Enhanced `processNode` to allow early wake-up of wait nodes based on lead responses, ensuring timely follow-up actions.
- Added unit tests to verify the new behavior of wake-up conditions for wait nodes.
- Updated the type definition of the `query` function in the `fakePool` to return a more specific promise type, ensuring better type safety and clarity in unit tests.
- Added comments to clarify the behavior of SQL responses, enhancing the understanding of the test setup.
- Removed redundant code for resolving conversation and channel session IDs in the follow-up turn handler.
- Introduced a new `resolveSendTarget` function to encapsulate logic for determining the appropriate send target, improving code clarity and maintainability.
- Updated error handling to provide clearer messages when a contact cannot be resumed or when a channel is archived.
- Enhanced unit tests to cover new scenarios for handling contacts without conversations and ensuring proper follow-up flow.
- Removed duplicate imports in _client.tsx and LeadFieldsForm.tsx for improved code clarity.
- Updated playSound function to accept a volume parameter, allowing for customizable sound playback levels.
- Adjusted beep function to utilize the new volume parameter, enhancing audio control during notifications.
- Added tests for new volume functionality in sounds.test.ts to ensure reliability.
- Eliminated redundant logging fetch calls from various automation functions and webhook routes to streamline code and improve performance.
- Added a new trigger kind "case_opened" in TriggerConfigControl for better categorization of follow-up actions.
- Cleaned up imports in LeadFieldsForm and KanbanBoard components to remove duplicates and enhance readability.
- Introduced `VAPID_PUBLIC_KEY` and `VAPID_PRIVATE_KEY` to `.env.example` and `.env.hostgator.example` for enabling Web Push notifications.
- Updated `CHANGELOG.md` to document the addition of system alerts with the browser minimized.
- Enhanced `next.config.ts` to support Web Push by adding appropriate headers.
- Added a new script command `dev:crons` in `package.json` for local cron job development.
- Updated dependencies to include `web-push` and its types for TypeScript support.
- Created new design and specification documents for CRM automation flows, detailing the architecture and user stories for visual automation flows.
Permite enviar cartoes de contato pelo inbox (CRM ou telefone manual), com suporte WAHA e Meta Cloud, resolucao do wa_id via check-exists para o nono digito BR, e abertura da conversa ao tocar no cartao dentro do CRM.
Mensagens passam a carimbar contacts.last_activity_at via fn_mark_conversation_message (migration 0162) e envio pelo CRM. A lista /app/contacts ganha order_by/order_dir, cursor corrigido e UI com colunas ordenaveis e paginacao por backend.
O contador só subia em inbound e nunca zerava ao responder, inflando o badge (ex.: 6 com 1 mensagem pendente). Outbound passa a zerar unread, o envio CRM espelha isso, mark-read cobre leitura sem resposta, e a migration recalcula contadores stale.
Lista e detalhe do contato passam a trazer a conversa mais recente e oferecem link direto para o Inbox. O composer também limpa o campo na hora do envio, sem travar até a API responder.
Updated docker-compose files to include the WHATSAPP_RESTART_ALL_SESSIONS environment variable, set to "True" by default. This change ensures that stopped sessions are resumed automatically without requiring user intervention. Additionally, added unit tests to verify the behavior of session resumption logic in the session reconciler.