← 功能概覽← Feature Overview Twilio 系列 · 2 / 2 · 完整參考Twilio Series · 2 / 2 · Complete Reference

Twilio 開發者
平台完整參考

Twilio Developer
Platform Reference

Twilio 開發者文檔、API 參考、程式碼範例與 SDK 庫的完整本地鏡像。

Complete local mirror of all Twilio developer documentation, API references, code examples, and SDK libraries.

6,986
Doc Pages
文檔頁面
40
GitHub Repos
GitHub 庫
54
OpenAPI Specs
API 規格
7
SDK Languages
語言 SDK
702MB
Total Size
總大小
2,573
Error Codes
錯誤碼
來源Source 頁數Pages 狀態Status
llms.txt 精選文檔llms.txt curated docs1,399100%
Sitemap 額外頁面Sitemap extra pages3,01499.9%
API 錯誤碼參考API error codes2,573100%

語音、訊息、視頻與電子郵件

Voice, Messaging, Video & Email

Voice API

全球撥打、接聽與控制電話。基於 TwiML 的 XML 呼叫控制指令,支援 IVR、錄音、會議與即時媒體串流。

Make, receive, and control phone calls globally. TwiML-based call control with XML verbs for IVR, recording, conferencing, and real-time media streams.

  • TwiML 指令 — Say、Play、Gather、Record、Dial、Connect、Stream
  • WebRTC JS SDK — 瀏覽器內語音通話(576+ 星)
  • SIP 中繼 — 彈性 SIP,27 頁設定文檔
  • 通話錄音 — 雙聲道錄音、即時轉錄
  • 媒體串流 — 透過 WebSocket 取得原始音訊,供 AI 處理
  • ConversationRelay — 即時語音轉文字/文字轉語音,用於語音 AI 代理
  • TwiML Verbs — Say, Play, Gather, Record, Dial, Connect, Stream
  • WebRTC JS SDK — Browser-based calling (576+ stars)
  • SIP Trunking — Elastic SIP with 27 configuration pages
  • Call Recording — Dual-channel, real-time transcription
  • Media Streams — Raw audio via WebSocket for AI processing
  • ConversationRelay — Real-time STT/TTS for voice AI agents
270 pages31 API endpoints

短訊、多媒體訊息與 WhatsApp

SMS, MMS & WhatsApp

透過 SMS、MMS 和 WhatsApp 商業平台在全球收發訊息,支援範本、媒體和投遞追蹤。

Send and receive text messages globally via SMS, MMS, and WhatsApp Business Platform with templates, media, and delivery tracking.

  • 可程式化 SMS — 全球收發,含投遞回執
  • WhatsApp Business — 範本、媒體、互動式訊息
  • Content API — 卡片、輪播、快速回覆、位置
  • A2P 10DLC — 美國合規品牌/活動註冊
  • Sender Pools — 多號碼智慧發送
  • Programmable SMS — Global send/receive with delivery receipts
  • WhatsApp Business — Templates, media, interactive messages
  • Content API — Cards, carousels, quick replies, location
  • A2P 10DLC — US compliance brand/campaign registration
  • Sender Pools — Multi-number intelligent sending
145 pages30+ content types

全渠道聊天

Omnichannel Chat

跨 SMS、WhatsApp、聊天和 Facebook Messenger 的統一多方訊息。單一 API 管理所有渠道。

Unified multi-party messaging across SMS, WhatsApp, chat, and Facebook Messenger. Single API for all channels.

  • Conversations API — v1 REST API,含參與者和訊息管理
  • Webchat 組件 — 可嵌入式 React 組件(v3.x)
  • Proxy — 號碼遮蔽通訊
  • Chat SDK — 舊版 v1、v2、v3,共 78 頁
  • Conversations API — v1 REST API with participants, messages
  • Webchat Widget — Embeddable React component (v3.x)
  • Proxy — Masked number communication
  • Chat SDK — Legacy v1, v2, v3 with 78 pages
