SetDialogflowResponse ポリシー

このページは ApigeeApigee ハイブリッドに適用されます。

Apigee Edge のドキュメントを表示する。

ポリシー アイコン

概要

SetDialogflowResponse ポリシーを使用すると、Dialogflow と Apigee を簡単に統合できます。詳細については、Apigee と Contact Center AI の統合をご覧ください。

SetDialogflowResponse ポリシーでは、バックエンド システムからのレスポンス データを処理およびフォーマットしてから、データを WebhookResponse として Dialogflow エージェントに送信します。Dialogflow エージェントには特定の形式の WebhookResponse が必要です。SetDialogflowResponse ポリシーにより、必要な形式でレスポンスが作成されます。このポリシーは、Dialogflow エージェントに必要な形式で WebhookResponse を作成します。WebhookResponse には、Dialogflow エージェントが認識する自然言語フレーズやその他のパラメータがあります。

バックエンド サービス インテグレータは、WebhookResponse の形式を理解することに時間を費やす必要はありません。すぐに使える SetDialogflowResponse ポリシーによって、レスポンス データがシームレスに処理されます。

このポリシーは拡張可能なポリシーです。Apigee ライセンスによっては、このポリシーの使用によって費用や使用量に影響する場合があります。ポリシータイプと使用量への影響については、ポリシータイプをご覧ください。

<SetDialogflowResponse>

SetDialogflowResponse ポリシーを定義します。

デフォルト値 なし
必須かどうか 必須
複合オブジェクト
親要素 なし
子要素 <DisplayName>
<Source>
<DialogflowVersion>
<NaturalLanguageResponse>
<Parameters>
<IgnoreUnresolvedVariables>

次の表に、SetDialogflowResponse 要素のすべての子要素の概要を示します。

子要素 必須かどうか 説明
<DisplayName> 省略可 ポリシーのカスタム名。
<Source> 省略可 解析する変数を指定します。
<DialogflowVersion> 省略可 Dialogflow のバージョンを指定します。
<NaturalLanguageResponse> 省略可 WebhookResponse.FulfillmentResponse オブジェクトとして送信する必要があるすべてのコンテンツをカプセル化します。
<Parameters> 省略可 <Parameter> の親要素。Webhook のレスポンスに設定する一連のパラメータを定義します。
<IgnoreUnresolvedVariables> 省略可 未解決の変数を検出したときに処理を停止するかどうかを指定します。
その他の子要素
<MergeBehavior> 省略可 レスポンス メッセージのマージ動作を指定します。
<Header> 省略可 レスポンス ヘッダー内の指定されたフィールドの値を抽出します。
<JSONPath> 省略可 指定された JSON パスの値を抽出します。
<Parameter> 必須 Webhook のレスポンスの sessionInfo.parameters オブジェクトで設定するパラメータを指定します。
<Phrase> 必須 Webhook のレスポンスの fulfillmentResponse.messages オブジェクトで設定するフレーズ(テキスト)を指定します。
<Phrases> 省略可 <Phrase> の親要素。Webhook のレスポンスに設定する自然言語フレーズのセットを定義します。
<Ref> 省略可 指定された参照変数の値を抽出します。
<Value> 省略可 指定したパラメータにカスタム テキストを設定します。

次の例は、Dialogflow エージェントに送信されるサンプル SetDialogflowResponse ポリシーと WebhookResponse を示しています。

