Skip to content

IAV-1045/feat(integrations): secondary credentials support + wizard workflow creation improvements

salaheddine zidani a demandé de fusionner feature/IAV-1045 vers develop

Overview

This MR introduces two major improvements to the agent integration system:

  1. Secondary Credentials Support — integrations that rely on more than one N8N credential type (e.g. WhatsApp requiring both WHATSAPP and WHATSAPP_BUSINESS) are now fully supported end-to-end.
  2. Wizard Workflow Creation Improvements — the workflow creation step is now more robust: auto-created (fake) integrations are handled separately from real ones, secondary credentials are provisioned automatically, and the response clearly distinguishes between user-configured and auto-generated integrations.

Changes in Detail

Secondary Credentials

Layer What changed
AgentIntegrationHelper Added SECONDARY_CREDENTIAL_TYPES map + getExpectedSecondaryTypes()
AgentIntegrationServiceImpl mapSecondaryCredentials() maps orchestration response → local entities; secondary credentials are now passed to local persistence
CustomerCareAgentIntegrationService Signature updated to accept List<CustomerCareSecondaryCredential>
CustomerCareAgentIntegrationServiceImpl Persists secondary credentials linked to the integration
CustomerCareSecondaryCredentialDTO New DTO exposed in integration response
Workflow injection Secondary credentials are now added to the integrationMap used by WorkflowCredentialInjector, ensuring all N8N node credential references are resolved

Wizard Workflow Creation

Area What changed
validateAndCollectIntegrations() Refactored to return IntegrationCollectionResult (real + auto-created lists separated)
createFakeIntegrationLocally() Now auto-creates secondary fake credentials for each expected secondary type
WizardCreateWorkflowForAgentResponse New autoCreatedIntegrations field added
Status update Only real (user-provided) integrations are updated with workflow status via orchestration service
Rollback Improved — now includes forceDeleteByAgentAndType() to remove partially persisted local integration records

Testing Checklist

  • WhatsApp integration creation provisions both WHATSAPP and WHATSAPP_BUSINESS credentials in N8N
  • Secondary credential IDs are stored in CustomerCareSecondaryCredential and returned in the response DTO
  • Workflow creation with a WhatsApp integration resolves all credential references in nodes
  • Auto-created (fake) integrations for non-configured channels include their secondary credentials
  • Rollback on integration creation failure cleans up both remote (orchestration) and local records
  • autoCreatedIntegrations list in workflow creation response is populated correctly
  • Existing integrations without secondary types are unaffected

Breaking Changes

  • CustomerCareAgentIntegrationService.createCustomerCareAgentIntegration() signature changed — any internal callers must be updated to pass the secondaryCredentials list (pass empty list if none).

Related Issues

Closes IAV-1044, IAV-1045

Rapports de requête de fusion