79 pages4 channels

可程式化視頻

Programmable Video

基於 WebRTC 的視頻房間,支援錄影、合成與螢幕分享。提供 Web、iOS 和 Android SDK。

WebRTC-based video rooms with recording, composition, and screen sharing. SDKs for Web, iOS, and Android.

86 pages3 platform SDKs

電子郵件投遞平台

Email Delivery Platform

交易型與行銷郵件,含動態範本、分析、投遞工具與 IP 管理。

Transactional and marketing email with templates, analytics, deliverability tools, and IP management.

864 pages66 API refs

客戶數據平台

Customer Data Platform

收集、清理與控制客戶數據。604 個目標連接器,135 個雲端應用來源。

Collect, clean, and control customer data. 604 destination connectors, 135 cloud app sources.

1,226 pages739 connectors
發送 SMS — PythonSend SMS — Python
from twilio.rest import Client

client = Client("ACCOUNT_SID", "AUTH_TOKEN")
message = client.messages.create(
    body="Hello from Twilio!",
    from_="+15551234567",
    to="+15559876543"
)
print(message.sid)
TwiML Voice Response
<Response>
  <Say voice="alice">
    Welcome! Press 1 for sales.歡迎!按 1 聯繫銷售。
  </Say>
  <Gather numDigits="1"
    action="/handle-key">
    <Play>/audio/menu.mp3</Play>
  </Gather>
</Response>

語音 AI、助理與分析

Voice AI, Assistants & Analytics

ConversationRelay

基於 WebSocket 的即時語音轉文字/文字轉語音框架,用於建構 AI 語音代理。處理會話管理、低延遲通訊和中斷偵測。

WebSocket-based real-time STT/TTS for building AI voice agents. Handles session management, low-latency communication, and interruption detection.

  • STT/TTS — 內建語音辨識與合成
  • WebSocket API — 雙向即時通訊
  • Studio 組件 — 視覺化建構器整合
  • X-Twilio-Signature — WebSocket 握手驗證
  • STT/TTS — Built-in speech recognition & synthesis
  • WebSocket API — Bidirectional real-time communication
  • Studio Widget — Visual builder integration
  • X-Twilio-Signature — WebSocket handshake validation
GA

AI 助理

AI Assistants

LLM 驅動的助理,含知識庫、自訂工具、對話歷史與安全護欄。

LLM-powered assistants with knowledge bases, custom tools, conversation history, and guardrails.

  • Knowledge API — 上傳文件、分塊檢索
  • Tools API — 自訂函式呼叫
  • Sessions — 對話歷史管理
  • Policies — 安全護欄與內容過濾
  • Knowledge API — Upload documents, chunk retrieval
  • Tools API — Custom function calling
  • Sessions — Conversation history management
  • Policies — Guardrails and content filtering
Alpha

對話智慧分析

Conversational Intelligence

AI 通話分析 — 語言運算子對對話進行分類、摘要和洞察提取。共 24 頁文檔。

AI analysis of calls — Language Operators classify, summarize, and extract insights from conversations. 24 pages.

24 pages

客服 AI 助手

Agent Copilot

AI 驅動的即時建議、自動結案摘要與客戶檔案充實,為客服人員提供智慧輔助。

AI-powered real-time suggestions, auto-generated wrap-up notes, and customer profile enrichment for agents.

Public Beta
ConversationRelay + OpenAI — Node.js
// WebSocket handler for ConversationRelay
wss.on('connection', (ws) => {
  ws.on('message', async (data) => {
    const msg = JSON.parse(data);
    if (msg.type === 'prompt') {
      const res = await openai.chat.completions.create({
        model: 'gpt-4o',
        messages: [{ role: 'user', content: msg.voicePrompt }]
      });
      ws.send(JSON.stringify({
        type: 'text',
        token: res.choices[0].message.content
      }));
    }
  });
});

可程式化聯絡中心(368 頁文檔)

Programmable Contact Center (368 pages)

管理員與終端用戶功能