構文

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<SetDialogflowResponse continueOnError="false" enabled="true"
        name="POLICY_NAME">
    <!-- The display name for this policy -->
    <DisplayName>DISPLAY_NAME</DisplayName>
    <!-- The message variable from which the policy extracts the required information -->
    <Source>MESSAGE_VARIABLE</Source>
    <!-- The version of Dialogflow for which this response policy is written up.
         This policy supports only the CX version. This element is optional and
         defaults to CX if unspecified -->
    <DialogflowVersion>DIALOGFLOW_VERSION</DialogflowVersion>
    <!-- A container object to encapsulate all content needed for a natural
         language response to be returned to Dialogflow from the Southbound API -->
    <NaturalLanguageResponse>
        <!-- Defines the merge behavior for existing responses and new responses.
             Refer here for more details -->
        <MergeBehavior>MERGE_BEHAVIOR</MergeBehavior>
        <!-- An ordered list of natural language phrases to be returned to
             Dialogflow from the Southbound API -->
        <Phrases>
            <!-- A phrase is a natural language phrase that Dialogflow agents
                 can send back to their caller/chatting customer -->
            <Phrase>
                <!-- A phrase can be extracted from the response JSON payload of a
                     service callout -->
                <JSONPath>JSON_PATH</JSONPath>
            </Phrase>
            <Phrase>
                <!-- A phrase can be extracted from the response headers of a
                     service callout -->
                <Header name="HEADER_NAME"/>
            </Phrase>
            <Phrase>
                <!-- A phrase refer to the value of an existing flow variable -->
                <Ref>EXISTING_FLOW_VARIABLE</Ref>
            </Phrase>
            <Phrase>
                <!-- A phrase can be static text -->
                <Value>CUSTOM_TEXT</Value>
            </Phrase>
        </Phrases>
    </NaturalLanguageResponse>
    <!-- A container object defining the parameters to be set as session parameters
         in the Webhook response sent to Dialogflow -->
    <Parameters>
        <!-- Defines a single parameter to be set in sessionInfo.parameters object
             of the WebhookResponse object. The name of the parameter is defined
             as an attribute -->
        <Parameter name="PARAMETER_NAME">
            <!-- A parameter's value can be extracted from the response JSON
                 payload of a service callout -->
            <JSONPath>JSON_PATH</JSONPath>
        </Parameter>
        <Parameter name="PARAMETER_NAME">
            <!-- A parameter's value can be extracted from the response headers
                 of a service callout -->
            <Header name="HEADER_NAME"/>
        </Parameter>
        <Parameter name="PARAMETER_NAME">
            <!-- A parameter's value can be refer to the value of an existing flow
                 variable -->
            <Ref>EXISTING_FLOW_VARIABLE</Ref>
        </Parameter>
        <Parameter name="PARAMETER_NAME">
            <!-- A parameter's value can be static text -->
            <Value>CUSTOM_TEXT</Value>
        </Parameter>
    </Parameters>
    <IgnoreUnresolvedVariables>BOOLEAN_VALUE</IgnoreUnresolvedVariables>
</SetDialogflowResponse>
      

SetDialogflowResponse ポリシー

次の例は、SetDialogflowResponse ポリシーの定義を示しています。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<SetDialogflowResponse continueOnError="false" enabled="true"
        name="CCAIDialogflowResponse-InsuranceAgent">
    <DisplayName>Insurance Agent Webhook Response Policy</DisplayName>
    <Source>myMessageVar</Source>
    <DialogflowVersion>CX</DialogflowVersion>
    <NaturalLanguageResponse>
        <MergeBehavior>APPEND</MergeBehavior>
        <Phrases>
            <Phrase>
                <JSONPath>$.claim.status.text</JSONPath>
            </Phrase>
            <Phrase>
                <Header name="X-Response-Text"/>
            </Phrase>
            <Phrase>
                <Ref>myVar</Ref>
            </Phrase>
            <Phrase>
                <Value>You call is important to us</Value>
            </Phrase>
        </Phrases>
    </NaturalLanguageResponse>
    <Parameters>
        <Parameter name="claimStatus">
            <JSONPath>$.claim.status.value</JSONPath>
        </Parameter>
        <Parameter name="claimAmount">
            <JSONPath>$.claim.amount</JSONPath>
        </Parameter>
        <Parameter name="timeSpent">
            <Header name="X-Time-Spent"/>
        </Parameter>
        <Parameter name="myVar">
            <Ref>dialogflow.my.var</Ref>
        </Parameter>
        <Parameter name="responder">
            <Value>SYSTEM</Value>
        </Parameter>
    </Parameters>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</SetDialogflowResponse>

次のサンプルに移動して、このポリシーによって作成された Webhook レスポンスを確認します。

Webhook レスポンス

次の例は、Dialogflow エージェントに送信される WebhookResponse を示しています。

{
    "fulfillmentResponse": {
        "mergeBehavior": "APPEND",
        "messages": [{
            "text": {
                "text": ["Your claim is currently being processed",
                          "Please call back in a couple of days"]
            }
        }]
    },
    "sessionInfo": {
        "parameters": {
            "claimStatus": "PROCESSING",
            "claimAmount": 1000
        }
    }
}

この要素には、すべてのポリシーに共通する次の属性があります。

属性 デフォルト 必須かどうか 説明
name なし 必須

ポリシーの内部名。name 属性の値には、英字、数字、スペース、ハイフン、アンダースコア、ピリオドを使用できます。この値は 255 文字を超えることはできません。

