@brighthustle/adonisjs-whatsapp
Version:
Connect your WhatsApp Cloud API with AdonisJS
36 lines (35 loc) • 3.15 kB
TypeScript
/// <reference types="@adonisjs/drive/build/adonis-typings" />
/// <reference types="@adonisjs/events/build/adonis-typings" />
/// <reference types="@adonisjs/lucid" />
/// <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, GetMessageTemplatesQueryParams, InteractiveOptions, LocationOptions, MediaOptions, SectionOptions, TemplateCategory, TemplateComponent, TextOptions, WhatsAppCloudApiContract, WhatsAppConfig, WhatsAppResultContract, WhatsAppTemplateResultContract } from '@ioc:Adonis/Addons/WhatsApp';
import { DatabaseContract } from '@ioc:Adonis/Lucid/Database';
export declare class WhatsAppCloudApi implements WhatsAppCloudApiContract {
private config;
private drive;
private emitter;
private db;
private client;
constructor(config: WhatsAppConfig, drive: DriveManagerContract, emitter: EmitterContract, db: DatabaseContract);
sendText(to: number, text: string, options?: TextOptions, from?: number): Promise<WhatsAppResultContract>;
sendImage(to: number, media: string, options?: MediaOptions, from?: number): Promise<WhatsAppResultContract>;
sendDocument(to: number, media: string, options?: DocumentOptions, from?: number): Promise<WhatsAppResultContract>;
sendAudio(to: number, media: string, from?: number): Promise<WhatsAppResultContract>;
sendVideo(to: number, media: string, options?: MediaOptions, from?: number): Promise<WhatsAppResultContract>;
sendSticker(to: number, media: string, from?: number): Promise<WhatsAppResultContract>;
sendLocation(to: number, coordinate: CoordinateOptions, options?: LocationOptions, from?: number): Promise<WhatsAppResultContract>;
sendTemplate(to: number, template: string, language: string, components?: ComponentOptions[], from?: number): Promise<WhatsAppResultContract>;
sendContact(to: number, contacts: ContactOptions[], from?: number): Promise<WhatsAppResultContract>;
sendButtons(to: number, text: string, buttons: ButtonsOptions, options?: InteractiveOptions, from?: number): Promise<WhatsAppResultContract>;
sendList(to: number, text: string, button: string, sections: SectionOptions[], options?: InteractiveOptions, from?: number): Promise<WhatsAppResultContract>;
markAsRead(wamid: string): Promise<boolean>;
on(event: string, handler: (message: any) => void): void;
uploadMedia(source: string | MultipartFileContract, from?: number): Promise<string | false>;
downloadMedia(media: string, options?: DownloadOptions, from?: number): Promise<string | false>;
createTemplate(category: TemplateCategory, name: string, language: string, components: TemplateComponent[], from?: number): Promise<WhatsAppTemplateResultContract>;
getTemplates(options?: GetMessageTemplatesQueryParams, from?: number): Promise<any>;
deleteTemplate(name: string, from?: number): Promise<any>;
}