whatsapp-business-api
Version:
A Wrapper for Whatsapp Business Cloud API hosted by Meta.
78 lines (77 loc) • 1.78 kB
TypeScript
import { MessageTypes } from './constants';
export declare type OutgoingTextPayload = {
preview_url: boolean;
body: string;
};
export declare type OutgoingMediaPayload = {
id?: string;
link?: string;
caption?: string;
filename?: string;
};
export declare type ApiRequestPayload = {
messaging_product: string;
recipient_type: string;
to: string;
type: MessageTypes;
text?: OutgoingTextPayload;
image?: OutgoingMediaPayload;
};
export declare type ApiRequestHeader = {
Authorization: string;
};
declare type WebhookContact = {
profile: {
name: string;
};
wa_id: string;
};
declare type WebhookError = {};
declare type WebhookMessage = {
audio?: object;
button?: object;
context?: object;
document?: object;
errors?: object[];
from: string;
id: string;
identity?: object;
image?: object;
interactive?: object;
referral?: object;
sticker?: object;
system?: object;
text?: {
body: string;
};
timestamp: string;
type: MessageTypes;
video?: object;
};
declare type WebhookStatuses = {};
declare type WebhookChange = {
value: {
messaging_product: string;
metadata: {
display_phone_number: string;
phone_number_id: string;
};
contacts: WebhookContact[];
errors: WebhookError[] | undefined;
messages: WebhookMessage[];
statuses: WebhookStatuses[] | undefined;
};
field: string;
};
declare type WebhookEntry = {
id: string;
changes: WebhookChange[];
};
export interface WebhookRequestPayload {
object: string;
entry: WebhookEntry[];
}
export declare type IncomingMessage = WebhookMessage & {
contact: WebhookContact;
};
export {};