Deployment Channels Guide
This guide covers creating and managing deployment channels using the WIIL Platform JS SDK. Deployment channels define the communication endpoints (phone numbers, web URLs, mobile apps) through which AI agents are accessible.
Quick Start​
- TypeScript
- Python
import { WiilClient, DeploymentType } from 'wiil-js';
const client = new WiilClient({
apiKey: 'your-api-key',
});
// Create a web deployment channel
const channel = await client.deploymentChannels.create({
channelIdentifier: 'https://example.com',
deploymentType: DeploymentType.WEB,
channelName: 'Main Website Chat',
recordingEnabled: true,
configuration: {
communicationType: 'unified',
widgetConfiguration: {
position: 'right',
customTheme: {
primaryColor: '#007bff',
},
},
},
});
console.log('Channel created:', channel.id);
from wiil import WiilClient
from wiil.models.service_mgt import CreateDeploymentChannel
from wiil.models.type_definitions import DeploymentType
client = WiilClient(api_key='your-api-key')
# Create a web deployment channel
channel = client.deployment_channels.create(
CreateDeploymentChannel(
channel_identifier='https://example.com',
deployment_type=DeploymentType.WEB.value,
channel_name='Main Website Chat',
recording_enabled=True,
configuration={
'communicationType': 'unified',
'widgetConfiguration': {
'position': 'right',
'customTheme': {
'primaryColor': '#007bff',
},
},
},
)
)
print(f'Channel created: {channel.id}')
Architecture Overview​
Deployment channels define the single communication endpoint through which a deployment is accessible:
- 1:1 Relationship: Each Deployment Configuration has exactly one Deployment Channel
- Multi-Channel Pattern: To expose an agent through multiple channels (phone + web), create separate Deployment Configurations
- Channel Types: Phone (calls/SMS), Web (chat widget), Mobile (native apps)
Enums​
DeploymentType​
- TypeScript
- Python
enum DeploymentType {
CALLS = 'calls', // Voice phone calls
SMS = 'sms', // SMS text messaging
WEB = 'web', // Browser-based chat widget
MOBILE = 'mobile-app' // Native mobile applications
}
from wiil.models.type_definitions import DeploymentType
# Available values:
DeploymentType.CALLS # 'calls' - Voice phone calls
DeploymentType.SMS # 'sms' - SMS text messaging
DeploymentType.WEB # 'web' - Browser-based chat widget
DeploymentType.MOBILE # 'mobile-app' - Native mobile applications
DeploymentStatus​
- TypeScript
- Python
enum DeploymentStatus {
PENDING = 'pending', // Created but not yet activated
ACTIVE = 'active', // Operational
PAUSED = 'paused', // Temporarily suspended
ARCHIVED = 'archived' // Decommissioned
}
from wiil.models.type_definitions import DeploymentStatus
# Available values:
DeploymentStatus.PENDING # 'pending' - Created but not yet activated
DeploymentStatus.ACTIVE # 'active' - Operational
DeploymentStatus.PAUSED # 'paused' - Temporarily suspended
DeploymentStatus.ARCHIVED # 'archived' - Decommissioned
Deployment Channel Schema​
| Field | Type | Required | Description |
|---|---|---|---|
| channelIdentifier | string | Yes | Phone number (E.164), URL, or package name |
| deploymentType | DeploymentType | Yes | Channel type (CALLS, SMS, WEB, MOBILE) |
| channelName | string | No | Human-readable name |
| recordingEnabled | boolean | No | Record interactions (default: true) |
| configuration | object | Yes | Type-specific configuration |
Channel Configuration by Type​
Phone Channels (CALLS/SMS):
- TypeScript
- Python
{
phoneConfigurationId: string // Reference to PhoneConfiguration resource
}
{
'phoneConfigurationId': 'phone_config_123' # Reference to PhoneConfiguration
}
Web Channels:
- TypeScript
- Python
{
communicationType: 'text' | 'voice' | 'unified',
widgetConfiguration?: {
position: 'left' | 'right',
customTheme?: Record<string, string>
}
}
{
'communicationType': 'text' | 'voice' | 'unified',
'widgetConfiguration': {
'position': 'left' | 'right',
'customTheme': {'primaryColor': '#007bff'}
}
}
Mobile Channels:
- TypeScript
- Python
{
packageName: string,
platform: 'ios' | 'android'
}
{
'packageName': 'com.example.app',
'platform': 'ios' | 'android'
}
CRUD Operations​
Create Deployment Channel​
- TypeScript
- Python
// Web Channel
const webChannel = await client.deploymentChannels.create({
channelIdentifier: 'https://example.com',
deploymentType: DeploymentType.WEB,
channelName: 'Website Chat Widget',
recordingEnabled: true,
configuration: {
communicationType: 'unified',
widgetConfiguration: {
position: 'right',
customTheme: { primaryColor: '#0066cc' },
},
},
});
console.log('Web channel created:', webChannel.id);
from wiil import WiilClient
from wiil.models.service_mgt import CreateDeploymentChannel
from wiil.models.type_definitions import DeploymentType
client = WiilClient(api_key='your-api-key')
# Web Channel
web_channel = client.deployment_channels.create(
CreateDeploymentChannel(
channel_identifier='https://example.com',
deployment_type=DeploymentType.WEB.value,
channel_name='Website Chat Widget',
recording_enabled=True,
configuration={
'communicationType': 'unified',
'widgetConfiguration': {
'position': 'right',
'customTheme': {'primaryColor': '#0066cc'},
},
},
)
)
print(f'Web channel created: {web_channel.id}')
Get Deployment Channel​
- TypeScript
- Python
// Get by ID
const channel = await client.deploymentChannels.get('channel_123');
console.log('Channel name:', channel.channelName);
console.log('Channel type:', channel.deploymentType);
// Get by identifier and type
const webChannel = await client.deploymentChannels.getByIdentifier(
'https://example.com',
DeploymentType.WEB
);
console.log('Found channel:', webChannel.id);
# Get by ID
channel = client.deployment_channels.get('channel_123')
print(f'Channel name: {channel.channel_name}')
print(f'Channel type: {channel.deployment_type}')
# Get by identifier and type
web_channel = client.deployment_channels.get_by_identifier(
'https://example.com',
DeploymentType.WEB.value
)
print(f'Found channel: {web_channel.id}')
List Deployment Channels​
- TypeScript
- Python
// List all channels
const result = await client.deploymentChannels.list({
page: 1,
pageSize: 20,
});
console.log('Total channels:', result.meta.totalCount);
result.data.forEach(channel => {
console.log(`- ${channel.channelName} (${channel.deploymentType})`);
});
// List by type
const webChannels = await client.deploymentChannels.listByType(
DeploymentType.WEB,
{ page: 1, pageSize: 20 }
);
console.log('Web channels:', webChannels.data.length);
from wiil.types import PaginationRequest
from wiil.models.type_definitions import DeploymentType
# List all channels
result = client.deployment_channels.list(
params=PaginationRequest(page=1, page_size=20)
)
print(f'Total channels: {result.meta.total_count}')
for channel in result.data:
print(f'- {channel.channel_name} ({channel.deployment_type})')
# List by type
web_channels = client.deployment_channels.list_by_type(
DeploymentType.WEB.value,
params=PaginationRequest(page=1, page_size=20)
)
print(f'Web channels: {len(web_channels.data)}')
Update Deployment Channel​
- TypeScript
- Python
const updated = await client.deploymentChannels.update({
id: 'channel_123',
channelName: 'Updated Channel Name',
recordingEnabled: false,
});
console.log('Updated channel:', updated.channelName);
from wiil.models.service_mgt import UpdateDeploymentChannel
updated = client.deployment_channels.update(
UpdateDeploymentChannel(
id='channel_123',
channel_name='Updated Channel Name',
recording_enabled=False,
)
)
print(f'Updated channel: {updated.channel_name}')
Delete Deployment Channel​
- TypeScript
- Python
// Delete channel only
const deleted = await client.deploymentChannels.delete('channel_123');
// Delete channel and associated phone configuration
const deletedWithPhone = await client.deploymentChannels.delete('channel_123', {
deletePhoneConfig: true,
});
if (deleted) {
console.log('Channel deleted successfully');
}
# Delete channel only
deleted = client.deployment_channels.delete('channel_123')
# Delete channel and associated phone configuration
deleted_with_phone = client.deployment_channels.delete(
'channel_123',
delete_phone_config=True
)
if deleted:
print('Channel deleted successfully')
Channel Type Examples​
Web Chat Widget​
- TypeScript
- Python
const webChannel = await client.deploymentChannels.create({
channelIdentifier: 'https://support.example.com',
deploymentType: DeploymentType.WEB,
channelName: 'Support Portal Chat',
recordingEnabled: true,
configuration: {
communicationType: 'unified',
widgetConfiguration: {
position: 'right',
customTheme: {
primaryColor: '#4CAF50',
fontFamily: 'Arial, sans-serif',
},
},
},
});
from wiil.models.service_mgt import CreateDeploymentChannel
from wiil.models.type_definitions import DeploymentType
web_channel = client.deployment_channels.create(
CreateDeploymentChannel(
channel_identifier='https://support.example.com',
deployment_type=DeploymentType.WEB.value,
channel_name='Support Portal Chat',
recording_enabled=True,
configuration={
'communicationType': 'unified',
'widgetConfiguration': {
'position': 'right',
'customTheme': {
'primaryColor': '#4CAF50',
'fontFamily': 'Arial, sans-serif',
},
},
},
)
)
Phone Call Channel​
- TypeScript
- Python
// First, ensure you have a phone configuration
const phoneChannel = await client.deploymentChannels.create({
channelIdentifier: '+12025551234',
deploymentType: DeploymentType.CALLS,
channelName: 'Customer Support Line',
recordingEnabled: true,
configuration: {
phoneConfigurationId: 'phone_config_123',
},
});
from wiil.models.service_mgt import CreateDeploymentChannel
from wiil.models.type_definitions import DeploymentType
# First, ensure you have a phone configuration
phone_channel = client.deployment_channels.create(
CreateDeploymentChannel(
channel_identifier='+12025551234',
deployment_type=DeploymentType.CALLS.value,
channel_name='Customer Support Line',
recording_enabled=True,
configuration={
'phoneConfigurationId': 'phone_config_123',
},
)
)
SMS Channel​
- TypeScript
- Python
const smsChannel = await client.deploymentChannels.create({
channelIdentifier: '+12025551234',
deploymentType: DeploymentType.SMS,
channelName: 'SMS Support',
recordingEnabled: true,
configuration: {
phoneConfigurationId: 'phone_config_123',
},
});
from wiil.models.service_mgt import CreateDeploymentChannel
from wiil.models.type_definitions import DeploymentType
sms_channel = client.deployment_channels.create(
CreateDeploymentChannel(
channel_identifier='+12025551234',
deployment_type=DeploymentType.SMS.value,
channel_name='SMS Support',
recording_enabled=True,
configuration={
'phoneConfigurationId': 'phone_config_123',
},
)
)
Complete Example​
Full workflow demonstrating deployment channel lifecycle:
- TypeScript
- Python
import { WiilClient, DeploymentType } from 'wiil-js';
const client = new WiilClient({
apiKey: process.env.WIIL_API_KEY!,
});
async function manageDeploymentChannels() {
// 1. Create a web deployment channel
const webChannel = await client.deploymentChannels.create({
channelIdentifier: `https://test-${Date.now()}.example.com`,
deploymentType: DeploymentType.WEB,
channelName: 'Test Web Channel',
recordingEnabled: true,
configuration: {
communicationType: 'unified',
widgetConfiguration: {
position: 'right',
customTheme: { primaryColor: '#007bff' },
},
},
});
console.log('Channel created:', webChannel.id);
// 2. Retrieve channel by ID
const retrieved = await client.deploymentChannels.get(webChannel.id);
console.log('Retrieved channel:', retrieved.channelName);
// 3. List all web channels
const webChannels = await client.deploymentChannels.listByType(DeploymentType.WEB);
console.log('Total web channels:', webChannels.meta.totalCount);
// 4. Update channel configuration
const updated = await client.deploymentChannels.update({
id: webChannel.id,
channelName: 'Updated Test Channel',
recordingEnabled: false,
});
console.log('Updated channel name:', updated.channelName);
console.log('Recording enabled:', updated.recordingEnabled);
// 5. Find channel by identifier
const found = await client.deploymentChannels.getByIdentifier(
webChannel.channelIdentifier,
DeploymentType.WEB
);
console.log('Found by identifier:', found.id);
// 6. Clean up
await client.deploymentChannels.delete(webChannel.id);
console.log('Channel deleted');
}
manageDeploymentChannels().catch(console.error);
import os
import time
from wiil import WiilClient
from wiil.models.service_mgt import (
CreateDeploymentChannel,
UpdateDeploymentChannel,
)
from wiil.models.type_definitions import DeploymentType
from wiil.types import PaginationRequest
client = WiilClient(api_key=os.environ['WIIL_API_KEY'])
def manage_deployment_channels():
timestamp = int(time.time())
# 1. Create a web deployment channel
web_channel = client.deployment_channels.create(
CreateDeploymentChannel(
channel_identifier=f'https://test-{timestamp}.example.com',
deployment_type=DeploymentType.WEB.value,
channel_name='Test Web Channel',
recording_enabled=True,
configuration={
'communicationType': 'unified',
'widgetConfiguration': {
'position': 'right',
'customTheme': {'primaryColor': '#007bff'},
},
},
)
)
print(f'Channel created: {web_channel.id}')
# 2. Retrieve channel by ID
retrieved = client.deployment_channels.get(web_channel.id)
print(f'Retrieved channel: {retrieved.channel_name}')
# 3. List all web channels
web_channels = client.deployment_channels.list_by_type(
DeploymentType.WEB.value
)
print(f'Total web channels: {web_channels.meta.total_count}')
# 4. Update channel configuration
updated = client.deployment_channels.update(
UpdateDeploymentChannel(
id=web_channel.id,
channel_name='Updated Test Channel',
recording_enabled=False,
)
)
print(f'Updated channel name: {updated.channel_name}')
print(f'Recording enabled: {updated.recording_enabled}')
# 5. Find channel by identifier
found = client.deployment_channels.get_by_identifier(
web_channel.channel_identifier,
DeploymentType.WEB.value
)
print(f'Found by identifier: {found.id}')
# 6. Clean up
client.deployment_channels.delete(web_channel.id)
print('Channel deleted')
if __name__ == '__main__':
manage_deployment_channels()
Best Practices​
-
Use descriptive channel names - Channel names appear in administrative interfaces. Use clear names that indicate the channel's purpose.
-
Enable recording for compliance - Keep recording enabled unless there's a specific reason to disable it. Recordings help with quality assurance and compliance.
-
Match channel identifier format to type - Use E.164 format for phone numbers (+12025551234), valid URLs for web channels, and package names for mobile.
-
One channel per deployment - Each deployment configuration has exactly one channel. Create separate deployments for multi-channel agents.
-
Use listByType for filtering - When you need channels of a specific type, use
listByType()for better performance.
Troubleshooting​
Invalid Channel Identifier​
Error:
- TypeScript
- Python
WiilValidationError: Invalid website URL format
WiilValidationError: Invalid website URL format
Solution: Ensure the identifier matches the expected format for the deployment type:
- TypeScript
- Python
// Web channels: valid URL
channelIdentifier: 'https://example.com' // Correct
channelIdentifier: 'example.com' // May fail validation
// Phone channels: E.164 format
channelIdentifier: '+12025551234' // Correct
channelIdentifier: '202-555-1234' // May fail validation
# Web channels: valid URL
channel_identifier = 'https://example.com' # Correct
channel_identifier = 'example.com' # May fail validation
# Phone channels: E.164 format
channel_identifier = '+12025551234' # Correct
channel_identifier = '202-555-1234' # May fail validation
Missing Phone Configuration​
Error:
- TypeScript
- Python
WiilAPIError: Phone configuration not found
WiilAPIError: Phone configuration not found
Solution: Create or reference a valid phone configuration before creating phone/SMS channels:
- TypeScript
- Python
// Ensure phone config exists
const phoneConfigs = await client.phoneConfigurations.list();
const phoneConfigId = phoneConfigs.data[0]?.id;
if (!phoneConfigId) {
throw new Error('No phone configuration available');
}
const channel = await client.deploymentChannels.create({
channelIdentifier: '+12025551234',
deploymentType: DeploymentType.CALLS,
configuration: {
phoneConfigurationId: phoneConfigId, // Must be valid
},
});
# Ensure phone config exists
phone_configs = client.phone_configurations.list()
phone_config_id = phone_configs.data[0].id if phone_configs.data else None
if not phone_config_id:
raise ValueError('No phone configuration available')
channel = client.deployment_channels.create(
CreateDeploymentChannel(
channel_identifier='+12025551234',
deployment_type=DeploymentType.CALLS.value,
configuration={
'phoneConfigurationId': phone_config_id, # Must be valid
},
)
)
Channel Already Exists​
Error:
- TypeScript
- Python
WiilAPIError: Channel identifier already in use
WiilAPIError: Channel identifier already in use
Solution: Channel identifiers must be unique per deployment type. Check for existing channels first:
- TypeScript
- Python
try {
const existing = await client.deploymentChannels.getByIdentifier(
'https://example.com',
DeploymentType.WEB
);
console.log('Channel already exists:', existing.id);
} catch (error) {
// Channel doesn't exist, safe to create
const newChannel = await client.deploymentChannels.create({...});
}
try:
existing = client.deployment_channels.get_by_identifier(
'https://example.com',
DeploymentType.WEB.value
)
print(f'Channel already exists: {existing.id}')
except Exception:
# Channel doesn't exist, safe to create
new_channel = client.deployment_channels.create(
CreateDeploymentChannel(
channel_identifier='https://example.com',
deployment_type=DeploymentType.WEB.value,
# ...
)
)