CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-twilio

Twilio API client and TwiML generator for comprehensive telecommunications services

Overview
Eval results
Files

advanced-services.mddocs/

Advanced Services

Specialized Twilio services including video conferencing, real-time chat, identity verification, push notifications, visual workflows, serverless functions, and contact center solutions.

Capabilities

Video Conferencing

Programmable Video API for building video applications with rooms, participants, and recordings.

class RoomInstance:
    """Video room for conferences"""
    sid: str                    # Room SID
    unique_name: str           # Room unique name
    status: str                # Room status ('in-progress', 'completed')
    type: str                  # Room type ('group', 'peer-to-peer', 'go')
    max_participants: int      # Maximum participants
    duration: int              # Room duration in seconds
    date_created: datetime     # Creation time
    date_updated: datetime     # Last update

class VideoV1:
    def rooms(self) -> RoomList:
        """Access video rooms"""
    
    def recordings(self) -> RecordingList:
        """Access video recordings"""
    
    def compositions(self) -> CompositionList:
        """Access video compositions"""

def create(
    self,
    unique_name: str = None,
    type: str = None,
    status_callback: str = None,
    status_callback_method: str = None,
    max_participants: int = None,
    record_participants_on_connect: bool = None,
    video_codecs: list = None,
    media_region: str = None,
    recording_rules: dict = None,
    large_room: bool = None
) -> RoomInstance:
    """
    Create video room.
    
    Args:
        unique_name (str): Unique room identifier
        type (str): Room type ('group', 'peer-to-peer', 'go')
        max_participants (int): Maximum participants (default: 50)
        record_participants_on_connect (bool): Auto-record participants
        video_codecs (list): Supported video codecs
        media_region (str): Media processing region
        
    Returns:
        RoomInstance: Created room
    """

Conversations & Chat

Real-time messaging and chat functionality with conversation management.

class ConversationInstance:
    """Messaging conversation"""
    sid: str                   # Conversation SID
    unique_name: str          # Unique identifier
    friendly_name: str        # Display name
    attributes: dict          # Custom attributes
    messaging_service_sid: str # Associated messaging service
    date_created: datetime    # Creation time
    date_updated: datetime    # Last update
    state: str                # Conversation state

class ConversationsV1:
    def conversations(self) -> ConversationList:
        """Access conversations"""
    
    def users(self) -> UserList:
        """Access conversation users"""
    
    def services(self) -> ServiceList:
        """Access conversation services"""

def create(
    self,
    friendly_name: str = None,
    unique_name: str = None,
    attributes: dict = None,
    messaging_service_sid: str = None,
    date_created: datetime = None,
    date_updated: datetime = None,
    state: str = None,
    timers: dict = None,
    bindings: dict = None
) -> ConversationInstance:
    """
    Create conversation.
    
    Args:
        friendly_name (str): Display name
        unique_name (str): Unique identifier
        attributes (dict): Custom metadata
        messaging_service_sid (str): Messaging service
        
    Returns:
        ConversationInstance: Created conversation
    """

Identity Verification

Verify user identities via SMS, voice, email, or push notifications.

class ServiceInstance:
    """Verification service"""
    sid: str                   # Service SID
    account_sid: str          # Account SID
    friendly_name: str        # Service name
    code_length: int          # Verification code length
    lookup_enabled: bool      # Phone lookup enabled
    psd2_enabled: bool        # PSD2 compliance enabled
    skip_sms_to_landlines: bool # Skip SMS to landlines
    dtmf_input_required: bool # Require DTMF input
    tts_name: str             # Text-to-speech voice
    date_created: datetime    # Creation time
    date_updated: datetime    # Last update

class VerificationInstance:
    """Identity verification attempt"""
    sid: str                  # Verification SID
    service_sid: str         # Service SID
    account_sid: str         # Account SID
    to: str                  # Recipient identifier
    channel: str             # Verification channel
    status: str              # Verification status
    valid: bool              # Is verification valid
    date_created: datetime   # Creation time
    date_updated: datetime   # Last update

