adonisjs-whatsapp
Version:
Connect your WhatsApp Cloud API with AdonisJS
30 lines (29 loc) • 2.38 kB
TypeScript
/// <reference types="@adonisjs/drive/build/adonis-typings" />
/// <reference types="@adonisjs/events/build/adonis-typings" />
/// <reference types="@adonisjs/bodyparser/build/adonis-typings" />
import { EmitterContract } from '@ioc:Adonis/Core/Event';
import { DriveManagerContract } from '@ioc:Adonis/Core/Drive';
import { MultipartFileContract } from '@ioc:Adonis/Core/BodyParser';
import { ButtonsOptions, ComponentOptions, ContactOptions, CoordinateOptions, DocumentOptions, DownloadOptions, InteractiveOptions, LocationOptions, MediaOptions, SectionOptions, TextOptions, WhatsAppCloudApiContract, WhatsAppConfig, WhatsAppResultContract } from '@ioc:Adonis/Addons/WhatsApp';
export declare class WhatsAppCloudApi implements WhatsAppCloudApiContract {
private config;
private drive;
private emitter;
private client;
constructor(config: WhatsAppConfig, drive: DriveManagerContract, emitter: EmitterContract);
sendText(to: number, text: string, options?: TextOptions): Promise<WhatsAppResultContract>;
sendImage(to: number, media: string, options?: MediaOptions): Promise<WhatsAppResultContract>;
sendDocument(to: number, media: string, options?: DocumentOptions): Promise<WhatsAppResultContract>;
sendAudio(to: number, media: string): Promise<WhatsAppResultContract>;
sendVideo(to: number, media: string, options?: MediaOptions): Promise<WhatsAppResultContract>;
sendSticker(to: number, media: string): Promise<WhatsAppResultContract>;
sendLocation(to: number, coordinate: CoordinateOptions, options?: LocationOptions): Promise<WhatsAppResultContract>;
sendTemplate(to: number, template: string, language: string, components?: ComponentOptions[]): Promise<WhatsAppResultContract>;
sendContact(to: number, contacts: ContactOptions[]): Promise<WhatsAppResultContract>;
sendButtons(to: number, text: string, buttons: ButtonsOptions, options?: InteractiveOptions): Promise<WhatsAppResultContract>;
sendList(to: number, text: string, button: string, sections: SectionOptions[], options?: InteractiveOptions): Promise<WhatsAppResultContract>;
markAsRead(wamid: string): Promise<boolean>;
on(event: string, handler: (message: any) => void): void;
uploadMedia(source: string | MultipartFileContract): Promise<string | false>;
downloadMedia(media: string, options?: DownloadOptions): Promise<string | false>;
}