管理 UI プロキシ エディタで <DisplayName> 要素を追加して、ポリシーのラベルに使用する別の自然言語名を指定することもできます。

continueOnError false 省略可 ポリシーが失敗したときにエラーを返す場合は、false に設定します。これは、ほとんどのポリシーで想定される動作です。ポリシーが失敗した後もフローの実行を続行する場合は、true に設定します。関連情報:
enabled true 省略可 ポリシーを適用するには、true に設定します。ポリシーを無効にするには、false に設定します。ポリシーがフローに接続されている場合でも適用されません。
async   false 非推奨 この属性は非推奨となりました。

子要素のリファレンス

このセクションでは、<SetDialogflowResponse> の子要素について説明します。

<DisplayName>

Use in addition to the name attribute to label the policy in the management UI proxy editor with a different, more natural-sounding name.

The <DisplayName> element is common to all policies.

Default Value N/A
Required? Optional. If you omit <DisplayName>, the value of the policy's name attribute is used.
Type String
Parent Element <PolicyElement>
Child Elements None

The <DisplayName> element uses the following syntax:

Syntax

<PolicyElement>
  <DisplayName>POLICY_DISPLAY_NAME</DisplayName>
  ...
</PolicyElement>

Example

<PolicyElement>
  <DisplayName>My Validation Policy</DisplayName>
</PolicyElement>

The <DisplayName> element has no attributes or child elements.

<Source>

解析する変数を指定します。<Source> の値がデフォルトの message に設定されます。message 値はコンテキストに依存します。リクエスト フローで、message がリクエスト メッセージに解決されます。レスポンス フローの中では、message はレスポンス メッセージになります。

このポリシーはリクエストやレスポンスのメッセージから情報を抽出するためによく使用されますが、任意の変数から情報を抽出するためにも使用できます。たとえば、このエンティティを使用すると、AccessEntity ポリシーによって作成されたエンティティ、ServiceCallout ポリシーによって返されたデータ、XML や JSON オブジェクトから抽出された情報などから情報を抽出できます。

<Source> を解決できない場合、またはメッセージ以外のタイプに解決される場合、ポリシーは失敗し、ランタイム エラーが発生します。

デフォルト値 なし
必須かどうか オプション
文字列
親要素 <SetDialogflowResponse>
子要素 なし
<Source> 要素の構文は次のとおりです。

構文

<Source>MESSAGE_VARIABLE</Source>

次の例では、Source を myMessageVar に設定しています。

<Source>myMessageVar</Source>

<DialogflowVersion>

Dialogflow のバージョンを指定します。SetDialogflowResponse ポリシーは CX バージョンのみをサポートしています。ポリシーでこの要素を指定しないと、バージョンはデフォルトで CX になります。

デフォルト値 なし
必須かどうか オプション
文字列
親要素 <SetDialogflowResponse>
子要素 なし
<DialogflowVersion> 要素の構文は次のとおりです。

構文

<DialogflowVersion>DIALOGFLOW_VERSION</DialogflowVersion>

次の例では、DialogflowVersion を CX に設定します。

<DialogflowVersion>CX</DialogflowVersion>

<IgnoreUnresolvedVariables>

未解決の変数を検出したときに処理を停止するかどうかを決定します。

デフォルト値 True
必須かどうか オプション
ブール値
親要素 <SetDialogflowResponse>
子要素 なし

true を設定すると、未解決の変数を無視して処理を続行できます。それ以外の場合は false を設定します。デフォルト値は true です。

<IgnoreUnresolvedVariables>true に設定することは、<SetDialogflowResponse>continueOnErrortrue に設定することとは異なります。continueOnErrortrue に設定すると、変数のエラーだけでなく、すべてのエラーが無視されます。

<IgnoreUnresolvedVariables> 要素の構文は次のとおりです。

構文

 <IgnoreUnresolvedVariables>[true|false]</IgnoreUnresolvedVariables>

次の例では、<IgnoreUnresolvedVariables>false に設定します。

       <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>

<MergeBehavior>

レスポンス メッセージのマージ動作を定義します。次のいずれかの値を指定できます。

  • APPEND: ユーザーへの送信を待機しているメッセージのリストにメッセージを追加します。
  • REPLACE: ユーザーへの送信を待機しているメッセージのリストで、古いメッセージを新しいメッセージに置き換えます。