class VerifyV2:
    def services(self) -> ServiceList:
        """Access verification services"""

def create(
    self,
    to: str,
    channel: str,
    custom_friendly_name: str = None,
    custom_message: str = None,
    send_digits: str = None,
    locale: str = None,
    custom_code: str = None,
    amount: str = None,
    payee: str = None,
    rate_limits: dict = None,
    channel_configuration: dict = None,
    app_hash: str = None,
    template_sid: str = None,
    template_custom_substitutions: dict = None,
    device_ip: str = None,
    risk_check: str = None,
    tags: dict = None
) -> VerificationInstance:
    """
    Start verification process.
    
    Args:
        to (str): Phone number or email to verify
        channel (str): Channel ('sms', 'call', 'email', 'whatsapp')
        custom_message (str): Custom verification message
        locale (str): Localization language
        
    Returns:
        VerificationInstance: Started verification
    """

Push Notifications

Send push notifications to mobile apps and web browsers.

class NotificationInstance:
    """Push notification"""
    sid: str                  # Notification SID
    account_sid: str         # Account SID
    service_sid: str         # Notify service SID
    date_created: datetime   # Creation time
    identities: list         # Target identities
    tags: list               # Target tags
    segments: list           # Target segments
    priority: str            # Notification priority
    ttl: int                 # Time to live
    title: str               # Notification title
    body: str                # Notification body
    sound: str               # Notification sound
    action: str              # Action URL
    data: dict               # Custom data
    apn: dict                # Apple Push settings
    gcm: dict                # Google Cloud Messaging settings
    fcm: dict                # Firebase Cloud Messaging settings
    sms: dict                # SMS fallback settings

class NotifyV1:
    def services(self) -> ServiceList:
        """Access notification services"""

def create(
    self,
    identity: list = None,
    tag: list = None,
    body: str = None,
    priority: str = None,
    ttl: int = None,
    title: str = None,
    sound: str = None,
    action: str = None,
    data: dict = None,
    apn: dict = None,
    gcm: dict = None,
    fcm: dict = None,
    sms: dict = None,
    facebook_messenger: dict = None,
    alexa: dict = None
) -> NotificationInstance:
    """
    Send push notification.
    
    Args:
        identity (list): Target user identities
        tag (list): Target user tags
        body (str): Notification message
        title (str): Notification title
        data (dict): Custom payload data
        
    Returns:
        NotificationInstance: Sent notification
    """

Real-time Data Sync

Synchronize data across devices and applications in real-time.

class DocumentInstance:
    """Sync document"""
    sid: str                  # Document SID
    unique_name: str         # Document name
    account_sid: str         # Account SID
    service_sid: str         # Sync service SID
    url: str                 # Document URL
    links: dict              # Related resources
    revision: str            # Document revision
    data: dict               # Document data
    date_expires: datetime   # Expiration time
    date_created: datetime   # Creation time
    date_updated: datetime   # Last update
    created_by: str          # Creator identity

class SyncV1:
    def services(self) -> ServiceList:
        """Access sync services"""

def update(
    self,
    data: dict = None,
    ttl: int = None,
    if_match: str = None
) -> DocumentInstance:
    """
    Update sync document.
    
    Args:
        data (dict): Document data
        ttl (int): Time to live in seconds
        if_match (str): Conditional update revision
        
    Returns:
        DocumentInstance: Updated document
    """

Studio Workflows

Visual workflow builder for complex communication flows.

class FlowInstance:
    """Studio flow"""
    sid: str                  # Flow SID
    account_sid: str         # Account SID
    friendly_name: str       # Flow name
    definition: dict         # Flow definition JSON
    status: str              # Flow status
    revision: int            # Flow revision number
    commit_message: str      # Last commit message
    valid: bool              # Is flow valid
    errors: list             # Validation errors
    warnings: list           # Validation warnings
    date_created: datetime   # Creation time
    date_updated: datetime   # Last update
    date_published: datetime # Publication time
    url: str                 # Flow URL
    webhook_url: str         # Webhook URL