Admin & End-User Features

  • 多渠道 — 語音、SMS、WhatsApp、Email、Webchat、FB Messenger
  • 暖/冷轉接 — 客服人員間的轉接
  • Flex Insights — KPI 儀表板、對話評分、工作負載分析
  • 即時監控 — 客服遵守度、佇列統計
  • SSO 整合 — Okta、Azure AD、Google、Auth0、Salesforce
  • Email 渠道 — 完整 HTML 郵件,含 IP 預熱、網域驗證
  • 品質管理 — 問卷、評估、評分
  • Flex 行動端 — iOS 和 Android 客服 App(公開測試版)
  • Multi-channel — Voice, SMS, WhatsApp, Email, Webchat, FB Messenger
  • Warm/Cold Transfer — Agent-to-agent handoffs
  • Flex Insights — KPI dashboards, conversation scoring, workload analytics
  • Real-time Monitoring — Agent adherence, queue statistics
  • SSO Integration — Okta, Azure AD, Google, Auth0, Salesforce
  • Email Channel — Full HTML email with IP warmup, domain auth
  • Quality Management — Questionnaires, assessments, scoring
  • Flex Mobile — iOS & Android agent app (public beta)

開發者與外掛系統

Developer & Plugin System

  • 外掛架構 — React 為基礎的 v1 和 v2,CLI 部署
  • Flex SDK — 用戶、團隊、權杖 REST API(公開測試版)
  • TaskRouter — 技能導向路由,168 頁文檔
  • Interactions API — 建立、路由、轉接互動
  • UI 可程式化 — 組件、動作、Redux、主題、Paste 設計系統
  • Configuration API — 執行階段設定管理
  • 整合 — Salesforce、Zendesk、Calabrio、Veridas、Puzzel
  • 統一客戶檔案 — 客戶數據充實(公開測試版)
  • Plugin Architecture — React-based v1 & v2, CLI deploy
  • Flex SDK — REST APIs for users, teams, tokens (public beta)
  • TaskRouter — Skills-based routing, 168 pages
  • Interactions API — Create, route, transfer interactions
  • UI Programmability — Components, actions, Redux, theming, Paste
  • Configuration API — Runtime config management
  • Integrations — Salesforce, Zendesk, Calabrio, Veridas, Puzzel
  • Unified Profiles — Customer data enrichment (public beta)

無伺服器、工作流與開發者工具

Serverless, Studio & Developer Tools

Twilio Functions

無伺服器 Node.js 執行環境。無需管理伺服器即可部署程式碼。含靜態檔案託管。

Serverless Node.js execution. Deploy code without servers. Includes Assets for static hosting.

64 pages

Studio

拖放式視覺化工作流建構器,支援 IVR、訊息和 ConversationRelay。26 種組件類型。

Drag-and-drop visual flow builder for IVR, messaging, and ConversationRelay. 26 widget types.

65 pages26 widgets

Event Streams

跨所有 Twilio 產品的統一事件管線。接入網路上的每個互動。

Unified event pipeline across all Twilio products. Tap into every interaction on the network.

70 pages

TaskRouter

基於屬性的任務路由引擎。技能、佇列、工作流與活動管理。

Attribute-based task routing engine. Skills, queues, workflows, and activity management.

168 pages

Twilio CLI

管理 Twilio 資源的命令列介面。支援外掛、設定檔與自動化。

Command-line interface for managing Twilio resources. Plugins, profiles, and automation.

23 pages

Sync

即時狀態同步。跨裝置的文件、清單、映射和訊息串流。

Real-time state synchronization. Documents, lists, maps, and message streams across devices.

39 pages

驗證、Authy 與欺詐防範

Verify, Authy & Fraud Prevention

Verify API

透過 SMS、語音、Email、WhatsApp 和 TOTP 進行電話驗證。內建速率限制與欺詐偵測。

Phone verification via SMS, Voice, Email, WhatsApp, and TOTP. Rate limiting and fraud detection built in.

