UNPKG

@warriorteam/redai-zalo-sdk

Version:

Comprehensive TypeScript/JavaScript SDK for Zalo APIs - Official Account, ZNS, Consultation Service, Group Messaging, and Social APIs

508 lines 9.46 kB
/** * User management related types and interfaces */ /** * User information from Zalo API v3.0 */ export interface UserInfo { /** * User ID */ user_id: string; /** * User ID by app */ user_id_by_app: string; /** * External user ID in business system */ user_external_id: string; /** * Display name */ display_name: string; /** * User alias */ user_alias: string; /** * Whether user is under 18 */ is_sensitive: boolean; /** * Last interaction date (dd/MM/yyyy) */ user_last_interaction_date: string; /** * Whether user is following OA */ user_is_follower: boolean; /** * Avatar URL */ avatar: string; /** * Avatar URLs with different sizes */ avatars: { "120": string; "240": string; }; /** * Dynamic param from last access */ dynamic_param?: string; /** * Tags and notes information */ tags_and_notes_info: { notes: string[]; tag_names: string[]; }; /** * Shared information from user */ shared_info?: { address?: string; city?: string; district?: string; phone?: string; name?: string; user_dob?: string; }; } /** * User list request parameters */ export interface UserListRequest { /** * Offset for pagination */ offset: number; /** * Number of users to fetch (max 50) */ count: number; /** * Filter by tag name */ tag_name?: string; /** * Filter by last interaction period */ last_interaction_period?: "TODAY" | "YESTERDAY" | "L7D" | "L30D" | string; /** * Filter by follower status */ is_follower?: boolean; } /** * User list response */ export interface UserListResponse { /** * Total number of users */ total: number; /** * Number of users returned */ count: number; /** * Current offset */ offset: number; /** * List of user IDs */ users: Array<{ user_id: string; }>; } /** * User label/tag information */ export interface UserLabel { /** * Label ID */ label_id: string; /** * Label name */ label_name: string; /** * Label description */ description?: string; /** * Label color (hex) */ color?: string; /** * Creation time (Unix timestamp) */ created_time?: number; /** * Number of users with this label */ user_count?: number; } /** * Create label request */ export interface CreateLabelRequest { /** * Label name */ label_name: string; /** * Label description */ description?: string; /** * Label color (hex) */ color?: string; } /** * User label operation request (legacy - for label_id based operations) */ export interface UserLabelRequest { /** * User ID */ user_id: string; /** * Label ID */ label_id: string; } /** * Tag user request - for Zalo API v2.0/oa/tag/tagfollower */ export interface TagUserRequest { /** * User ID (long in API spec, but sent as string) */ user_id: string; /** * Tag name to assign to user * Note: If tag doesn't exist, API will create it automatically */ tag_name: string; } /** * Remove tag from user request - for Zalo API v2.0/oa/tag/rmfollowerfromtag */ export interface RemoveTagFromUserRequest { /** * User ID */ user_id: string; /** * Tag name to remove from user */ tag_name: string; } /** * Get tags list response - for Zalo API v2.0/oa/tag/gettagsofoa */ export interface GetTagsResponse { /** * Error code (0 = success) */ error: number; /** * Response message */ message: string; /** * Array of tag names */ data: string[]; } /** * Delete tag request - for Zalo API v2.0/oa/tag/rmtag */ export interface DeleteTagRequest { /** * Tag name to delete */ tag_name: string; } /** * Update user request - for Zalo API v3.0/oa/user/update */ export interface UpdateUserRequest { /** * User ID (required) */ user_id: string; /** * Shared information to update */ shared_info?: { /** * Display name */ name?: string; /** * Phone number */ phone?: string; /** * Address */ address?: string; /** * City ID (see Zalo documentation for city codes) */ city_id?: number; /** * District ID (see Zalo documentation for district codes) */ district_id?: number; /** * Date of birth (dd/MM/yyyy format, from 1/1/1970) */ user_dob?: string; }; /** * User alias name */ user_alias?: string; /** * External user ID in business system (unique per customer) */ user_external_id?: string; } /** * Delete user info request - for Zalo API v2.0/oa/deletefollowerinfo */ export interface DeleteUserInfoRequest { /** * User ID to delete info for */ user_id: string; } /** * Get user custom info request - for Zalo API v3.0/oa/user/detail/custominfo */ export interface GetUserCustomInfoRequest { /** * User ID to get custom info for */ user_id: string; /** * List of custom fields to export (optional) * If not specified, API returns all available custom info * For table type fields, only parent field is accepted */ fields_to_export?: string[]; } /** * User custom info response - for Zalo API v3.0/oa/user/detail/custominfo */ export interface UserCustomInfoResponse { /** * Error code (0 = success) */ error: number; /** * Response message */ message: string; /** * Custom info data */ data: { /** * User ID */ user_id: string; /** * Custom information fields * All values are returned as strings for consistency */ custom_info: Record<string, any>; }; } /** * Update user custom info request - for Zalo API v3.0/oa/user/update/custominfo */ export interface UpdateUserCustomInfoRequest { /** * User ID to update custom info for */ user_id: string; /** * Custom information to update * Structure depends on OA's custom field configuration */ custom_info: Record<string, any>; } /** * User custom information */ export interface UserCustomInfo { /** * User ID */ user_id: string; /** * Custom fields (key-value pairs) */ custom_fields: Record<string, any>; /** * Last updated timestamp */ last_updated?: number; } /** * Update custom info request */ export interface UpdateCustomInfoRequest { /** * User ID */ user_id: string; /** * Custom fields to update */ custom_fields: Record<string, any>; } /** * User info field types */ export declare enum UserInfoFieldType { TEXT = "text", NUMBER = "number", DATE = "date", SELECT = "select" } /** * Field option for select type */ export interface FieldOption { /** * Option value */ value: string; /** * Option label */ label: string; } /** * User info field definition */ export interface UserInfoField { /** * Field ID */ field_id: string; /** * Field name */ field_name: string; /** * Field type */ field_type: UserInfoFieldType; /** * Field description */ description?: string; /** * Whether field is required */ required?: boolean; /** * Options for select type */ options?: FieldOption[]; /** * Default value */ default_value?: string; /** * Display order */ display_order?: number; /** * Whether it's a system field */ is_system_field?: boolean; /** * Creation time */ created_time?: number; /** * Last update time */ updated_time?: number; } /** * Create user info field request */ export interface CreateUserInfoFieldRequest { /** * Field name */ field_name: string; /** * Field type */ field_type: UserInfoFieldType; /** * Field description */ description?: string; /** * Whether field is required */ required?: boolean; /** * Options for select type */ options?: FieldOption[]; /** * Default value */ default_value?: string; /** * Display order */ display_order?: number; } /** * Update user info field request */ export interface UpdateUserInfoFieldRequest { /** * Field name */ field_name?: string; /** * Field description */ description?: string; /** * Whether field is required */ required?: boolean; /** * Options for select type */ options?: FieldOption[]; /** * Default value */ default_value?: string; /** * Display order */ display_order?: number; } //# sourceMappingURL=user.d.ts.map