要素を指定しない場合、デフォルトの動作は APPEND です。
デフォルト値 なし
必須かどうか オプション
文字列
親要素 <NaturalLanguageResponse>
子要素 なし
<MergeBehavior> 要素の構文は次のとおりです。

構文

<MergeBehavior>BEHAVIOR</MergeBehavior>

次の例では、統合の動作を APPEND に設定しています。

<MergeBehavior>APPEND</MergeBehavior>

<NaturalLanguageResponse>

Dialogflow エージェントに送信するすべての自然言語レスポンスをカプセル化します。

デフォルト値 なし
必須かどうか オプション
複合オブジェクト
親要素 <SetDialogflowResponse>
子要素 <MergeBehavior>
<Phrases>

<Parameters>

Webhook のレスポンスに設定する一連のパラメータを定義します。パラメータの名前は、<Parameter> 要素の属性です。

デフォルト値 なし
必須かどうか オプション
複合オブジェクト
親要素 <SetDialogflowResponse>
子要素 <Parameter>

<Parameter>

Webhook のレスポンスの sessionInfo.parameters オブジェクトで設定するパラメータを指定します。

静的テキストをパラメータ値として指定するか、レスポンスの次のフィールドから値を抽出できます。

  • レスポンス ヘッダー フィールド
  • JSON ペイロード
  • フロー変数

抽出する値ごとに個別の <Parameter> 要素を定義する必要があります。

デフォルト値 なし
必須かどうか 必須
複合オブジェクト
親要素 <Parameters>
子要素 <Header>
<JSONPath>
<Ref>
<Value>
<Parameter> 要素には次の属性があります。
属性 説明 必須かどうか
name このパラメータで作成する変数の名前。 はい 文字列

<Parameter> 要素の構文は次のとおりです。

構文

<Parameters>
  <Parameter name="PARAMETER_NAME">
  <Header name="HEADER_NAME"/>
</Parameter>
<Parameter name="PARAMETER_NAME">
  <JSONPath>JSON_PATH</JSONPath>
</Parameter>
<Parameter name="PARAMETER_NAME">
  <Ref>EXISTING_FLOW_VARIABLE</Ref>
</Parameter>
<Parameter name="PARAMETER_NAME">
  <Value>CUSTOM_TEXT</Value>
</Parameter>
</Parameters>

ヘッダー フィールド値を抽出する

この例では、timeSpent パラメータを X-Time-Spent ヘッダー フィールドの値に設定します。

<Parameter name="timeSpent">
     <Header name="X-Time-Spent"/>
</Parameter>

JSON パス値を抽出する

この例では、claimAmount パラメータを JSON ペイロードの claim.amount フィールドの値に設定します。

<Parameter name="claimAmount">
   <JSONPath>$.claim.amount</JSONPath>
</Parameter>

フロー変数の値を抽出する

この例では、myVar パラメータを dialogflow.my.var フロー変数の値に設定します。

<Parameter name="myVar">
   <Ref>dialogflow.my.var</Ref>
</Parameter>
       

カスタム テキストを設定する

この例では、responder パラメータの値を SYSTEM に設定します。

<Parameter name="responder">
   <Value>SYSTEM</Value>
</Parameter>

<Phrases>

<Phrase> の親要素。Webhook のレスポンスに設定する自然言語フレーズの順序付きリストを定義します。

デフォルト値 なし
必須かどうか オプション
複合オブジェクト
親要素 <NaturalLanguageResponse>
子要素 <Phrase>

<Phrase>

Webhook のレスポンスの fulfillmentResponse.messages オブジェクトに設定するフレーズ(テキスト)を指定します。

静的テキストをフレーズ値として指定するか、またはレスポンスの次のフィールドから値を抽出できます。

  • レスポンス ヘッダー フィールド
  • JSON ペイロード
  • フロー変数

抽出する値ごとに個別の <Phrase> 要素を定義する必要があります。

デフォルト値 なし
必須かどうか 必須
複合オブジェクト
親要素 <Phrases>
子要素 <Header>
<JSONPath>
<Ref>
<Value>

<Phrase> 要素の構文は次のとおりです。

構文

<Phrases>
  <Phrase>
    <Header name="HEADER_NAME"/>
  </Phrase>
  <Phrase>
    <JSONPath>JSON_PATH</JSONPath>
  </Phrase>
  <Phrase>
    <Ref>EXISTING_FLOW_VARIABLE</Ref>
  </Phrase>
  <Phrase>
    <Value>CUSTOM_TEXT</Value>
  </Phrase>
