SparkBot icon

SparkBot

Interact with SparkBot WhatsApp API

Actions148

Overview

The "Empty Queue" operation for the Queue resource in this node allows users to delete messages that are currently queued for sending via a WhatsApp number. This is useful for managing and cleaning up message queues, especially when you want to cancel pending messages before they are sent.

Common scenarios include:

  • Clearing all queued messages for a specific WhatsApp number to stop any further delivery.
  • Selectively deleting queued messages based on filters such as message IDs, phone numbers, group/broadcast IDs, or date ranges.
  • Skipping scheduled messages that are set to be delivered in the future while clearing other queued messages.
  • Waiting for confirmation that all deletions have completed before proceeding.

Practical examples:

  • A user wants to immediately clear all pending messages for a WhatsApp number due to an urgent change in campaign strategy.
  • Deleting only messages targeted at certain phone numbers or groups to refine the queue without affecting others.
  • Removing messages created before or after a specific date to manage queue size or comply with data retention policies.

Properties

Name Meaning
WhatsApp Number The ID of the WhatsApp number whose message queue will be emptied.
Wait for Completion Whether to wait until all queued messages are deleted before returning (response may take up to 90 seconds).
Skip Scheduled Messages If enabled, scheduled messages that will be delivered in the future will not be deleted.
Filter Type The type of filter to apply when emptying the queue. Options: None (delete all), Message IDs, Phone Numbers, Group/Broadcast IDs, Date Range.
Message IDs (Required if Filter Type is "Message IDs") List of queued message IDs (24-character hexadecimal strings) to delete.
Phone Numbers (Required if Filter Type is "Phone Numbers") List of phone numbers in E164 format (e.g., +447362053576) whose queued messages should be deleted.
Group/Broadcast IDs (Required if Filter Type is "Group/Broadcast IDs") List of WhatsApp group or broadcast list IDs (e.g., 447362053576-000000000@g.us) to filter queued messages.
Date Filters (Required if Filter Type is "Date Range") Collection with optional "Created Before" and/or "Created After" datetime values to filter queued messages by creation date.

Output

The node outputs JSON data representing the result of the empty queue operation. This typically includes information about which messages were deleted or the status of the deletion request.

If "Wait for Completion" is enabled, the output confirms that all specified queued messages have been deleted.

No binary data output is involved in this operation.

Dependencies

  • Requires an API key credential for authenticating with the SparkBot WhatsApp API.
  • The node depends on the external SparkBot WhatsApp API service to perform queue management operations.
  • Proper configuration of the WhatsApp number (device) within the SparkBot system is necessary.

Troubleshooting

  • Common Issues:

    • Providing invalid or non-existent WhatsApp number ID will cause the operation to fail.
    • Using incorrect message IDs, phone numbers, or group IDs in filters may result in no messages being deleted.
    • Network or authentication errors with the SparkBot API can prevent queue operations from succeeding.
  • Error Messages:

    • Errors related to missing required parameters (e.g., missing message IDs when filter type is "ids").
    • API errors indicating unauthorized access due to invalid or missing API key.
    • Timeout errors if "Wait for Completion" is enabled and the deletion process takes too long.
  • Resolutions:

    • Verify that the WhatsApp number ID is correct and active.
    • Double-check filter values for correctness and formatting.
    • Ensure the API key credential is valid and has appropriate permissions.
    • Consider disabling "Wait for Completion" if timeouts occur frequently.

Links and References

Discussion