---
url: "https://vueda.dev/v3/reference/api/py/vueda.vdq.tasks.md"
title: "vdq.tasks"
---

# vdq.tasks

## Overview

Celery tasks for sending queue items and processing SMS status updates.

## Classes

- [BaseTask](/v3/reference/api/py/vueda.vdq.tasks/BaseTask.md)
- [CheckUnknownSMSMessageTask](/v3/reference/api/py/vueda.vdq.tasks/CheckUnknownSMSMessageTask.md)
- [QueueProcessor](/v3/reference/api/py/vueda.vdq.tasks/QueueProcessor.md)

## `check_previously_received_message_sid` {#check_previously_received_message_sid}

Apply a Twilio webhook status to the SMS queue item with ``message_sid``. The webhook view queues this
when no matching queue item exists yet.

### Signature {#check_previously_received_message_sid-signature}

`check_previously_received_message_sid(message_sid, message_status)`

#### Parameters {#check_previously_received_message_sid-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="check_previously_received_message_sid-param-message_sid">message_sid</span> |  | yes |  |  |
| <span id="check_previously_received_message_sid-param-message_status">message_status</span> |  | yes |  |  |

### Source {#check_previously_received_message_sid-source}

`server/vueda/vdq/tasks.py:200`

## `check_sms_status` {#check_sms_status}

Poll Twilio for the status of SMS queue items awaiting delivery and update them. Celery runs this every 30
seconds when no Twilio webhook is configured.

### Signature {#check_sms_status-signature}

`check_sms_status()`

### Source {#check_sms_status-source}

`server/vueda/vdq/tasks.py:125`

## `check_sms_timeout_only` {#check_sms_timeout_only}

Fetch the Twilio status of awaiting SMS queue items past the timeout window, and time out those without a
final status. Celery runs this every 30 seconds when a Twilio webhook is configured.

### Signature {#check_sms_timeout_only-signature}

`check_sms_timeout_only()`

### Source {#check_sms_timeout_only-source}

`server/vueda/vdq/tasks.py:142`

## `send_message` {#send_message}

Send the queue item ``qi_pk`` by SMS or email, depending on ``method``. Retries the task when the queue item
stays locked, retries transient Anymail errors with backoff, and moves the item to ``errored`` on failure.

### Signature {#send_message-signature}

`send_message(qi_pk, method)`

#### Parameters {#send_message-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="send_message-param-qi_pk">qi_pk</span> |  | yes |  |  |
| <span id="send_message-param-method">method</span> |  | yes |  |  |

### Source {#send_message-source}

`server/vueda/vdq/tasks.py:151`

## Source

`server/vueda/vdq/tasks.py`
