SparkBot icon

SparkBot

Interact with SparkBot WhatsApp API

Actions148

Overview

This node interacts with the SparkBot WhatsApp API to search for files stored or managed by the service. It allows users to filter and retrieve files based on various criteria such as filename, tags, creation date, file format, status, MIME type, and more. This is useful in scenarios where you need to programmatically find specific media or document files associated with WhatsApp communications or campaigns.

Practical examples include:

  • Searching for all image files uploaded after a certain date.
  • Retrieving voice message files tagged with a particular label.
  • Filtering files by their processing status (e.g., only those ready for use).
  • Finding files by their unique checksum or reference ID.

Properties

Name Meaning
Filters A collection of filters to narrow down the search results. The available filters are:
- Search Term Search files by filename, tags, or reference.
- Created After Only include files created after this date/time.
- Created Before Only include files created before this date/time.
- File Format Filter files by format type. Options: GIF, Voice Message, Native.
- File IDs Filter files by specific file IDs (multiple values allowed).
- Tags Filter files by tags (multiple values allowed).
- SHA2 Checksum Find a file by its SHA2 checksum.
- Reference Search files by reference string.
- Status Filter files by status. Options: Ready, Processing, Failed.
- Device ID Filter files by device ID (selectable from available devices).
- Filename Search files by filename string.
- Origin Filter files by origin. Options: Remote URL, Upload.
- MIME Type Filter files by MIME type. Options include JPEG Image, PNG Image, MP4 Video, MP3 Audio, OGG Audio, PDF Document.
- File Type Filter files by general type. Options: Image, Video, Audio, Document, Other.
- Extension Filter files by file extension. Options: JPG, PNG, MP4, MP3, OGG, PDF, DOCX, XLSX.
- Permission Filter files by permission level. Options: Public, Read-only, Private.
- Owner User ID Filter files by the creator's user ID.
- File Size Range (bytes) Filter files by size range in bytes, specified as "min,max".
- Results Page Size Number of results per page (pagination). Default is 20.
- Page Number Page number for pagination, starting from 0.

Output

The node outputs an array of JSON objects representing the files that match the specified filters. Each object contains metadata about a file, such as its ID, filename, tags, creation date, format, status, MIME type, size, owner, and other relevant attributes provided by the SparkBot API.

If the node supports binary data output (not explicitly shown in the code snippet), it would typically provide the actual file content or a link to download the file in a binary field.

Dependencies

  • Requires an API key credential for authenticating with the SparkBot WhatsApp API.
  • The node depends on the SparkBot API endpoints related to outbound files.
  • No additional environment variables are explicitly required beyond the API key credential.
  • The node uses internal methods to load options dynamically for fields like device IDs and file IDs.

Troubleshooting

  • Common Issues:

    • Incorrect or missing API key credential will cause authentication failures.
    • Using invalid filter values (e.g., wrong date format or unsupported file extensions) may result in no results or errors.
    • Pagination parameters out of range might return empty results.
  • Error Messages:

    • Errors returned from the API will be surfaced as error messages in the node output if "Continue On Fail" is enabled.
    • Typical errors include authentication errors, invalid parameter errors, or network connectivity issues.
  • Resolutions:

    • Verify the API key credential is correctly configured and has necessary permissions.
    • Ensure filter inputs conform to expected formats and valid options.
    • Adjust pagination settings to valid ranges.

Links and References

Discussion