95 pages

Authy

雙因素驗證與無密碼登入。推播、TOTP、SMS 和語音渠道。

Two-factor authentication and passwordless login. Push, TOTP, SMS, and Voice channels.

73 pages

Lookup API

電話號碼情報:運營商、類型、來電者姓名、SIM 卡交換偵測。

Phone number intelligence: carrier, type, caller name, SIM swap detection.

24 pages

欺詐防範

Fraud Prevention

地理權限、安全名單 API、防欺詐指南、IRSF 國際電信欺詐防範。

Geographic permissions, Safe List API, anti-fraud guide, IRSF toll-fraud prevention.

15+ guides

平台架構總覽

Platform Architecture Overview

graph TB
  subgraph CL["Client Layer"]
    WEB["Web App"]
    MOB["Mobile App"]
    SRV["Server"]
  end
  subgraph API["Twilio APIs"]
    REST["REST API"]
    SDK["SDKs (7 langs)"]
    WH["Webhooks"]
    WS["WebSocket"]
  end
  subgraph COMM["Communications"]
    VOICE["Voice"]
    MSG["Messaging"]
    VID["Video"]
    CONV["Conversations"]
    SG["SendGrid"]
  end
  subgraph AIML["AI & Intelligence"]
    CR["ConversationRelay"]
    ASST["AI Assistants"]
    CI["Conv. Intelligence"]
  end
  subgraph CC["Flex Contact Center"]
    FLEX["Flex UI"]
    TR["TaskRouter"]
    INS["Insights"]
  end
  subgraph PLAT["Platform"]
    FN["Functions"]
    STU["Studio"]
    EVT["Events"]
    SEG["Segment"]
  end
  subgraph SEC["Security"]
    VER["Verify"]
    AUTH["Authy"]
    LOOK["Lookup"]
  end
  CL --> API
  API --> COMM
  API --> AIML
  API --> CC
  API --> PLAT
  API --> SEC
  VOICE --> CR
  CR --> ASST
  ASST --> CI

  classDef c1 fill:#a8552e22,stroke:#a8552e,stroke-width:2px
  classDef c2 fill:#7a352b22,stroke:#7a352b,stroke-width:2px
  classDef c3 fill:#3a5a4022,stroke:#3a5a40,stroke-width:2px
  classDef c4 fill:#9c7b3022,stroke:#9c7b30,stroke-width:2px
  classDef c5 fill:#4a7c6f22,stroke:#4a7c6f,stroke-width:2px
  classDef c6 fill:#5a6e8a22,stroke:#5a6e8a,stroke-width:2px
  classDef c7 fill:#6a5c8a22,stroke:#6a5c8a,stroke-width:2px
  class WEB,MOB,SRV c1
  class REST,SDK,WH,WS c2
  class VOICE,MSG,VID,CONV,SG c3
  class CR,ASST,CI c4
  class FLEX,TR,INS c5
  class FN,STU,EVT,SEG c6
  class VER,AUTH,LOOK c7
    

官方 SDK 與 54 個 API 規格文件

Official SDKs & 54 API Specifications

語言Language Repository Stars Size 主要功能Key Features
Pythontwilio-python2,04923MBREST API、TwiML 生成、異步、型別提示REST API, TwiML gen, async, type hints
PHPtwilio-php1,63222MBREST API、TwiML、Composer 套件REST API, TwiML, Composer package
Node.jstwilio-node1,52117MBREST API、TwiML、Webhook 驗證REST API, TwiML, webhook validation
Rubytwilio-ruby1,37718MBREST API、TwiML、Rack 中介軟體REST API, TwiML, Rack middleware
C#/.NETtwilio-csharp71022MBREST API、TwiML、ASP.NET 輔助工具REST API, TwiML, ASP.NET helpers
Javatwilio-java52219MBREST API、TwiML、Maven 套件REST API, TwiML, Maven artifact
Gotwilio-go36624MBREST API、由 OpenAPI 自動生成REST API, auto-generated from OpenAPI

