Toggle Menu
Prev Up Next

# `langchain_community.chat_loaders.whatsapp`.WhatsAppChatLoader

class langchain_community.chat_loaders.whatsapp.WhatsAppChatLoader(path: str)

  Load WhatsApp conversations from a dump zip file or directory.

  Initialize the WhatsAppChatLoader.

  Parameters

    path (str) – Path to the exported WhatsApp chat zip directory, folder, or file.

  To generate the dump, open the chat, click the three dots in the top right corner, and select “More”. Then select “Export chat” and choose “Without media”.

  Methods

  `__init__`(path) | Initialize the WhatsAppChatLoader.
  `lazy_load`() | Lazy load the messages from the chat file and yield them as chat sessions.
  `load`() | Eagerly load the chat sessions into memory.

  __init__(path: str)

    Initialize the WhatsAppChatLoader.

    Parameters

      path (str) – Path to the exported WhatsApp chat zip directory, folder, or file.

    To generate the dump, open the chat, click the three dots in the top right corner, and select “More”. Then select “Export chat” and choose “Without media”.

  lazy_load() → Iterator[ChatSession]

    Lazy load the messages from the chat file and yield them as chat sessions.

    Yields

      Iterator[ChatSession] – The loaded chat sessions.

    Return type

      Iterator[ChatSession]

  load() → List[ChatSession]

    Eagerly load the chat sessions into memory.

    Return type

      List[ChatSession]

# Examples using WhatsAppChatLoader

- Facebook - Meta

- Merge consecutive messages from the same sender into a single message

- WhatsApp

- whatsapp_chat.md