Skip to content

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

NameTypeRequiredDescription
selfyes
qiyes

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

NameTypeRequiredDescription
selfyes

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

NameTypeRequiredDescription
selfyes
qiyes

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

NameTypeRequiredDescription
selfyes
queue_itemyes
message_statusyes
messageyes
webhookyes
error_codeyes

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

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2