OpenAPI 規格文件(54 個 API)

OpenAPI Specifications (54 APIs)

JSON + YAML Specs
twilio_accounts_v1    twilio_api_v2010      twilio_assistants_v1
twilio_bulkexports_v1 twilio_chat_v1/v2/v3  twilio_content_v1/v2
twilio_conversations  twilio_events_v1      twilio_flex_v1/v2
twilio_iam_v1         twilio_insights_v1    twilio_intelligence_v2
twilio_knowledge_v1   twilio_lookups_v1/v2  twilio_marketplace_v1
twilio_messaging_v1/v2/v3  twilio_monitor_v1/v2  twilio_notify_v1
twilio_numbers_v1/v2  twilio_pricing_v1/v2  twilio_proxy_v1
twilio_routes_v2      twilio_serverless_v1  twilio_studio_v1/v2
twilio_supersim_v1    twilio_sync_v1        twilio_taskrouter_v1
twilio_trunking_v1    twilio_trusthub_v1    twilio_verify_v2
twilio_video_v1       twilio_voice_v1       twilio_wireless_v1

範例庫與範本(40 個 GitHub 庫)

Sample Repos & Templates (40 GitHub repos)

Repository 說明Description Stars Size
sample-code所有產品的官方程式碼範例Official samples for all products49MB
api-snippets多語言 API 程式碼片段Multi-language API code snippets37MB
function-templates無伺服器函式範本Serverless function templates40131MB
call-gptGenAI 電話工具組GenAI phone call toolkit485580K
speech-assistant-*-nodeOpenAI 即時 API + ConversationRelayOpenAI Realtime + ConversationRelay352176K
speech-assistant-*-python同上,Python 版本Same as above, Python344176K
live-translation-openaiFlex 即時語音翻譯Real-time voice translation for Flex1221.1MB
mcp所有 Twilio API 作為 MCP 工具All Twilio APIs as MCP tools961.1MB
pasteTwilio 設計系統(React)Twilio design system (React)473235MB
twilio-oai54 個 OpenAPI 規格(JSON + YAML)54 OpenAPI specs (JSON + YAML)15920MB
serverless-toolkitFunctions 開發 CLI 工具CLI for Functions development1272.6MB
ai-assistants-samplesAI 助理快速開始範例AI Assistants quickstart28600K

多區域與邊緣網路(35 頁文檔)

Multi-Region & Edge Network (35 pages)

基礎設施

Infrastructure

  • 區域 API — 美國(維吉尼亞)、歐盟(愛爾蘭)、澳洲(雪梨)
  • 邊緣節點 — 全球低延遲媒體處理
  • SIP 在地化 — 區域化 SIP URI
  • 防火牆設定 — 信令與媒體的 IP 範圍和連接埠
  • 區域遷移 — 最佳實踐指南
  • Interconnect — 私有網路連接
  • Regional APIs — US (Virginia), EU (Ireland), AU (Sydney)
  • Edge Locations — Global low-latency media processing
  • SIP Localization — Regional SIP URIs
  • Firewall Config — IP ranges, ports for signaling & media
  • Region Migration — Best practices guides
  • Interconnect — Private network connections

其他資源

Additional Resources

  • 詞彙表 — 118 個術語定義(VoIP、SIP、DTMF 等)
  • Webhooks — 安全、驗證、除錯指南
  • Usage API — 帳單記錄、觸發器、批量匯出
  • IAM — 身份與存取管理(50 頁)
  • Phone Numbers — 號碼管理、攜號轉移、法規(45 頁)
  • Notify — 推播通知(20 頁)
  • Glossary — 118 term definitions (VoIP, SIP, DTMF, etc.)
  • Webhooks — Security, validation, debugging guides
  • Usage API — Billing records, triggers, bulk exports
  • IAM — Identity & access management (50 pages)
  • Phone Numbers — Management, porting, regulatory (45 pages)
  • Notify — Push notifications (20 pages)