SparkBot icon

SparkBot

Interact with SparkBot WhatsApp API

Actions148

Overview

This node integrates with the SparkBot WhatsApp API to manage files related to outbound messaging. Specifically, the "Delete Files" operation under the "Files" resource allows users to delete multiple files from the system based on various filtering criteria.

Common scenarios where this node is beneficial include:

  • Cleaning up old or unnecessary media files to save storage space.
  • Removing files that match specific metadata such as file type, owner, or creation date.
  • Automating file management workflows by deleting files that meet certain conditions (e.g., files older than a certain date or files of a particular MIME type).

Practical example:

  • A user wants to delete all image files uploaded before a certain date that are larger than 1MB and tagged with "campaign2023". This node can be configured with those filters to perform bulk deletion automatically.

Properties

Name Meaning
Delete Options Collection of options to specify which files to delete. Contains the following fields:
- Maximum Files to Delete (limit) The maximum number of files to delete in one operation. Accepts values between 1 and 500.
- File IDs (ids) Specific IDs of files to delete. Multiple file IDs can be provided.
- Created Before (before) Delete files created before this date/time.
- Created After (after) Delete files created after this date/time.
- Expires Before (expires) Delete files that expire before this date/time.
- Filename (filename) Delete files matching this exact filename.
- File Extensions (ext) Delete files with these extensions. Multiple extensions can be specified (e.g., "jpg", "png").
- MIME Types (mime) Delete files with these MIME types. Multiple MIME types can be specified (e.g., "image/jpeg", "application/pdf").
- File Types (kind) Delete files of these types. Options include: Image, Video, Audio, Document, Other. Multiple types can be selected.
- Owner IDs (owner) Delete files created by these user IDs. Multiple user IDs can be specified.
- Format (format) Delete files with this format. Options: GIF, Voice Message, Native. Default is Native.
- Permission (permission) Delete files with this permission level. Options: Public, Read-only, Private. Default is Public.
- Tags (tags) Delete files tagged with any of these tags. Multiple tags can be specified.
- Minimum Size (bytes) (size) Delete files larger than this size in bytes.
- Origin (origin) Delete files with this origin. Options: Remote URL, Upload.
- SHA2 Hashes (sha2) Delete files with these SHA2 hashes. Multiple hashes can be specified.

Output

The node outputs an array of JSON objects representing the result of the delete operation for each input item processed. Each JSON object typically contains information about the success or failure of the deletion request.

If binary data were involved, it would represent file content, but since this operation deletes files, no binary output is expected.

Dependencies

  • Requires an API key credential to authenticate with the SparkBot WhatsApp API.
  • The node depends on the SparkBot API service being accessible and properly configured.
  • No additional environment variables are explicitly required beyond the API key credential.

Troubleshooting

  • Common Issues:

    • Providing invalid or non-existent file IDs may cause errors or no files to be deleted.
    • Setting conflicting or overly restrictive filters might result in zero files being matched and deleted.
    • Exceeding the maximum allowed limit (500) for files to delete will likely cause an error.
    • Network or authentication issues with the SparkBot API can prevent successful deletion.
  • Error Messages:

    • Errors related to authentication usually indicate missing or invalid API credentials; verify and update the API key.
    • Validation errors on input parameters (e.g., invalid date formats, unsupported file types) require correcting the input values.
    • Rate limiting or quota exceeded errors from the API suggest waiting or adjusting usage patterns.

Links and References

Discussion