TwilioQueueItemHandler
Overview
Handles sending SMS messages and syncing delivery status via the Twilio API. Instantiating this class with TWILIO_ACCOUNT_SID in settings initializes the Twilio client; without it the handler is a no-op.
pull_sms_status
Poll Twilio for messages sent since the queue item's date and update their status.
Signature
pull_sms_status(self, qi)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| qi | yes |
Source
server/vueda/vdq/handlers.py:176
pull_sms_timeout_only
Check awaiting SMS queue items that have exceeded the timeout window (default 2 hours). Fetches each message's current status from Twilio and transitions timed-out items to timeout if no final status is available.
Signature
pull_sms_timeout_only(self)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes |
Source
server/vueda/vdq/handlers.py:196
send_sms
Send an SMS for the given QueueItem via Twilio. Transitions the item to await on success, or error on TwilioRestException.
Signature
send_sms(self, qi)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| qi | yes |
Source
server/vueda/vdq/handlers.py:136
update_sms_qi
Update a QueueItem based on a Twilio message_status string. Transitions to succeed on delivery, error on failure, or timeout when the item has been awaiting longer than the configured timeout.
Signature
update_sms_qi(self, queue_item, message_status, message, webhook, error_code)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| queue_item | yes | ||
| message_status | yes | ||
| message | yes | ||
| webhook | yes | ||
| error_code | yes |
Source
server/vueda/vdq/handlers.py:229
dict {#dict}
dictionary for instance variables
weakref {#weakref}
list of weak references to the object
twilio_client
Source
server/vueda/vdq/handlers.py:118