/** * WhatsAppShuttle — the WhatsApp (Cloud API) channel, on the base (SH5). * * The agent is a WhatsApp Business NUMBER: a business points its Meta webhook at * `handleInbound`, and every customer who texts the number talks to the agent, * one thread per number. Reply goes out via the Cloud REST API. The webhook GET * verification handshake is handled by `verifyChallenge`. */ import type { ThreadMap } from '../types.js'; import type { DeliveryPolicy, DeliveryResult } from '../delivery.js'; import type { LinePolicy } from '../gate.js'; import type { PairingStore } from '../pairing.js'; import type { GatewayClient } from '../gateway-client.js'; import { type WhatsAppSendObserver } from './transport.js'; import { type WhatsAppWebhookBody } from './message.js'; export interface WhatsAppShuttleOptions { readonly accessToken: string; readonly phoneNumberId: string; readonly profileId: string; readonly gateway: GatewayClient; readonly threads?: ThreadMap; readonly delivery?: DeliveryPolicy; readonly line?: LinePolicy; readonly pairing?: PairingStore; /** Meta app secret — enables `X-Hub-Signature-256` verification. */ readonly appSecret?: string; /** Coalesce rapid messages per person. */ readonly debounce?: { readonly ms: number; readonly maxWaitMs?: number; }; readonly fetch?: typeof fetch; readonly baseUrl?: string; readonly apiVersion?: string; } export interface WhatsAppInboundOptions { /** Raw request body (needed for signature verification). */ readonly rawBody?: string; /** The `X-Hub-Signature-256` header. */ readonly signature?: string; /** Durable provider-effect observer used by ChannelWebhookHost. */ readonly sendObserver?: WhatsAppSendObserver; /** UUID derived from this webhook's WAMID. Valid only for one text message. */ readonly runIdempotencyKey?: string; /** Frozen Gateway thread input stored with this inbound WAMID. */ readonly gatewayThreadId?: string | null; } export declare class WhatsAppShuttle { private readonly adapter; private readonly appSecret; private readonly transport; constructor(opts: WhatsAppShuttleOptions); /** * Handle one inbound webhook (a Meta POST — may carry multiple messages). * Pass `rawBody`+`signature` to verify the request came from Meta. */ handleInbound(body: WhatsAppWebhookBody, opts?: WhatsAppInboundOptions): Promise; /** Send channel-owned protocol text (for example a handoff acknowledgement). */ sendText(target: string, text: string, observer?: WhatsAppSendObserver): Promise; /** GET webhook verification handshake — echo the challenge when the token matches. */ verifyChallenge(params: { 'hub.mode'?: string; 'hub.verify_token'?: string; 'hub.challenge'?: string; }, verifyToken: string): string | null; } //# sourceMappingURL=shuttle.d.ts.map