Caller object

class terminusgps.twilio.caller.TwilioCaller(client_sid: str | None = None, client_token: str | None = None, from_number: str | None = None, messaging_sid: str | None = None, log_level: int = 10, log_days: int = 10)[source]

Public Data Attributes:

client_sid

Client session id.

from_number

Origin phone number.

messaging_sid

Messaging service session id.

Public Methods:

__init__([client_sid, client_token, ...])

Sets Twilio client session variables.

__enter__()

Opens a context manager and creates an asyncronous Twilio client.

__exit__(exc_type, exc_value, exc_tb)

Closes the context manager.

create_notification(to_number, message[, method])

Returns an awaitable notification task.

create_call(to_number, message)

Calls to_number and reads message aloud.

create_sms(to_number, message)

Texts message to to_number.


property client_sid: str

Client session id.

Type:

str

async create_call(to_number: str, message: str) None[source]

Calls to_number and reads message aloud.

Parameters:
  • to_number (str) – A phone number.

  • message (str) – A message to be read aloud.

Returns:

Nothing.

Return type:

None

create_notification(to_number: str, message: str, method: str = 'sms') Task[Any][source]

Returns an awaitable notification task.

Valid methods are "sms", "call" and "phone".

Parameters:
  • to_number (str) – A phone number to notify.

  • message (str) – A notification message.

  • method (str) – A notification method. Default is "sms".

Raises:

ValueError – If method is invalid.

Returns:

An awaitable task.

Return type:

Task

async create_sms(to_number: str, message: str) None[source]

Texts message to to_number.

Parameters:
  • to_number (str) – A phone number.

  • message (str) – A message to be texted.

Returns:

Nothing.

Return type:

None

property from_number: str

Origin phone number.

Type:

str

property messaging_sid: str

Messaging service session id.

Type:

str