whatsapp-business-api
Version:
A Wrapper for Whatsapp Business Cloud API hosted by Meta.
38 lines (37 loc) • 1.13 kB
TypeScript
import express from 'express';
import { IncomingMessage, WebhookRequestPayload } from './types';
declare class WhatsappAPI {
private accountPhoneNumberId;
private accessToken;
private expressApp?;
private fbAppSecret?;
private webhookRouter?;
private webhookPort?;
private webhookVerifyToken?;
constructor(options: {
accountPhoneNumberId: string;
accessToken: string;
webhook?: {
expressApp?: express.Application;
port?: number;
fbAppSecret: string;
verifyToken: string;
};
});
initWebhook(callback: Function): void;
parseIncomingMessage(payload: WebhookRequestPayload): IncomingMessage[];
private sendRequest;
private extractMediaType;
private uploadMedia;
sendTextMessage(to: string, options: {
message: string;
preview_url?: boolean;
}): Promise<any>;
sendMediaMessage(to: string, options: {
external_link?: string;
local_path?: string;
caption?: string;
filename?: string;
}): Promise<any>;
}
export default WhatsappAPI;