コンタクト センター AI プラットフォーム(CCAI プラットフォーム)は、アウトバウンド SMS エンドポイントを SMS チャネルに提供します。
アウトバウンド SMS
| パラメータ | 必須 | データ型 | 定義 | |
|---|---|---|---|---|
| chat_type | TRUE | 文字列 | 作成するチャットの種類。現時点では、「Messaging(API)」と「SMS」(非推奨)を使用できます。 | Messaging(API) |
| end_user_number | TRUE | 文字列 | テキスト メッセージの送信先の番号 | `{end_user_number}` |
| outbound_number | TRUE | 文字列 | SMS メッセージの送信に使用するアウトバウンド電話番号 | `{outbound_number}` |
| message | 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"
}
レスポンス: 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
エラー : 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
エラー : アウトバウンド 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": "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
エラー : メッセージが必要です
この例では、メッセージが指定されていないが必須である場合の失敗シナリオを示します。
リクエスト
ヘッダー:
| キー | 値 | 説明 |
|---|---|---|
| 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