IAV-1045/feat(integrations): secondary credentials support + wizard workflow creation improvements
Overview
This MR introduces two major improvements to the agent integration system:
-
Secondary Credentials Support — integrations that rely on more than one N8N credential type (e.g. WhatsApp requiring both
WHATSAPPandWHATSAPP_BUSINESS) are now fully supported end-to-end. - 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 WHATSAPPandWHATSAPP_BUSINESScredentials in N8N -
Secondary credential IDs are stored in CustomerCareSecondaryCredentialand 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 -
autoCreatedIntegrationslist 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 thesecondaryCredentialslist (pass empty list if none).