サードパーティメッセージングチャネルへのカスタムメッセージングコンポーネントの追加
AI エージェントが従来のチャットやサードパーティのメッセージングチャネルでカスタムメッセージングコンポーネント (フォームなど) を標準の応答形式と共に表示できるように、標準のメッセージング画面をカスタマイズします。
必要なエディション
| サポートされているエディションを表示する。 | |
この記事の適用対象:
|
拡張 WhatsApp、標準および拡張 Facebook Messenger、標準および拡張 SMS、拡張 Apple Messages for Business、拡張 LINE、Bring Your Own チャネル |
この記事の適用対象外:
|
拡張アプリケーション内チャットまたは拡張 Web チャットチャネル |
Agentforceの標準のメッセージング画面をカスタマイズして、AIエージェントがフォームなどのカスタム・メッセージング・コンポーネントを標準の応答形式と共に表示できるようにします。ファイルベースのメッセージング表面を置き換えるカスタムAiSurfaceを定義し、既存の標準応答形式を保持し、エージェントが使用するメッセージングコンポーネントごとに新しいAiResponseFormatエントリを追加します。
カスタムメッセージングコンポーネントを使用するケース
カスタムメッセージングコンポーネントは、従来の Salesforce チャットリリースまたはサードパーティのメッセージングチャネル (WhatsApp、Apple Messages for Business、Facebook Messenger、LINE など) を使用して顧客にサービスを提供し、エージェントがリッチでインタラクティブなコンポーネントを返すようにする場合に使用します。
カスタマイズ可能なメッセージング画面は、標準のメッセージング応答形式 (MessagingChoices、MessagingChoicesWithImages、MessagingRichLink、およびMessagingTimePicker) を保持し、それらの応答形式の上に新しいコンポーネントを追加できます。
前提条件
- Service Cloud メッセージングチャネル: カスタマイズ可能なメッセージング接続を設定する前に、従来のチャットまたはサードパーティチャネルに適切な Service Cloud メッセージングチャネルを設定します。
- メタデータ API バージョン: 取得とリリースにはバージョン 66.0 以降を使用します。
- 既存のエージェント:ファイルベースのメッセージング接続(
SurfaceAction__Messaging)を使用する Agentforce エージェント。 - メッセージングコンポーネント: 応答形式で ID または開発者名を参照できるリリース済みのメッセージングコンポーネント (フォームなど)。
操作手順
デフォルトのメッセージングサーフェスは、4 つの標準応答形式で出荷されるファイルベースサーフェス (SurfaceAction__Messaging) として提供されます。メッセージングコンポーネントを追加するには、ファイルベースの表面を、これら同じ 4 つの応答形式と新しいカスタム形式を参照するカスタマイズ可能なAiSurfaceに置き換えます。
リリース後、エージェントは選択肢、リッチリンク、時間ピッカーの標準の応答形式を使用し、その説明と手順が顧客の要求と一致する場合にカスタム形式を選択します。
カスタムメッセージングコンポーネントの設定
この構造を使用してメタデータファイルを整理し、次の手順を完了します。
metadataToDeploy/
├── package.xml
├── aiResponseFormats/
│ └── Messaging_Form_Messaging_Component.aiResponseFormat
├── aiSurfaces/
│ └── {CustomMessagingSurface}.aiSurface
└── genAiPlannerBundles/
└── {YourAgentDevName}.genAiPlannerBundleステップ 1: エージェントの GenAiPlannerBundle の取得
メタデータ API を使用してエージェントのGenAiPlannerBundleを取得します。このpackage.xmlは取得に使用します。
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>GenAiPlannerBundle</name>
</types>
<version>66.0</version>
</Package>retrieve はエージェントのGenAiPlannerBundleを返します。
metadataToDeploy/
└── genAiPlannerBundles/
└── {YourAgentDevName}.genAiPlannerBundleステップ 2: ファイルベースのメッセージングサーフェスの交換
GenAiPlannerBundleで、surface値が SurfaceAction__Messaging のplannerSurfacesエントリを見つけます。surface をカスタマイズ可能なメッセージング表面 (CustomMessagingSurface など) の一意の開発者名に変更します。surfaceType は Messaging のままにします。
<?xml version="1.0" encoding="UTF-8"?>
<GenAiPlannerBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<!-- Other agent configuration -->
<plannerSurfaces>
<adaptiveResponseAllowed>true</adaptiveResponseAllowed>
<callRecordingAllowed>false</callRecordingAllowed>
<surface>CustomMessagingSurface</surface>
<surfaceType>Messaging</surfaceType>
</plannerSurfaces>
</GenAiPlannerBundle>この変更により、ファイルベースのメッセージング表面が接続解除され、代わりにカスタマイズ可能なメッセージング表面が接続されます。
ステップ 3: カスタマイズ可能なメッセージング表面の作成
リリースバンドルにaiSurfacesフォルダを作成します。この中に、「{the_unique_dev_name_from_step_2}.aiSurface」という名前のファイルを作成します。ファイルの開発者名は、ステップ 2 で設定したsurface値と一致する必要があります。
標準のメッセージング動作が引き続き機能するように、カスタマイズ可能な表面に 4 つの標準メッセージング応答形式をすべて含める必要があります。
<?xml version="1.0" encoding="UTF-8"?>
<AiSurface xmlns="http://soap.sforce.com/2006/04/metadata">
<description>Customizable Messaging connection</description>
<instructions>
<instruction>Do not use any of the SURFACE_ACTION__* response formats when none of the instructions below are met.</instruction>
<sortOrder>1</sortOrder>
</instructions>
<instructions>
<instruction>Do not use the below instructions when the response contains more than 10 choices.</instruction>
<sortOrder>2</sortOrder>
</instructions>
<instructions>
<instruction>Do not use any of the SURFACE_ACTION__Messaging* type formatting when the response contains only a single, text-only choice and does not include images or URLs.</instruction>
<sortOrder>3</sortOrder>
</instructions>
<masterLabel>Messaging</masterLabel>
<responseFormats>
<enabled>true</enabled>
<responseFormat>SurfaceAction__MessagingChoices</responseFormat>
</responseFormats>
<responseFormats>
<enabled>true</enabled>
<responseFormat>SurfaceAction__MessagingChoicesWithImages</responseFormat>
</responseFormats>
<responseFormats>
<enabled>true</enabled>
<responseFormat>SurfaceAction__MessagingRichLink</responseFormat>
</responseFormats>
<responseFormats>
<enabled>true</enabled>
<responseFormat>SurfaceAction__MessagingTimePicker</responseFormat>
</responseFormats>
<source>SurfaceAction__Messaging</source>
<surfaceType>Messaging</surfaceType>
</AiSurface>エージェントが使用するカスタムメッセージングコンポーネントごとに、カスタムAiResponseFormatの開発者名を参照するresponseFormatsエントリを追加します。
<responseFormats>
<enabled>true</enabled>
<responseFormat>Messaging_Form_Messaging_Component</responseFormat>
</responseFormats>ステップ 4: カスタム AiResponseFormat の作成
aiResponseFormats フォルダを作成します。この中に、カスタムメッセージングコンポーネントごとに {FormatDevName}.aiResponseFormat という名前のファイルを作成します。
この例では、フォームメッセージングコンポーネントを定義します。[input] 項目は、MessageDefinitionテンプレートスキーマを使用して、リリースされたメッセージングコンポーネントを開発者名 (または ID) で参照します。エージェントが未加工の JSON を生成する代わりにテンプレートに入力するように、input_strategy を use_template に設定します。
<?xml version="1.0" encoding="UTF-8"?>
<AiResponseFormat xmlns="http://soap.sforce.com/2006/04/metadata">
<description>A response action. Use this when the user wants to create a case. The user is presented with rich UI.</description>
<input>{"template":{"messageType":"FormMessage","id":"{{ uuid4() }}","form":{"formatType":"MessageDefinition","messageDefinitionNameOrId":"Create_Case_Form"}},"input_strategy":"use_template"}</input>
<instructions>
<instruction>Always use this response format to create a case.</instruction>
<sortOrder>1</sortOrder>
</instructions>
<masterLabel>Messaging Form Messaging Component</masterLabel>
</AiResponseFormat>フォームテンプレートスキーマ
このテンプレートスキーマは、フォームメッセージングコンポーネントに使用します。AiResponseFormat の input 項目は、1 行の JSON エンコード文字列である必要があります。ここでは、読みやすくするために展開したバージョンのみを示しています。
{
"template": {
"messageType": "FormMessage",
"id": "{{ uuid4() }}",
"form": {
"formatType": "MessageDefinition",
"messageDefinitionNameOrId": "Create_Case_Form"
}
},
"input_strategy": "use_template"
}| 項目 | 説明 |
|---|---|
template.messageType |
メッセージングコンポーネント種別。フォームコンポーネントには FormMessage を使用します。 |
template.id |
メッセージの一意の識別子。実行時に {{ uuid4() }} を使用して生成します。 |
template.form.formatType |
コンポーネントの参照種別。MessageDefinition を使用して、リリースされたメッセージングコンポーネントを参照します。 |
template.form.messageDefinitionNameOrId |
エージェントに表示されるリリース済みメッセージングコンポーネントの ID または開発者名。コンポーネントの値に置き換えます。 |
input_strategy |
エージェントが未加工の JSON を生成する代わりにテンプレートに入力するように use_template に設定します。 |
ステップ 5: package.xml ファイルを作成する
リリースバンドルのルートに、3 つのメタデータ型すべてを宣言するpackage.xmlファイルを作成します。
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>AiResponseFormat</name>
</types>
<types>
<members>*</members>
<name>AiSurface</name>
</types>
<types>
<members>*</members>
<name>GenAiPlannerBundle</name>
</types>
<version>66.0</version>
</Package>ステップ 6: リリース
Salesforce CLI を使用してメタデータをリリースします。
sf project deploy start --manifest metadataToDeploy/package.xml任意のメタデータ API ツールを使用してリリースすることもできます。段階的にリリースする場合は、AiSurfaceエンティティの前にAiResponseFormatエンティティをリリースします。これは、表面が応答形式を参照するためです。



