Jump to: navigation, search

Custom Natural Language Menu Dialogflow CX Chatbot Integration

Important
The Custom Natural Language Module is a licensed product in Intelligent Automation. Be sure to acquire and install the updated license prior to beginning the installation process. Directions for installing a license file in Flex License Manager can be found here.
Important

The Custom Natural Language Module supports Dialogflow CX edition for chat features only.

The endpoint URL for Dialogflow CX is https://<region-prefix-if other than US>.dialogflow.googleapis.com/<api-version>/projects/my-project-id/locations/<my region>/agents/my-agent-id/environments/<my environment id>/sessions/<my-session-id>:detectIntent, where:

  • <API version> is v3 or v3beta1 (Check the API reference at https://cloud.google.com/dialogflow/cx/docs/reference/rest.)
  • <my-project-id> is your project ID in Dialogflow CX Console.
  • <my region> is your region in Dialogflow CX Console.
  • <my-agent-id> is the agent ID from Dialogflow CX Console.
  • <my environment id> is your environment id and also an optional value.
  • <my-session-id> is the session ID that is created during runtime in the Start dialog engine session script block in Custom Natural Language Menu.
Important

You can get the endpoint URL information from the Project Overview screen in Dialogflow console. Select the project from the Project dropdown, then select the agent from the Menu icon and click Copy ID.

You can specify an environment for runtime session calls, like detectIntentstreamingDetectIntentmatchIntent, �and session entity calls. To specify an environment, alter the endpoint URL by inserting environments/environment-id between the agent and sessions path parameters.

For example, the following endpoint uses the 6db409d7-57ac-41d7-83bd-89b8768e2745 environment ID: https://dialogflow.googleapis.com/v3beta1/projects/my-project-id/locations/us/agents/my-agent-id/environments/6db409d7-57ac-41d7-83bd-89b8768e2745/sessions/my-session-id:detectIntent

If an environment is not specified, the default environment is used.

Important

You can get the environment ID form the following path in Dialogflow Console: Project > Agent > Manage > Environments. See versions and environments in Google Dialogflow CX documentation.


You can also include these values as module parameters and build the URL to access the endpoint. You can then include a script that reads the parameters and constructs the Base URL:

def slanguageCode = context.getVariable("LanguageCode");
def sAPIVersion = context.getVariable("GoogleCXAPIVersion");
def sGoogleCXProjectID = context.getVariable("GoogleCXProjectID");
def sLocations = context.getVariable("GoogleCXRegion");
def sAgentID =context.getVariable("GoogleCXAgentID");
def sEnvironmentID = context.getVariable("GoogleCXEnvironmentID");

def sBASE_API_URL = "https://europe-west1-dialogflow.googleapis.com/" + sAPIVersion + "/projects/" + sGoogleCXProjectID + "/locations/" + sLocations + "/agents/" + sAgentID + "/environments/" + sEnvironmentID+ "/sessions/" + sSessionID + ":detectIntent?access_token="+sToken;

Sample scripts

These scripts can be used as a starting point to build your custom scripts:

This page was last edited on June 16, 2021, at 15:20.
Comments or questions about this documentation? Contact us for support!