UNPKG

@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

280 lines 7.96 kB
/** * User Management Type Definitions for Zalo OA */ export interface UserProfile { error: number; message: string; data?: { user_id: string; user_id_by_app: string; display_name: string; user_alias?: string; user_is_follower: boolean; avatar?: string; avatars?: { '120': string; '240': string; }; user_gender?: 'male' | 'female'; user_locale?: string; shared_info?: { address?: string; phone?: string; name?: string; district?: string; province?: string; ward?: string; }; tags_and_notes_info?: { tag_names?: string[]; notes?: string; }; is_sensitive?: boolean; last_interaction_date?: string; user_last_interaction_date?: string; }; } export interface UserList { error: number; message: string; data?: { followers: Array<{ user_id: string; user_id_by_app?: string; display_name: string; avatar?: string; user_is_follower: boolean; user_last_interaction_date?: string; }>; total: number; }; } export interface UserTag { tag_id?: string; tag_name: string; tag_color?: string; created_time?: string; user_count?: number; } export interface UserTagList { error: number; message: string; data?: { tags: UserTag[]; total: number; }; } export interface UserNote { note_id: string; note_content: string; created_time: string; created_by?: string; updated_time?: string; updated_by?: string; } export interface UserInteraction { interaction_id: string; interaction_type: 'MESSAGE_SENT' | 'MESSAGE_RECEIVED' | 'FOLLOW' | 'UNFOLLOW' | 'BLOCK' | 'UNBLOCK'; interaction_time: string; interaction_data?: { message_id?: string; message_type?: 'text' | 'image' | 'file' | 'sticker' | 'location' | 'template'; message_content?: string; attachment_id?: string; template_id?: string; }; source?: 'OA_CHAT' | 'ZNS' | 'GROUP_CHAT' | 'SOCIAL'; } export interface UserAnalytics { user_id: string; period: { from: string; to: string; }; metrics: { total_interactions: number; messages_sent: number; messages_received: number; response_rate: number; avg_response_time: number; last_interaction: string; interaction_frequency: 'HIGH' | 'MEDIUM' | 'LOW'; }; interaction_breakdown: { by_type: Record<string, number>; by_day: Array<{ date: string; interactions: number; }>; by_hour: Array<{ hour: number; interactions: number; }>; }; engagement_score: number; } export interface UserSegment { segment_id: string; segment_name: string; segment_description?: string; criteria: { tags?: string[]; interaction_frequency?: 'HIGH' | 'MEDIUM' | 'LOW'; last_interaction_days?: number; user_attributes?: Record<string, any>; custom_fields?: Record<string, any>; }; user_count: number; created_time: string; updated_time?: string; } export interface UserCustomField { field_id: string; field_name: string; field_type: 'TEXT' | 'NUMBER' | 'DATE' | 'BOOLEAN' | 'SELECT' | 'MULTI_SELECT'; field_options?: string[]; is_required: boolean; is_searchable: boolean; created_time: string; } export interface UserCustomFieldValue { field_id: string; field_name: string; field_value: any; updated_time: string; } export interface UserBehavior { user_id: string; behavior_type: 'PAGE_VIEW' | 'BUTTON_CLICK' | 'FORM_SUBMIT' | 'PURCHASE' | 'CUSTOM'; behavior_data: Record<string, any>; timestamp: string; source: string; session_id?: string; } export interface UserJourney { user_id: string; journey_id: string; journey_name: string; current_step: string; step_history: Array<{ step_id: string; step_name: string; entered_time: string; completed_time?: string; status: 'COMPLETED' | 'IN_PROGRESS' | 'SKIPPED' | 'FAILED'; }>; journey_status: 'ACTIVE' | 'COMPLETED' | 'ABANDONED' | 'PAUSED'; started_time: string; completed_time?: string; abandoned_time?: string; } export interface UserPreference { user_id: string; preferences: { communication_channels: ('OA_CHAT' | 'ZNS' | 'EMAIL' | 'SMS')[]; message_frequency: 'REAL_TIME' | 'DAILY' | 'WEEKLY' | 'MONTHLY'; content_types: string[]; language: string; timezone: string; opt_in_marketing: boolean; opt_in_notifications: boolean; }; updated_time: string; } export interface UserActivity { activity_id: string; user_id: string; activity_type: string; activity_description: string; activity_time: string; metadata?: Record<string, any>; } export interface UserExport { export_id: string; export_type: 'ALL_USERS' | 'FILTERED_USERS' | 'SEGMENT_USERS'; filters?: { tags?: string[]; date_range?: { from: string; to: string; }; interaction_criteria?: Record<string, any>; }; segment_id?: string; export_format: 'CSV' | 'EXCEL' | 'JSON'; status: 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED'; file_url?: string; total_records?: number; created_time: string; completed_time?: string; expires_at?: string; } export interface UserImport { import_id: string; import_type: 'NEW_USERS' | 'UPDATE_USERS' | 'MERGE_USERS'; file_url: string; mapping: Record<string, string>; status: 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED'; total_records?: number; processed_records?: number; successful_records?: number; failed_records?: number; error_details?: Array<{ row: number; error: string; }>; created_time: string; completed_time?: string; } export interface UserSearch { query: string; filters?: { tags?: string[]; user_attributes?: Record<string, any>; interaction_date_range?: { from: string; to: string; }; custom_fields?: Record<string, any>; }; sort?: { field: string; order: 'ASC' | 'DESC'; }; pagination: { offset: number; limit: number; }; } export interface UserSearchResult { users: UserProfile[]; total_count: number; has_more: boolean; search_time: number; } export interface BulkUserOperation { operation_id: string; operation_type: 'TAG_USERS' | 'UNTAG_USERS' | 'DELETE_USERS' | 'UPDATE_USERS'; user_ids: string[]; operation_data?: Record<string, any>; status: 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED'; total_users: number; processed_users?: number; successful_operations?: number; failed_operations?: number; created_time: string; completed_time?: string; } export interface UserManagementApiResponse<T = any> { error: number; message: string; data?: T; } export type UserProfileResponse = UserManagementApiResponse<UserProfile['data']>; export type UserListResponse = UserManagementApiResponse<UserList['data']>; export type UserTagResponse = UserManagementApiResponse<UserTag>; export type UserTagListResponse = UserManagementApiResponse<UserTagList['data']>; export type UserAnalyticsResponse = UserManagementApiResponse<UserAnalytics>; export type UserSegmentResponse = UserManagementApiResponse<UserSegment>; export type BulkOperationResponse = UserManagementApiResponse<BulkUserOperation>; //# sourceMappingURL=user-management.d.ts.map