@warriorteam/redai-zalo-sdk
Version:
Comprehensive TypeScript/JavaScript SDK for Zalo APIs - Official Account v3.0, ZNS with Full Type Safety, Consultation Service, Broadcast Service, Group Messaging with List APIs, Social APIs, Enhanced Article Management, Promotion Service v3.0 with Multip
331 lines • 8.54 kB
TypeScript
/**
* Broadcast Message Type Definitions for Zalo OA
* API: https://openapi.zalo.me/v2.0/oa/message
*/
/**
* Broadcast recipient target criteria
*/
export interface BroadcastTarget {
/**
* Danh sách các nhóm tuổi sẽ nhận thông báo. Các giá trị phân tách nhau bởi dấu ","
* 0: Tuổi từ 0-12
* 1: Tuổi từ 13-17
* 2: Tuổi từ 18-24
* 3: Tuổi từ 25-34
* 4: Tuổi từ 35-44
* 5: Tuổi từ 45-54
* 6: Tuổi từ 55-64
* 7: Tuổi lớn hơn hay bằng 65
*/
ages?: string;
/**
* Danh sách nhóm giới tính sẽ nhận thông báo. Các giá trị phân tách nhau bởi dấu ","
* 0: Tất cả các giới tính
* 1: Nam
* 2: Nữ
*/
gender?: string;
/**
* Danh sách các địa điểm sẽ nhận thông báo. Các giá trị phân tách nhau bởi dấu ","
* 0: Miền Bắc Việt Nam
* 1: Miền Trung Việt Nam
* 2: Miền Nam Việt Nam
*/
locations?: string;
/**
* Danh sách các tỉnh, thành phố sẽ nhận thông báo. Các giá trị phân tách nhau bởi dấu ","
* Nếu được thiết lập, thuộc tính này sẽ thay thế thuộc tính "locations"
*/
cities?: string;
/**
* Danh sách các hệ điều hành di động sẽ nhận thông báo. Các giá trị phân tách nhau bởi dấu ","
* 1: IOS
* 2: Android
* 3: Window Phone
*/
platform?: string;
}
/**
* Broadcast recipient
*/
export interface BroadcastRecipient {
target: BroadcastTarget;
}
/**
* Broadcast message attachment payload element
*/
export interface BroadcastMessageElement {
/**
* Loại media - bắt buộc phải là "article"
*/
media_type: "article";
/**
* ID của bài viết muốn broadcast
*/
attachment_id: string;
}
/**
* Broadcast message attachment payload
*/
export interface BroadcastMessagePayload {
/**
* Loại template - bắt buộc phải là "media"
*/
template_type: "media";
/**
* Chứa các đối tượng của template
*/
elements: BroadcastMessageElement[];
}
/**
* Broadcast message attachment
*/
export interface BroadcastMessageAttachment {
/**
* Loại attachment - bắt buộc phải là "template"
*/
type: "template";
/**
* Chứa payload của attachment muốn gửi
*/
payload: BroadcastMessagePayload;
}
/**
* Broadcast message
*/
export interface BroadcastMessage {
attachment: BroadcastMessageAttachment;
}
/**
* Broadcast request
*/
export interface BroadcastRequest {
/**
* Thông tin người nhận
*/
recipient: BroadcastRecipient;
/**
* Nội dung và các attachment cần gửi
*/
message: BroadcastMessage;
}
/**
* Broadcast response data
*/
export interface BroadcastResponseData {
/**
* ID của tin broadcast
*/
message_id: string;
}
/**
* Broadcast response
*/
export interface BroadcastResponse {
/**
* Dữ liệu phản hồi
*/
data: BroadcastResponseData;
/**
* Mã lỗi (0 = thành công)
*/
error: number;
/**
* Thông báo
*/
message: string;
}
/**
* City codes mapping for broadcast targeting
*/
export declare const BROADCAST_CITY_CODES: {
readonly "\u0110\u1ED3ng Th\u00E1p": "0";
readonly "B\u00ECnh Ph\u01B0\u1EDBc": "1";
readonly "Ninh B\u00ECnh": "2";
readonly "B\u1EA1c Li\u00EAu": "3";
readonly "H\u1ED3 Ch\u00ED Minh": "4";
readonly "V\u0129nh Long": "5";
readonly "L\u00E2m \u0110\u1ED3ng": "6";
readonly "Y\u00EAn B\u00E1i": "7";
readonly "H\u00E0 Nam": "8";
readonly "H\u00E0 N\u1ED9i": "9";
readonly "H\u1EA3i D\u01B0\u01A1ng": "10";
readonly "H\u1EADu Giang": "11";
readonly "An Giang": "12";
readonly "Tr\u00E0 Vinh": "13";
readonly "Ti\u1EC1n Giang": "14";
readonly "T\u00E2y Ninh": "15";
readonly "\u0110\u1ED3ng Nai": "16";
readonly "\u0110\u1EAFk L\u1EAFk": "17";
readonly "B\u00ECnh \u0110\u1ECBnh": "18";
readonly "Kon Tum": "19";
readonly "\u0110\u00E0 N\u1EB5ng": "20";
readonly "B\u1EAFc Giang": "21";
readonly "B\u1EAFc K\u1EA1n": "22";
readonly "\u0110i\u1EC7n Bi\u00EAn": "23";
readonly "H\u00F2a B\u00ECnh": "24";
readonly "Th\u00E1i B\u00ECnh": "25";
readonly "V\u0129nh Ph\u00FAc": "26";
readonly "H\u00E0 Giang": "27";
readonly "Ki\u00EAn Giang": "28";
readonly "B\u00ECnh D\u01B0\u01A1ng": "29";
readonly "B\u00ECnh Thu\u1EADn": "30";
readonly "\u0110\u1EAFk N\u00F4ng": "31";
readonly "Kh\u00E1nh H\u00F2a": "32";
readonly "Gia Lai": "33";
readonly "Qu\u1EA3ng Nam": "34";
readonly "Qu\u1EA3ng Tr\u1ECB": "35";
readonly "H\u00E0 T\u0129nh": "36";
readonly "H\u01B0ng Y\u00EAn": "37";
readonly "Qu\u1EA3ng Ninh": "38";
readonly "Thanh H\u00F3a": "39";
readonly "Ph\u00FA Th\u1ECD": "40";
readonly "Lai Ch\u00E2u": "41";
readonly "Th\u00E1i Nguy\u00EAn": "42";
readonly "Cao B\u1EB1ng": "43";
readonly "C\u00E0 Mau": "44";
readonly "C\u1EA7n Th\u01A1": "45";
readonly "S\u00F3c Tr\u0103ng": "46";
readonly "B\u1EBFn Tre": "47";
readonly "Long An": "48";
readonly "B\u00E0 R\u1ECBa V\u0169ng T\u00E0u": "49";
readonly "Ninh Thu\u1EADn": "50";
readonly "Ph\u00FA Y\u00EAn": "51";
readonly "Qu\u00E3ng Ng\u00E3i": "52";
readonly "Th\u1EEBa Thi\u00EAn Hu\u1EBF": "53";
readonly "Qu\u1EA3ng B\u00ECnh": "54";
readonly "Ngh\u1EC7 An": "55";
readonly "Nam \u0110\u1ECBnh": "56";
readonly "H\u1EA3i Ph\u00F2ng": "57";
readonly "L\u1EA1ng S\u01A1n": "58";
readonly "L\u00E0o Cai": "59";
readonly "S\u01A1n La": "60";
readonly "B\u1EAFc Ninh": "61";
readonly "Tuy\u00EAn Quang": "62";
readonly "Kh\u00F4ng Thu\u1ED9c Vi\u1EC7t Nam": "63";
};
/**
* Age group codes for broadcast targeting
*/
export declare const BROADCAST_AGE_CODES: {
readonly "0-12": "0";
readonly "13-17": "1";
readonly "18-24": "2";
readonly "25-34": "3";
readonly "35-44": "4";
readonly "45-54": "5";
readonly "55-64": "6";
readonly "65+": "7";
};
/**
* Gender codes for broadcast targeting
*/
export declare const BROADCAST_GENDER_CODES: {
readonly ALL: "0";
readonly MALE: "1";
readonly FEMALE: "2";
};
/**
* Location codes for broadcast targeting
*/
export declare const BROADCAST_LOCATION_CODES: {
readonly NORTH: "0";
readonly CENTRAL: "1";
readonly SOUTH: "2";
};
/**
* Platform codes for broadcast targeting
*/
export declare const BROADCAST_PLATFORM_CODES: {
readonly IOS: "1";
readonly ANDROID: "2";
readonly WINDOWS_PHONE: "3";
};
/**
* Result for individual broadcast message
*/
export interface BroadcastMessageResult {
/**
* Article attachment ID
*/
attachmentId: string;
/**
* Whether the broadcast was successful
*/
success: boolean;
/**
* Message ID if successful
*/
messageId: string | null;
/**
* Error if failed
*/
error: Error | null;
/**
* Timestamp when sent
*/
sentAt: Date;
}
/**
* Progress information for multiple broadcast
*/
export interface MultipleBroadcastProgress {
/**
* Total number of messages to send
*/
total: number;
/**
* Number of messages completed
*/
completed: number;
/**
* Number of successful messages
*/
successful: number;
/**
* Number of failed messages
*/
failed: number;
/**
* Current attachment ID being processed
*/
currentAttachmentId: string;
/**
* Whether all messages are completed
*/
isCompleted: boolean;
}
/**
* Result for multiple broadcast messages
*/
export interface MultipleBroadcastResult {
/**
* Total number of messages sent
*/
totalMessages: number;
/**
* Number of successful messages
*/
successfulMessages: number;
/**
* Number of failed messages
*/
failedMessages: number;
/**
* Individual message results
*/
results: BroadcastMessageResult[];
/**
* Total duration in milliseconds
*/
totalDuration: number;
/**
* Sending mode used
*/
mode: 'parallel' | 'sequential';
/**
* Target criteria used
*/
targetCriteria: BroadcastTarget;
}
//# sourceMappingURL=broadcast.d.ts.map