UNPKG

tyntec-sdk

Version:

TypeScript SDK for Tyntec Conversations API V3

81 lines (80 loc) 3.51 kB
import { RequestHttp, TyntecConfig } from './types'; import { Message, TemplateComponents } from '../models'; export interface MessageApi { /** * Sends a message to the Tyntec API * @param message - The message to send * @returns The response data from the API */ sendMessage: (message: Message) => Promise<any>; /** * Sends a text message to the Tyntec API * @param from - The sender of the message * @param to - The recipient of the message * @param text - The text of the message * @returns The response data from the API */ sendTextMessage: (from: string, to: string, text: string) => Promise<any>; /** * Sends an image message to the Tyntec API * @param from - The sender of the message * @param to - The recipient of the message * @param url - The URL of the image * @param caption - The caption of the image * @returns The response data from the API */ sendImageMessage: (from: string, to: string, url: string, caption?: string) => Promise<any>; /** * Sends a video message to the Tyntec API * @param from - The sender of the message * @param to - The recipient of the message * @param url - The URL of the video * @param caption - The caption of the video * @returns The response data from the API */ sendVideoMessage: (from: string, to: string, url: string, caption?: string) => Promise<any>; /** * Sends a document message to the Tyntec API * @param from - The sender of the message * @param to - The recipient of the message * @param url - The URL of the document * @param caption - The caption of the document * @param filename - The filename of the document * @returns The response data from the API */ sendDocumentMessage: (from: string, to: string, url: string, caption?: string, filename?: string) => Promise<any>; /** * Sends an audio message to the Tyntec API * @param from - The sender of the message * @param to - The recipient of the message * @param url - The URL of the audio * @returns The response data from the API */ sendAudioMessage: (from: string, to: string, url: string) => Promise<any>; /** * Sends a sticker message to the Tyntec API * @param from - The sender of the message * @param to - The recipient of the message * @param url - The URL of the sticker * @returns The response data from the API */ sendStickerMessage: (from: string, to: string, url: string) => Promise<any>; /** * Sends a template message to the Tyntec API * @param from - The sender of the message * @param to - The recipient of the message * @param templateId - The ID of the template * @param templateLanguage - The language of the template * @param bodyComponents - The body components of the template * @param buttonComponents - The button components of the template * @returns The response data from the API */ sendTemplateMessage: (from: string, to: string, templateId: string, templateLanguage: string, components: TemplateComponents) => Promise<any>; /** * Sends a WhatsApp message to the Tyntec API * @param message - The message to send * @returns The response data from the API */ sendWhatsAppMessage: (message: Message) => Promise<any>; } export declare function createMessageApi(requestHttp: RequestHttp, cfg: TyntecConfig): MessageApi;