メインコンテンツへスキップ

Documentation Index

Fetch the complete documentation index at: https://docs.oneinbox.ai/llms.txt

Use this file to discover all available pages before exploring further.

Twilio、Tenyx など 任意のテレフォニーキャリア実際の電話番号に発信・着信する方法です。先に クイックスタート を完了し、動作する agent_idapi_key を用意してください。 完了時: エージェントが顧客に発信(アウトバウンド)し、所有番号への着信に応答(インバウンド)できます。

概要

このガイドで行うこと:
  • テレフォニーインテグレーションを OneInbox に保存
  • 電話番号を検索・登録(インバウンド)
  • POST /v1/callsアウトバウンド発信

前提条件

項目取得先用途
api_keyダッシュボードAPI 認証
agent_idクイックスタート通話中のエージェント
キャリアアカウントTwilio、Tenyx 等電話網
キャリア認証情報各キャリアのコンソールPOST /v1/credentials

アウトバウンド vs インバウンド

種類誰が誰にかけるセットアップ
アウトバウンドエージェントが顧客に発信ステップ 4 — POST /v1/calls
インバウンド顧客が自社番号に発信ステップ 2–3 — 検索 + 登録

1

1. テレフォニーインテグレーションを追加

目的

キャリアの認証情報を OneInbox に保存します。
curl -X POST https://api.oneinbox.ai/v1/credentials \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Telephony",
    "provider": "twilio",
    "api_key": "<your_carrier_api_key_or_auth_token>"
  }'
providerapi_key をキャリアに合わせて変更 — 例: twilio + Auth Token、tenyx + Tenyx API キー。
{
  "id": "cred_telephony_abc123",
  "name": "Production Telephony",
  "provider": "twilio"
}
2

2. 利用可能な番号を検索

目的

登録可能な番号の一覧を取得します。アウトバウンドのみで既に from_number がある場合はスキップ可。検索に対応するキャリア(Twilio 等):
curl "https://api.oneinbox.ai/v1/phone-numbers/search?country=US&area_code=415&limit=10&credential_id=<telephony_integration_id>" \
  -H "Authorization: Bearer <api_key>"
クエリパラメータ意味
countryISO 国コード: USGBIN
area_code任意 — 市外局番でフィルタ
contains任意 — 番号内の桁パターン
credential_idステップ 1 のテレフォニーインテグレーション ID
検索非対応のキャリアは、コンソールで取得済みの番号をステップ 3 へ。
3

3. 番号を登録(インバウンド)

目的

この番号へのインバウンド着信をエージェントにルーティングします。オプション A — インテグレーション ID(Twilio 等):
curl -X POST https://api.oneinbox.ai/v1/phone-numbers \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+14155551234",
    "friendly_name": "Support Line",
    "provider": "twilio",
    "agent_id": "<agent_id>",
    "credential_id": "<telephony_integration_id>"
  }'
オプション B — SIP トランク(Tenyx 等、SIP 対応キャリア):
curl -X POST https://api.oneinbox.ai/v1/phone-numbers \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+14155551234",
    "friendly_name": "Support Line",
    "provider": "twilio",
    "agent_id": "<agent_id>",
    "provider_config": {
      "trunk_address": "your-carrier.pstn.example.com",
      "auth_username": "<sip_username>",
      "auth_password": "<sip_password>"
    }
  }'
provider はキャリアの値に設定 — 電話番号登録 を参照。
4

4. アウトバウンド発信

目的

エージェントが電話番号に発信し、会話を開始します。
curl -X POST https://api.oneinbox.ai/v1/calls \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "<agent_id>",
    "to_number": "+919876543210",
    "from_number": "+15739693824",
    "variables": { "customer_name": "Sam", "order_id": "ORD-001" },
    "webhook_url": "https://example.com/per-call-webhook"
  }'
フィールド必須説明
to_numberはいE.164 形式
from_numberはい登録済みキャリア番号
variablesいいえ通話ごとのプロンプトコンテキスト
webhook_urlいいえこの通話だけ Webhook を上書き
{
  "id": "call_xyz789",
  "status": "initiated",
  "to_number": "+919876543210",
  "from_number": "+15739693824"
}

通話を確認

curl https://api.oneinbox.ai/v1/calls/<call_id> \
  -H "Authorization: Bearer <api_key>"
"status": "completed" になるまで待ち、transcript を確認。

トラブルシューティング

問題原因対処
401トークン誤りダッシュボードの api_key を使用
番号が無効形式E.164: +14155551234
国際発信失敗キャリアの地域設定キャリアコンソールでアウトバウンドを有効化
インバウンドでエージェントなし登録正しい agent_id でステップ 3 をやり直し
キャリア認証情報が無効キーまたはトークン誤りステップ 1 でインテグレーションを再作成

次のステップ

インテグレーション

テレフォニーと BYOK

Webhook

通話イベント

エージェント

音声と挙動の調整

API リファレンス

アウトバウンドの全オプション