SparkBot icon

SparkBot

Interact with SparkBot WhatsApp API

Actions148

Overview

The node interacts with the SparkBot WhatsApp API to retrieve files associated with WhatsApp chats. Specifically, the "Chat Files" resource with the "Get Files" operation allows users to fetch media and document files exchanged in WhatsApp conversations linked to a specified WhatsApp number.

This node is beneficial for scenarios such as:

  • Archiving or backing up media files shared in WhatsApp chats.
  • Filtering and retrieving specific types of files (images, videos, documents, etc.) for further processing or analysis.
  • Searching files by filename, caption, message ID, or chat ID to locate particular content.
  • Paginating through large sets of files with sorting options.

Practical examples include:

  • Automatically downloading all images sent to a customer support WhatsApp number for quality assurance.
  • Extracting voice notes from outbound messages for transcription.
  • Filtering documents shared within a team group chat for compliance checks.

Properties

Name Meaning
WhatsApp Number The ID of the WhatsApp number (device) from which to retrieve chat files. This identifies the source WhatsApp account.
Filters A collection of optional filters to narrow down the files retrieved:
- File Type Filter files by media type. Options include: Image, Video, Audio, Voice (push-to-talk), Document, Sticker.
- Search Search files by filename, caption, message ID, or chat ID text.
- Chat IDs Filter files by one or more WhatsApp chat IDs (e.g., 447362053576@c.us).
- File IDs Filter files by one or more specific file IDs.
- Message IDs Filter files by origin message WhatsApp IDs.
- Flow Filter files by message flow direction containing the file: Inbound or Outbound.
- Created After Only include files created after this date/time.
- Created Before Only include files created before this date/time.
- Results Page Size Number of results to return per page (pagination size). Default is 20.
- Page Number Page number to retrieve, starting from 0.
- Sort Sorting criteria for the files. Options are: Recent First, Oldest First, Largest First, Smallest First.

Output

The output is an array of JSON objects representing the files matching the query parameters. Each object contains metadata about a file such as its ID, type, size, creation date, associated chat/message IDs, and possibly URLs or references to download or access the file content.

If the node supports binary data output (not explicitly shown here), it would typically provide the actual file content in a binary field alongside the JSON metadata.

Dependencies

  • Requires an active connection to the SparkBot WhatsApp API.
  • Needs an API key credential configured in n8n for authentication with the SparkBot service.
  • The node depends on internal methods that handle communication with the SparkBot API endpoints related to chat files.

Troubleshooting

  • Common issues:

    • Invalid or missing WhatsApp number (device ID) will cause failures in fetching files.
    • Incorrect filter values (e.g., invalid chat IDs or file IDs) may result in empty responses or errors.
    • Pagination parameters out of range might lead to no results returned.
    • API rate limits or connectivity issues with the SparkBot service can cause request failures.
  • Error messages:

    • Errors returned from the API will be surfaced as error messages in the node output if "Continue On Fail" is enabled.
    • Authentication errors indicate problems with the API key credential setup.
    • Validation errors suggest incorrect input parameters; verify property values especially for filters.

Links and References

Discussion