feat(integrations): align app hook payloads

This commit is contained in:
2026-06-06 06:46:36 +08:00
parent 02ea135e0c
commit d241925b6a
12 changed files with 504 additions and 132 deletions
@@ -0,0 +1,7 @@
DROP INDEX IF EXISTS idx_integration_hooks_app_id;
DELETE FROM integration_apps WHERE hook_type IN ('dashboard_apps', 'openai', 'dialogflow', 'google_translate', 'dyte', 'leadsquared');
ALTER TABLE integration_hooks
DROP COLUMN IF EXISTS reference_id,
DROP COLUMN IF EXISTS app_id;
@@ -0,0 +1,24 @@
ALTER TABLE integration_hooks
ADD COLUMN IF NOT EXISTS app_id VARCHAR(100),
ADD COLUMN IF NOT EXISTS reference_id VARCHAR(255);
UPDATE integration_hooks
SET app_id = hook_type
WHERE app_id IS NULL OR app_id = '';
CREATE INDEX IF NOT EXISTS idx_integration_hooks_app_id ON integration_hooks(app_id) WHERE deleted_at IS NULL;
INSERT INTO integration_apps (name, description, hook_type, icon, action_url, enabled) VALUES
('Dashboard Apps', 'Embed custom dashboard apps in the conversation sidebar', 'dashboard_apps', '/assets/integrations/dashboard_apps.svg', '', TRUE),
('OpenAI', 'Connect OpenAI for label suggestions and AI-assisted workflows', 'openai', '/assets/integrations/openai.svg', '/openai', TRUE),
('Dialogflow', 'Connect Dialogflow agents to inboxes', 'dialogflow', '/assets/integrations/dialogflow.svg', '/dialogflow', TRUE),
('Google Translate', 'Connect Google Translate for message translation', 'google_translate', '/assets/integrations/google-translate.svg', '/google_translate', TRUE),
('Dyte', 'Connect Dyte for video meetings', 'dyte', '/assets/integrations/dyte.svg', '/dyte', TRUE),
('LeadSquared', 'Connect LeadSquared CRM activity sync', 'leadsquared', '/assets/integrations/leadsquared.svg', '/leadsquared', TRUE)
ON CONFLICT (hook_type) DO UPDATE SET
name = EXCLUDED.name,
description = EXCLUDED.description,
icon = EXCLUDED.icon,
action_url = EXCLUDED.action_url,
enabled = EXCLUDED.enabled,
updated_at = NOW();