meta-cloud-api
Version:
TypeScript wrapper for Meta's Cloud API
50 lines (47 loc) • 1.89 kB
TypeScript
import { WhatsAppConfig } from '../../../types/config.js';
import { c as WebhookProcessor } from '../../../WebhookProcessor-BXYunz4N.js';
import '../../../enums-BZd9T2ul.js';
import '../../../common-lV0NsO7t.js';
import '../../../request-vYMaEfk5.js';
import '../../../WhatsApp-pTZPQm81.js';
import '../../../httpsClient-v4gmltzS.js';
import 'https';
import '../../../EncryptionApi-D7pt-OXT.js';
import '../../../base-CdGDdVEl.js';
import '../../../FlowApi-B2ffO-HD.js';
import '../../../MediaApi-BrEKpqi_.js';
import '../../../MessageApi-BgsSpDno.js';
import '../../../common-BiRA_uz3.js';
import '../../../PhoneNumberApi-DKlu9PHl.js';
import '../../../BusinessProfileApi-WXscSgo-.js';
import '../../../QrCodeApi-7vDwIBHR.js';
import '../../../RegistrationApi-qO_qoti9.js';
import '../../../TemplateApi-xGgIZt89.js';
import '../../../TwoStepVerificationApi-DfNPIz-C.js';
import '../../../WabaApi-DqQi_68m.js';
interface ExpressRequest {
method: string;
url: string;
headers: Record<string, string | string[] | undefined>;
body?: any;
query: Record<string, any>;
rawBody?: any;
}
interface ExpressResponse {
status(code: number): ExpressResponse;
json(data: any): ExpressResponse;
send(data?: any): ExpressResponse;
setHeader(name: string, value: string): void;
}
interface NextFunction {
(error?: any): void;
}
interface ExpressWebhookConfig extends WhatsAppConfig {
path?: string;
}
declare function webhookHandler(config: ExpressWebhookConfig): {
webhook: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse | undefined>;
flow: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse | undefined>;
processor: WebhookProcessor;
};
export { type ExpressRequest, type ExpressResponse, type ExpressWebhookConfig, type NextFunction, webhookHandler };