IAV-1243/feat(integrations): Add expiresAt for WhatsApp/Instagram and validate existing platform IDs across IAVIA channels
Summary
Improves the createIntegration method with token expiration tracking for
WhatsApp and Instagram channels, and adds a pre-creation check for duplicate
platform IDs across all IAVIA channel integrations.
Changes
createIntegration — token expiration support
- Added
expiresAtfield handling for WhatsApp and Instagram integrations - Token expiry is now stored and can be used to trigger refresh flows or surface warnings before credentials become invalid
IAVIA channels — duplicate platform ID check
- Added a guard that verifies whether a platform ID already exists before attempting to create a new integration across all IAVIA channel types
- Returns a clear error (or early exit) when a duplicate is detected, preventing silent overwrites or duplicate records
Testing
-
createIntegrationstoresexpiresAtcorrectly for WhatsApp -
createIntegrationstoresexpiresAtcorrectly for Instagram -
Attempting to create a duplicate platform ID on any IAVIA channel returns the expected error -
Existing integrations are not affected by the new validation