> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hypersender.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WhatsApp Queued Requests in Python

> Check whether a queued WhatsApp API request was sent, and read its response, from Python. Poll queued requests by UUID with the Hypersender Python SDK.

## Overview

In V2, all API requests are processed through a queued system for improved reliability and performance. When you make any API request (send message, react, etc.), you receive an immediate response with a `queued_request_uuid`. Use this method to check the actual response of your queued request.

> [!NOTE]
>
> Learn more about the V2 queued request system in the [Queued Requests Documentation](https://docs.hypersender.com/v2/api-reference/whatsapp/queued-requests.md).

## Get Queued Request

Retrieve the status and response of a queued API request using its UUID.

> [tab] Basic Usage
>
> ```python theme={null}
> from hypersender import Hypersender
>
> hs = Hypersender()
>
> result = hs.whatsapp.get_queued_request("a0816120-7e37-4e8b-8cf3-92deb2cdc133")
>
> # Check if the request is completed
> if result["response_status"] is not None:
>     # Request completed
>     print(f"Status: {result['response_status']}")
>     print(f"Response: {result['response_body']}")
> else:
>     # Still processing
>     print("Request is still being processed...")
> ```

> [tab] Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | uuid | str | yes | The UUID of the queued request to retrieve (passed as the first argument) |

> [tab] Response
>
> ```json theme={null}
> {
>   "uuid": "a0816120-7e37-4e8b-8cf3-92deb2cdc133",
>   "request": {
>     "chatId": "111111111111@c.us",
>     "text": "Hello world!"
>   },
>   "response_status": 200,
>   "response_body": {
>     "message_id": "AAAAAA0000BBBBB00CCCCCC"
>   },
>   "response_header": {}
> }
> ```

> [!NOTE]
>
> The `response_status`, `response_body`, and `response_header` will be `None` while the request is still being processed.

## Response Fields

The SDK returns the API's JSON as a plain `dict`, so the fields keep the API's snake\_case names.

| Field | Type | Description |
| - | - | - |
| `uuid` | str | The unique identifier for this queued request |
| `request` | dict | The original request payload you submitted |
| `response_status` | int \| None | HTTP status code of the processed request. `None` while still processing |
| `response_body` | dict \| None | The actual API response. Contains message details on success, error details on failure. `None` while processing |
| `response_header` | dict \| None | Response headers from the processed request. `None` while processing |

## Polling Example

If you need to wait for a request to complete, you can implement polling with exponential backoff:

```python theme={null}
import time

from hypersender import Hypersender

hs = Hypersender()


def wait_for_completion(uuid: str, max_attempts: int = 10) -> dict:
    for attempt in range(max_attempts):
        result = hs.whatsapp.get_queued_request(uuid)

        if result["response_status"] is not None:
            return result  # Request completed

        # Exponential backoff: 0.1s, 0.2s, 0.4s, 0.8s...
        time.sleep(0.1 * 2**attempt)

    raise TimeoutError("Request did not complete in time")


# Usage
sent = hs.whatsapp.send_text_safe("20123456789@c.us", "Hello!")

result = wait_for_completion(sent["queued_request_uuid"])

if result["response_status"] == 200:
    print(f"Message sent! ID: {result['response_body']['message_id']}")
else:
    print(f"Failed with status: {result['response_status']}")
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.