コンタクト センター AI プラットフォーム(CCAI プラットフォーム)は、SMS チャネルのアウトバウンド SMS エンドポイントを提供します。
アウトバウンド SMS
| パラメータ | 必須 | データ型 | 定義 | |
|---|---|---|---|---|
| chat_type | TRUE | 文字列 | 作成するチャットのタイプ。「メッセージ(API)」、「SMS」(非推奨)は現在利用可能です | メッセージ(API) |
| end_user_number | TRUE | 文字列 | テキスト メッセージの送信先番号 | `{end_user_number}` |
| outbound_number | TRUE | 文字列 | SMS メッセージの送信に使用する発信電話番号 | `{outbound_number}` |
| メッセージ | TRUE | 文字列 | お客様に送信される SMS メッセージ | `{message}` |
| ticket_id | FALSE | 文字列 | セッションに関連付けられる CRM チケット ID | `{ticket_id}` |
エンドポイント:
Method: POST
Type: RAW
URL: https://{{subdomain}}.{{domain}}/apps/api/v1/sms
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
リクエストとレスポンスの例
以降のセクションでは、エンドポイントに対するリクエストの例を示します。
チケット ID を含む送信 SMS チャットを作成する
この例では、チケット ID に関連付けられたエンドユーザーに送信 SMS を作成する方法を示します。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: ticket_id を使用してアウトバウンド SMS チャットを作成する
{
"id": 114,
"lang": "en",
"chat_type": "Messaging (SMS)",
"status": "selecting",
"created_at": "2021-10-04T17:20:51.000Z",
"queued_at": null,
"assigned_at": null,
"ends_at": null,
"wait_duration": 0,
"chat_duration": 0,
"rating": null,
"has_feedback": false,
"out_ticket_id": null,
"out_ticket_url": null,
"verified": false,
"disconnected_by": "disconnected_by_unknown",
"fail_reason": null,
"selected_menu": null,
"menu_path": null,
"agent_info": null,
"end_user": {
"id": 87,
"identifier": null,
"out_contact_id": null
},
"photos": [],
"videos": [],
"transfers": [],
"participants": [
{
"id": 205,
"type": "end_user",
"status": "connected",
"chat_id": 114,
"user_id": null,
"end_user_id": 87,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:51.000Z",
"ended_at": null,
"fail_reason": "nothing"
}
],
"offer_type": null,
"offer_events": [],
"answer_type": "manual",
"outbound_number": "+16285550199"
}
ステータス コード: 200
アウトバウンド SMS チャットを作成し、エージェント ID を使用してエージェントに割り当てる
この例では、指定されたエージェント ID に基づいてエージェントに割り当てられるアウトバウンド SMS を作成する方法を示します。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"agentId": 1
}
レスポンス: アウトバウンド SMS チャットを作成し、agentId を使用してエージェントに割り当てる
{
"id": 114,
"lang": "en",
"chat_type": "Messaging (SMS)",
"status": "assigned",
"created_at": "2021-10-04T17:20:51.000Z",
"queued_at": null,
"assigned_at": "2021-10-04T17:20:53.000Z",
"ends_at": null,
"wait_duration": 0,
"chat_duration": 0,
"rating": null,
"has_feedback": false,
"out_ticket_id": null,
"out_ticket_url": null,
"verified": false,
"disconnected_by": "disconnected_by_unknown",
"fail_reason": null,
"selected_menu": null,
"menu_path": null,
"agent_info": {
"id": 1,
"agent_number": 9,
"email": "john.doe@foo.com",
"name": "John Doe",
"first_name": "John",
"last_name": "Doe",
"avatar_url": "https://foobar.com/johndoe"
},
"end_user": {
"id": 87,
"identifier": null,
"out_contact_id": null
},
"photos": [],
"videos": [],
"transfers": [],
"participants": [
{
"id": 205,
"type": "end_user",
"status": "connected",
"chat_id": 114,
"user_id": null,
"end_user_id": 87,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:51.000Z",
"ended_at": null,
"fail_reason": "nothing"
},
{
"id": 206,
"type": "agent",
"status": "connected",
"chat_id": 114,
"user_id": 1,
"end_user_id": null,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:53.000Z",
"ended_at": null,
"fail_reason": "nothing"
}
],
"offer_type": null,
"offer_events": [],
"answer_type": "manual",
"outbound_number": "+16285550199"
}
ステータス コード: 200
アウトバウンド SMS チャットを作成してエージェントのメールアドレスに割り当てる
この例では、エージェントのメールアドレスに基づいて、アウトバウンド SMS チャット セッションを作成してエージェントに関連付ける方法を示します。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"agentEmail": "john.doe@foo.com"
}
レスポンス: アウトバウンド SMS チャットを作成し、agentId を使用してエージェントに割り当てる
{
"id": 114,
"lang": "en",
"chat_type": "Messaging (SMS)",
"status": "assigned",
"created_at": "2021-10-04T17:20:51.000Z",
"queued_at": null,
"assigned_at": "2021-10-04T17:20:53.000Z",
"ends_at": null,
"wait_duration": 0,
"chat_duration": 0,
"rating": null,
"has_feedback": false,
"out_ticket_id": null,
"out_ticket_url": null,
"verified": false,
"disconnected_by": "disconnected_by_unknown",
"fail_reason": null,
"selected_menu": null,
"menu_path": null,
"agent_info": null,
"end_user": {
"id": 87,
"identifier": null,
"out_contact_id": null
},
"photos": [],
"videos": [],
"transfers": [],
"participants": [
{
"id": 205,
"type": "end_user",
"status": "connected",
"chat_id": 114,
"user_id": null,
"end_user_id": 87,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:51.000Z",
"ended_at": null,
"fail_reason": "nothing"
},
{
"id": 206,
"type": "agent",
"status": "connected",
"chat_id": 114,
"user_id": 1,
"end_user_id": null,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:53.000Z",
"ended_at": null,
"fail_reason": "nothing"
}
],
"offer_type": null,
"offer_events": [],
"answer_type": "manual",
"outbound_number": "+16285550199"
}
ステータス コード: 200
チケット ID なしでアウトバウンド SMS チャットを作成する
この例では、チケット ID に関連付けずに送信 SMS を作成する方法を示します。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
回答: チケット ID なしでアウトバウンド SMS チャットを作成する
{
"id": 114,
"lang": "en",
"chat_type": "Messaging (SMS)",
"status": "selecting",
"created_at": "2021-10-04T17:20:51.000Z",
"queued_at": null,
"assigned_at": null,
"ends_at": null,
"wait_duration": 0,
"chat_duration": 0,
"rating": null,
"has_feedback": false,
"out_ticket_id": null,
"out_ticket_url": null,
"verified": false,
"disconnected_by": "disconnected_by_unknown",
"fail_reason": null,
"selected_menu": null,
"menu_path": null,
"agent_info": null,
"end_user": {
"id": 87,
"identifier": null,
"out_contact_id": null
},
"photos": [],
"videos": [],
"transfers": [],
"participants": [
{
"id": 205,
"type": "end_user",
"status": "connected",
"chat_id": 114,
"user_id": null,
"end_user_id": 87,
"chat_duration": null,
"connected_at": "2021-10-04T17:20:51.000Z",
"ended_at": null,
"fail_reason": "nothing"
}
],
"offer_type": null,
"offer_events": [],
"answer_type": "manual",
"outbound_number": "+16285550199"
}
ステータス コード: 200
エラー : chat_type を指定する必要があります
この例は、'chat_type' が指定されていないが必須である場合の失敗シナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : chat_type を指定する必要があります
{
"message": "chat_type needs to be provided"
}
ステータス コード: 400
エラー : 有効なチャットタイプを指定する必要があります
この例は、チャットタイプを指定する必要があるにもかかわらず指定されていない場合の失敗シナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "In-app",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : 有効なチャットタイプを指定する必要があります
{
"message": "valid chat type needs to be provided"
}
ステータス コード: 400
エラー : SMS が有効になっていません
この例は、アウトバウンド SMS が開始されたが SMS が有効になっていないという失敗シナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : SMS が有効になっていません
{
"message": "SMS is not enabled"
}
ステータス コード: 400
エラー : Outbound SMS is not enabled
この例は、SMS セッションが開始されたものの、SMS チャネルが有効になっていないために失敗するシナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: Error : Outbound SMS is not enabled
{
"message": "Outbound SMS is not enabled"
}
ステータス コード: 400
エラー : エンドユーザー番号が必要です
この例は、エンドユーザー番号が指定されていないが、指定が必要な場合の失敗シナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : end_user_number が必要です
{
"message": "end_user_number is required"
}
ステータス コード: 400
エラー : エンドユーザーの番号が無効です
この例は、指定されたエンドユーザー番号が無効な場合の失敗シナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "12345",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : end_user_number が無効です
{
"message": "end_user_number is invalid"
}
ステータス コード: 400
エラー : 米国以外の電話番号は使用できません
この例は、指定された番号が米国の電話番号ではなく、禁止されている場合の失敗シナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+82 000-000-0000",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : 米国以外の電話番号は使用できません
{
"message": "Non-US phone number not allowed"
}
ステータス コード: 400
エラー : 発信番号は必須です
この例は、発信番号が指定されていないが、指定が必要な障害シナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : outbound_number が必要です
{
"message": "outbound_number is required"
}
ステータス コード: 400
エラー : 発信番号が無効です
この例は、指定された発信番号が無効な場合の失敗シナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "12345",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : outbound_number が無効です
{
"message": "outbound_number is invalid"
}
ステータス コード: 400
エラー : outbound_number が見つかりません
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : outbound_number が見つかりません
{
"message": "outbound_number is not found"
}
ステータス コード: 400
エラー : メッセージは必須です
この例は、メッセージが requires で提供されていないが、必須であるという失敗シナリオを示しています。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "",
"ticket_id": "5006x00000XXxxxXXX"
}
レスポンス: エラー : メッセージは必須です
{
"message": "message is required"
}
ステータス コード: 400
エラー : アウトバウンド SMS が失敗しました。コンシューマーはすでにアクティブな SMS セッションに参加しています。
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| Content-Type | application/json |
本文:
{
"chat_type": "Messaging (SMS)",
"end_user_number": "+1 415-555-0100",
"outbound_number": "+1 628-555-0199",
"message": "lorem ipsum",
"ticket_id": "5006x00000XXxxxXXX"
}
回答: エラー : アウトバウンド SMS を送信できませんでした。コンシューマーはすでにアクティブな SMS セッションに参加しています。
{
"message": "Outbound SMS failed. Consumer is already in an active SMS session."
}
ステータス コード: 400