export interface EsmsCredentials { apiKey: string; secretKey: string; } export interface EsmsConfig { apiKey: string; secretKey: string; baseUrl?: string; statusBaseUrl?: string; voiceBaseUrl?: string; timeoutMs?: number; } export type SmsType = 1 | 2 | 8 | 23 | 24; export interface SendSmsRequest { Phone: string; Content: string; Brandname?: string; SmsType: '1' | '2' | '8' | '23'; IsUnicode?: '0' | '1'; campaignid?: string; RequestId?: string; CallbackUrl?: string; Sandbox?: '0' | '1'; SendDate?: string; OAID?: string; TempID?: string; TempData?: Record; SendingMode?: '1' | '2'; Phones?: string[]; } export interface SendFixedPriceSmsRequest { Phone: string; Content: string; Brandname?: string; SmsType: '8'; Unicode?: '0' | '1'; campaignid?: string; RequestId?: string; CallbackUrl?: string; Sandbox?: '0' | '1'; SendDate?: string; } export interface SendSmsV4Response { CodeResult: string; CountRegenerate: number; SMSID: string; ErrorMessage?: string; } export interface SendBrandnameSmsRequest { Brandname: string; Content: string; Phones: string[]; SmsType?: '1'; RequestId?: string; SendDate?: string; Sandbox?: '0' | '1'; campaignid?: string; } export interface MultiChannelMessageItem { TempID?: string; Params?: string[]; OAID?: string; campaignid?: string; CallbackUrl?: string; RequestId?: string; Sandbox?: '0' | '1'; Content?: string; IsUnicode?: '0' | '1'; SmsType?: '2' | '8' | '1'; Brandname?: string; } export interface MultiChannelRequest { Phone: string; Channels: Array<'zalo' | 'sms' | 'viber'>; Data: MultiChannelMessageItem[]; } export interface EsmsBaseResponse { CodeResponse: string; ErrorMessage?: string; } export interface BalanceResponse extends EsmsBaseResponse { Balance: number; UserID: number; } export interface SmsSendResponse extends EsmsBaseResponse { SMSID: string; TotalSMS: number; TotalPrice: number; InvalidPhone?: string[]; } export interface BrandnameResponse { Brandname: string; Type: number; } export interface GetListBrandnameResponse extends EsmsBaseResponse { ListBrandName: BrandnameResponse[]; } export interface SmsSendStatusResponse extends EsmsBaseResponse { SMSID: string; SendFailed: number; SendStatus: number; SendSuccess: number; TotalPrice: number; TotalReceiver: number; TotalSent: number; } export interface SmsReceiverItem { IsSent: boolean; NetworkName: string; Phone: string; Retry: number; SentResult: boolean; } export interface SmsReceiverStatusResponse { CodeResult: string; ReceiverList: SmsReceiverItem[]; } export interface ZaloSendResponse extends EsmsBaseResponse { SMSID: string; Phone: string; TotalPrice: number; } export interface ZaloOAResponse { OAID: string; OAName: string; } export interface GetListZOAResponse { CodeResult: string; ErrorMessage: string; ZOAList: ZaloOAResponse[]; } export interface ZaloQuotaResponse extends EsmsBaseResponse { OAID: string; Quota: number; Used: number; Remaining: number; } export interface ZaloRatingResponse extends EsmsBaseResponse { OAID: string; Rating: string; QualityRating: string; } export interface ZaloFollowerResponse extends EsmsBaseResponse { OAID: string; TotalFollower: number; Data: Array<{ UserId: string; UserName: string; Avatar?: string; FollowTime: string; }>; } export interface VoiceCallResponse extends EsmsBaseResponse { CallId: string; Phone: string; Status: string; Duration?: number; Cost?: number; } export interface MultiChannelResponse extends EsmsBaseResponse { Results: Array<{ Channel: 'zalo' | 'sms' | 'viber'; Status: string; SMSID?: string; ErrorMessage?: string; }>; } export interface GetSmsSentDataRequest { SmsType?: '1' | '2' | '8' | '23' | '24' | '25'; From: string; To: string; Page?: number; PageSize?: number; } export interface SmsSentDataItem { Campaign: string; Content: string; Phone: string; ReferenceId: string; SellPrice: number; SendResult: number; SendStatus: number; SentTime: string; SmsId: number; SmsType: number; } export interface GetSmsSentDataResponse { CodeResult: string; CountTotal: number; SentData: SmsSentDataItem[]; } export interface GetTemplateRequest { SmsType: '2'; Brandname: string; } export interface BrandnameTemplate { NetworkID: number; TempContent: string; TempId: number; } export interface GetTemplateResponse { BrandnameTemplates: BrandnameTemplate[]; CodeResult: string; ErrorMessage: string; } export interface GetZaloTemplateRequest { OAId: string; SmsType: '24' | '25'; } export interface ZNSTempDetail { Limit: number; Param: string; ParamLevel: number; RequireType: string; } export interface ZNSTemplate { TempContent: string; TempId: number; TempName: string; ZNSTempDetail: ZNSTempDetail[]; } export interface GetZaloTemplateResponse { CodeResult: string; ErrorMessage: string; ZNSTemplates: ZNSTemplate[]; } export interface SummaryMultipleMessageV4Request { Phone: string; Content: string; SmsType?: '2' | '8'; BrandName?: string; IsUnicode?: '0' | '1'; } export interface SummaryMultipleMessageV4Response { CodeResult: string; ErrorMessage: string; TotalPrice: number; TotalReceiver: number; } export interface SummaryMultipleSMSBrandnameRequest { Content: string; SmsType?: '1'; Brandname: string; Phones: string[]; } export interface SummaryMultipleSMSBrandnameResponse { CodeResult: string; ErrorMessage: string; TotalPrice: number; TotalReceiver: number; } export interface RegisterSmsTemplateRequest { Content: string; AssetsUrl: string; Brandname: string; IsUnicode: '0' | '1'; CustomerEmail: string; CustomerName: string; CustomerPhone: string; ServiceType: 2; SmsType: 2 | 8; CallbackUrl: string; } export interface RegisterSmsTemplateResponse { CodeResult: string; ErrorMessage: string; ServicePreviewId: number; } export interface QueryListUidRequest { OAID: string; Offset?: number; Count?: number; FromDate?: string; ToDate?: string; IsFollower?: string; TagName?: string; }