</Phrases>

ヘッダー フィールド値を抽出する

この例では、レスポンスに X-Response-Text ヘッダー フィールドの値として自然言語テキストを設定します。

<Phrase>
     <Header name="X-Response-Text"/>
</Phrase>

JSON パス値を抽出する

この例では、レスポンスに JSON ペイロードの claim.status.text フィールドの値に対応する自然言語テキストを設定します。

<Phrase>
   <JSONPath>$.claim.status.text</JSONPath>
</Phrase>

フロー変数の値を抽出する

この例では、myVar フロー変数の値に対するレスポンスに自然言語テキストを設定します。

<Phrase>
   <Ref>myVar</Ref>
</Phrase>
       

カスタム テキストを設定する

この例では、レスポンスの自然言語テキストにテキスト You call is important to us を追加します。

<Phrase>
   <Value>You call is important to us</Value>
</Phrase>

レスポンス ヘッダー内の指定されたフィールドから値を抽出します。ヘッダー値は、自然言語のテキストまたはレスポンス パラメータに設定できます。

  • ヘッダー値を自然言語レスポンスとして抽出するには、<Phrase> 要素内に <Header> 要素を指定します。
  • ヘッダー値をレスポンス パラメータとして抽出するには、<Parameter> 要素内に <Header> 要素を指定します。
デフォルト値 なし
必須かどうか オプション
文字列
親要素 <Phrase>
<Parameter>
子要素 なし
<Header> 要素の構文は次のとおりです。

構文

<Header name="HEADER_FIELD"/>

例 1

次の例では、自然言語レスポンスとして X-Response-Text ヘッダー フィールドの値を取得しています。

<Phrase>
  <Header name="X-Response-Text"/>
<Phrase/>

例 2

次の例では、レスポンス パラメータとして X-Response-Text ヘッダー フィールドの値を取得しています。

<Parameter name="timeSpent">
  <Header name="X-Response-Text"/>
<Parameter/>

timeSpent フロー変数は、X-Response-Text ヘッダー フィールドの値に設定されます。

<Header> 要素には次の属性があります。

属性 説明 必須かどうか
name 値を抽出するレスポンス ヘッダーの名前を指定します。 必須 文字列

<JSONPath>

サービス コールアウトの JSON ペイロード内の JSON パスの値を抽出します。この値は、自然言語のテキストまたはレスポンス パラメータに設定できます。

  • JSON 値を自然言語テキストとして抽出するには、<Phrase> 要素内に <JSONPath> 要素を指定します。
  • JSON 値をレスポンス パラメータとして抽出するには、<Parameter> 要素内に <JSONPath> 要素を指定します。
デフォルト値 なし
必須かどうか オプション
文字列
親要素 <Phrase>
<Parameter>
子要素 なし
<JSONPath> 要素の構文は次のとおりです。

構文

<JSONPath>JSON_PATH</JSONPath>

例 1

次の例では、自然言語レスポンスとして claim.status.text JSON フィールドの値を取得しています。

<Phrase>
  <JSONPath>$.claim.status.text</JSONPath>
<Phrase/>

例 2

次の例では、レスポンス パラメータとして claim.amount JSON フィールドの値を取得しています。

<Parameter name="claimAmount">
  <JSONPath>$.claim.amount.</JSONPath>
<Parameter/>

claimAmount フロー変数は、{claim.amount} JSON フィールドの値に設定されます。

<Ref>

既存のフロー変数の値を抽出します。この値は、自然言語のテキストまたはレスポンス パラメータに設定できます。

  • 変数の値を自然言語テキストとして抽出するには、<Phrase> 要素内に <Ref> 要素を指定します。
  • 変数の値をレスポンス パラメータとして抽出するには、<Parameter> 要素内に <Ref> 要素を指定します。
デフォルト値 なし
必須かどうか オプション
文字列
親要素 <Phrase>
<Parameter>
子要素 なし
<Ref> 要素の構文は次のとおりです。

構文

<Ref>EXISTING_FLOW_VARIABLE</Ref>

例 1

次の例では、自然言語レスポンスとして myVar フロー変数の値を取得しています。

<Phrase>
  <Ref>myVar</Ref>
<Phrase/>

例 2

次の例では、レスポンス パラメータとして dialogflow.my.var フロー変数の値を取得しています。

<Parameter name="customVar">
  <Ref>dialogflow.my.var</Ref>
