useChatImport

Hook

Parses raw chat exports (WhatsApp, custom) into structured Chat objects. Provide a parser function; optionally pass File objects for media attachment resolution.

core/use-chat-import

Installation

1 · Add registry to components.json

2 · Install component

Examples

WhatsApp import

Parses a raw WhatsApp text export into structured messages.

API Reference

PropTypeDescription
parserreq
ChatParserParser function (e.g. parseWhatsApp from whatsapp-parser).
initialChat
ChatOptional pre-populated chat data.
onSuccess
(chat: Chat) => voidCalled when parsing succeeds.
onError
(error: Error) => voidCalled when parsing fails.
(returns) importText
(raw: string, files?: File[]) => voidParse a raw text export.
(returns) chat
Chat | nullThe parsed Chat object.
(returns) isLoading
booleanTrue while parsing.