class ExecutionInstance:
    """Flow execution"""
    sid: str                 # Execution SID
    account_sid: str        # Account SID
    flow_sid: str           # Flow SID
    contact_channel_address: str # Contact address
    context: dict           # Execution context
    status: str             # Execution status
    date_created: datetime  # Start time
    date_updated: datetime  # Last update

class StudioV2:
    def flows(self) -> FlowList:
        """Access Studio flows"""

def create(
    self,
    friendly_name: str,
    status: str,
    definition: dict = None,
    commit_message: str = None
) -> FlowInstance:
    """
    Create Studio flow.
    
    Args:
        friendly_name (str): Flow name
        status (str): Flow status ('draft' or 'published')
        definition (dict): Flow widget definition
        commit_message (str): Commit message
        
    Returns:
        FlowInstance: Created flow
    """

Serverless Functions

Deploy and manage serverless functions and assets.

class FunctionInstance:
    """Serverless function"""
    sid: str                 # Function SID
    account_sid: str        # Account SID
    service_sid: str        # Service SID
    friendly_name: str      # Function name
    date_created: datetime  # Creation time
    date_updated: datetime  # Last update
    url: str                # Function URL
    links: dict             # Related resources

class AssetInstance:
    """Serverless asset"""
    sid: str                # Asset SID
    account_sid: str       # Account SID
    service_sid: str       # Service SID
    friendly_name: str     # Asset name
    date_created: datetime # Creation time
    date_updated: datetime # Last update
    url: str               # Asset URL
    links: dict            # Related resources

class ServerlessV1:
    def services(self) -> ServiceList:
        """Access serverless services"""

### AI Assistants

AI-powered assistants for building conversational experiences and automation.

```python { .api }
class AssistantInstance:
    """AI assistant"""
    sid: str                    # Assistant SID
    account_sid: str           # Account SID
    friendly_name: str         # Assistant name
    unique_name: str           # Unique identifier
    instructions: str          # Assistant instructions
    fallback_actions: list     # Fallback actions
    initiation_actions: list   # Initiation actions
    model_build_sid: str       # Associated model build
    date_created: datetime     # Creation time
    date_updated: datetime     # Last update

class AssistantsV1:
    def assistants(self) -> AssistantList:
        """Access AI assistants"""
    
    def model_builds(self) -> ModelBuildList:
        """Access model builds"""

### Frontline API

Customer conversation management platform for customer service teams.

```python { .api }
class UserInstance:
    """Frontline user"""
    sid: str                   # User SID
    identity: str             # User identity
    friendly_name: str        # Display name
    avatar: str               # Avatar URL
    state: str                # User state
    is_available: bool        # Availability status
    date_created: datetime    # Creation time
    date_updated: datetime    # Last update

class Frontline_ApiV1:
    def users(self) -> UserList:
        """Access Frontline users"""

Usage examples:

# Create video room
room = client.video.v1.rooms.create(
    unique_name="daily-standup",
    type="group",
    max_participants=10
)

# Start verification
verification = client.verify.v2.services.get("VAxxxxx").verifications.create(
    to="+15551234567",
    channel="sms"
)

# Send push notification
notification = client.notify.v1.services.get("ISxxxxx").notifications.create(
    identity=["alice", "bob"],
    body="New message received"
)

# Update sync document
document = client.sync.v1.services.get("ISxxxxx").documents.get("MyDoc").update(
    data={"counter": 42, "updated": "now"}
)

Install with Tessl CLI

npx tessl i tessl/pypi-twilio

docs

advanced-services.md

authentication-jwt.md

core-communications.md

index.md

infrastructure.md

rest-client.md

twiml-generation.md

webhooks-validation.md

tile.json