whatsapp
¶
WhatsApp chat export connector.
Reads WhatsApp chat history from exported .txt files. WhatsApp allows exporting individual chats via Chat → More → Export Chat on iOS/Android, producing plain-text files in a well-known format.
Export line format::
1/15/24, 10:30 AM - Alice: Hey, how are you?
1/15/24, 10:31 AM - Bob: Good thanks! Working on the project.
Each .txt file in the configured directory is parsed and yielded as a
single :class:~openjarvis.connectors._stubs.Document with doc_type
"message" and the message lines joined as content.
Classes¶
WhatsAppConnector
¶
Bases: BaseConnector
Read WhatsApp message history from exported .txt files.
WhatsApp allows exporting individual chats as plain-text files via
Chat → More → Export Chat. Point this connector at the directory
containing those files (one file per chat) and it will parse each file
into a :class:~openjarvis.connectors._stubs.Document.
| PARAMETER | DESCRIPTION |
|---|---|
export_path
|
Path to the directory containing WhatsApp export .txt files. If empty, no documents are yielded.
TYPE:
|
Source code in src/openjarvis/connectors/whatsapp.py
Functions¶
is_connected
¶
Return True if the export directory exists and contains .txt files.
disconnect
¶
sync
¶
sync(*, since: Optional[datetime] = None, cursor: Optional[str] = None) -> Iterator[Document]
Parse WhatsApp export files and yield one Document per chat file.
| PARAMETER | DESCRIPTION |
|---|---|
since
|
If provided, skip files (chats) whose most recent message is before this datetime. A file is included if any of its messages are on or after since.
TYPE:
|
cursor
|
Not used (included for API compatibility).
TYPE:
|
| YIELDS | DESCRIPTION |
|---|---|
Document
|
One document per .txt export file. The document content is the full parsed text of the chat with timestamp and sender prefixes. Participants are extracted from the set of senders found. |
Source code in src/openjarvis/connectors/whatsapp.py
sync_status
¶
sync_status() -> SyncStatus
Return sync progress from the most recent :meth:sync call.
Source code in src/openjarvis/connectors/whatsapp.py
mcp_tools
¶
mcp_tools() -> List[ToolSpec]
Expose two MCP tool specs for real-time WhatsApp queries.