vdq.handlers
Overview
Email and SMS send handlers and Twilio webhook processing for the VDQ.
Classes
handle_bounce
Anymail tracking signal receiver. Processes ESP delivery events (delivered, bounced, rejected, failed, deferred) and transitions the matching QueueItem accordingly. An event finds its item by message_id first, then through the configured EmailTrackingStrategy, which also stores the message_id on an item that has none. Logs a warning for an event that finds no item and an error for unhandled exceptions.
Signature
handle_bounce(sender, event, esp_name, kwargs)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| sender | yes | |||
| event | yes | |||
| esp_name | yes | |||
| kwargs | no |
Source
server/vueda/vdq/handlers.py:391
send_email
Send the email for a QueueItem. Validates sender and receiver email addresses, attaches inline images and regular attachments, adds the tracking data from the configured EmailTrackingStrategy, then sends via Anymail. Anymail raises AnymailUnsupportedFeature while it builds the request when the ESP accepts no such data, so the email is then sent once more without it. Transitions the queue item to await on success, or error on permanent failure. A status update that reached the item first keeps the state and result it set. Transient ESP errors (5xx, 408, 423, 429) raise AnymailTransientError for retry.
Signature
send_email(qi)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| qi | yes |
Source
server/vueda/vdq/handlers.py:128
timeout_queue_item
Mark a QueueItem as timed out and transition it to the timeout state.
Signature
timeout_queue_item(queue_item, timeout_hours)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| queue_item | yes | |||
| timeout_hours | yes |
Source
server/vueda/vdq/handlers.py:352
twilio_status_callback_url
Return base_url with the queue item's primary key added as the queue_item query parameter.
Signature
twilio_status_callback_url(base_url, queue_item)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| base_url | yes | |||
| queue_item | yes |
Returns
str
Source
server/vueda/vdq/handlers.py:344
validate_email_role
Raise ValueError if role has no email address.
Signature
validate_email_role(role)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| role | yes |
Source
server/vueda/vdq/handlers.py:71
validate_sms_role
Raise ValueError if role has no cell phone number.
Signature
validate_sms_role(role)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| role | yes |
Source
server/vueda/vdq/handlers.py:76
Source
server/vueda/vdq/handlers.py