Hooks for managing recipients in email campaigns, including file uploads and import mapping.
Unlike other systems that require you download a sample file for recipients, Simpu provides a more streamlined approach by allowing you to upload your own files and allows you map columns to the recipient fields directly.
The useSimpuFileUpload
hook handles recipient file uploads, including CSV and Excel file processing for campaign recipients.
onUploadFile(fileType: "csv" | "excel", file: File)
- Uploads a file and returns import data and columnsonUploadBlob(blob: Blob)
- Uploads a blob as a fileonProcessCSVFile(file: File)
- Processes CSV file and returns sample data (up to 500 rows of the file) for use when auto-detecting columnsonProcessExcelFile(file: File)
- Processes Excel file and returns sample data (up to 500 rows of the file) for use when auto-detecting columnsonFileUploadDropRejected({ files: File[] })
- Handles rejected file uploads, such as unsupported file types or size limitsThe useImportMapping
hook manages column mapping for imported files, including auto-detection of column types and manual mapping configuration.
mappedProperties: PropertySchema[]
- Array of mapped propertiesautoDetectionLoading: boolean
- True when auto-detecting column typeshasSelectedEmailColumn: boolean
- True if an email column is selectedonMapColumns(importId: string, mapping: Record<string, PropertySchema>)
- Maps columns for importonPropertyUpdate(property: PropertySchema, index: number)
- Updates a propertyonAutoDetectColumns(dataSample?: any[])
- Auto-detects column types from sample data