mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-05-18 20:08:19 +00:00
feat: WhatsApp AI assistant — provider-agnostic messaging with Gupshup
Provider-agnostic WhatsApp integration for AI-driven appointment booking: - MessagingProvider interface (sendText, sendButtons, sendList, parseInbound) - GupshupProvider implementation (Gupshup WhatsApp API) - MessagingService — AI orchestration with tools (department/doctor/slot lists via interactive WhatsApp messages, appointment booking, caller resolution + context injection) - Redis conversation history (24h TTL, matches WhatsApp session window) - Webhook controller at POST /api/messaging/webhook Swappable to Ozonetel or Meta Cloud API by implementing MessagingProvider and switching MESSAGING_PROVIDER env var. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
18
src/messaging/providers/messaging-provider.interface.ts
Normal file
18
src/messaging/providers/messaging-provider.interface.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { NormalizedMessage, InteractiveButton, ListSection } from '../types';
|
||||
|
||||
export abstract class MessagingProvider {
|
||||
/** Parse raw webhook payload into normalized message */
|
||||
abstract parseInbound(body: any): NormalizedMessage | null;
|
||||
|
||||
/** Send a plain text message */
|
||||
abstract sendText(to: string, text: string): Promise<void>;
|
||||
|
||||
/** Send interactive buttons (max 3 for WhatsApp) */
|
||||
abstract sendButtons(to: string, body: string, buttons: InteractiveButton[]): Promise<void>;
|
||||
|
||||
/** Send interactive list (max 10 rows total across sections) */
|
||||
abstract sendList(to: string, body: string, buttonText: string, sections: ListSection[]): Promise<void>;
|
||||
|
||||
/** Validate that inbound webhook is authentic */
|
||||
abstract validateWebhook(body: any): boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user