<Parameter/>

customVar フロー変数は、dialogflow.my.var 変数の値に設定されます。

<Value>

リテラル値を自然言語テキストまたはレスポンス パラメータに設定します。

  • リテラル値を自然言語テキストとして設定するには、<Phrase> 要素内に <Value> 要素を指定します。
  • リテラル値をレスポンス パラメータとして設定するには、<Parameter> 要素内に <Value> 要素を指定します。
デフォルト値 なし
必須かどうか オプション
文字列
親要素 <Phrase>
<Parameter>
子要素 なし
<Value> 要素の構文は次のとおりです。

構文

<Value>CUSTOM_TEXT</Value>

例 1

次の例では、リテラル テキスト You call is important to us を自然言語レスポンスとして設定しています。

<Phrase>
  <Value>You call is important to us</Value>
<Phrase/>

例 2

次の例では、リテラル テキスト SYSTEM をレスポンス パラメータとして設定しています。

<Parameter name="responder">
  <Value>SYSTEM</Value>
<Parameter/>

responder フロー変数が SYSTEM に設定されます。

エラーコード

This section describes the fault codes and error messages that are returned and fault variables that are set by Apigee when this policy triggers an error. This information is important to know if you are developing fault rules to handle faults. To learn more, see What you need to know about policy errors and Handling faults.

Runtime errors

These errors can occur when the policy executes.

Fault code HTTP status Cause
steps.setdialogflowresponse.ExecutionFailed 500 This error occurs when the execution of the policy failed because of a generic exception. The fault message has the details of the exception.
steps.setdialogflowresponse.InvalidSourceType 500 This error occurs if the variable specified in the <Source> element is not of message type.
steps.setdialogflowresponse.MalformedInput 500 This error occurs when the JSON provided to this policy is invalid or malformed.
steps.setdialogflowresponse.SourceMessageNotAvailable 500 This error occurs if the message variable specified in the Source element of the policy is either:
  • Out of scope (not available in the specific flow where the policy is executed)
  • or
  • Can't be resolved (is not defined)
steps.setdialogflowresponse.UnresolvedHeader 500 This error occurs if the Header element has an invalid header. For example, if the Header element has the value X-Response-Text, and there is no X-Response-Text in the response header, you will get this error.
steps.setdialogflowresponse.UnresolvedJSONPath 500 This error occurs if the JSONPath element has an invalid path. For example, if the JSONPath element has the value {claim.status.value}, and there is no status object in the JSON payload, you will get this error.
steps.setdialogflowresponse.UnresolvedVariable 500

This error occurs if a variable specified in the SetDialogflowResponse policy is either:

  • Out of scope (not available in the specific flow where the policy is being executed)
  • or
  • Can't be resolved (is not defined)

Deployment errors

These errors can occur when you deploy a proxy containing this policy.

Error name Cause
UnsupportedOperation This error occurs if you have specified unsupported Dialogflow version in the DialogflowVersion element. The SetDialogflowResponse policy supports only the CX version.

Fault variables

Whenever there are execution errors in a policy, Apigee generates error messages. You can view these error messages in the error response. Many a time, system generated error messages might not be relevant in the context of your product. You might want to customize the error messages based on the type of error to make the messages more meaningful.

To customize the error messages, you can use either fault rules or the RaiseFault policy. For information about differences between fault rules and the RaiseFault policy, see FaultRules vs. the RaiseFault policy. You must check for conditions using the Condition element in both the fault rules and the RaiseFault policy. Apigee provides fault variables unique to each policy and the values of the fault variables are set when a policy triggers runtime errors. By using these variables, you can check for specific error conditions and take appropriate actions. For more information about checking error conditions, see Building conditions.

The following table describes the fault variables specific to this policy.

Variables Where Example
fault.name="FAULT_NAME" FAULT_NAME is the name of the fault, as listed in the Runtime errors table. The fault name is the last part of the fault code. fault.name Matches "UnresolvedVariable"
setdialogflowresponse.POLICY_NAME.failed POLICY_NAME is the user-specified name of the policy that threw the fault. setdialogflowresponse.My-Set-Dialogflow-Response.failed = true
For more information about policy errors, see What you need to know about policy errors.

関連トピック

SetDialogflowResponse ポリシーの使用状況を示す Apigee プロキシと共有フローのリファレンス実装は、Apigee GitHub で入手できます。詳細については、会話型 AI リファレンス実装をご覧ください。