From 5836d82fabe1e7dc03fdda18ec7eaaddc2fbd98b Mon Sep 17 00:00:00 2001 From: Vivek Dlima Date: Tue, 17 Sep 2024 12:59:46 -0700 Subject: [PATCH] Refactor based on customer experience --- ...integration_Dialogflow_CURL_commands.ipynb | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/tools/SIP_SIPREC_integration_Dialogflow_CURL_commands.ipynb b/tools/SIP_SIPREC_integration_Dialogflow_CURL_commands.ipynb index 665409f6..16d340fc 100644 --- a/tools/SIP_SIPREC_integration_Dialogflow_CURL_commands.ipynb +++ b/tools/SIP_SIPREC_integration_Dialogflow_CURL_commands.ipynb @@ -24,22 +24,17 @@ "import re\n", "import sys\n", "\n", - "google_auth.authenticate_user()\n", "\n", "# @title Input parameters\n", - "\n", - "PROJECT_ID = \"my-project-id\" # @param {type:\"string\"}\n", + "PROJECT_ID = \"cx-agent-305020\" # @param {type:\"string\"}\n", "REGION = \"global\" # @param {type:\"string\"}\n", "JWT = \"Leave as-is to use SSO or enter generated JWT token here\" # @param {type:\"string\"}\n", "\n", "\n", - "# Ensure that the project has Dialogflow APIs enabled\n", - "!gcloud config set project {PROJECT_ID}\n", - "!gcloud services enable dialogflow.googleapis.com\n", - "\n", "CONTAINS_SPACES_PATTERN = r\"\\s\"\n", "# If the JWT string has spaces, then use SSO for authentication\n", "if re.search(CONTAINS_SPACES_PATTERN, JWT):\n", + " google_auth.authenticate_user()\n", " JWT = !gcloud auth print-access-token\n", " JWT = JWT[0]\n", "\n", @@ -52,6 +47,23 @@ "metadata": { "id": "BDe-MhXg2U7C" }, + "execution_count": 1, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# @title ** DO NOT USE IF USING A JWT** Enable the Dialogflow API in your project\n", + "\n", + "google_auth.authenticate_user()\n", + "\n", + "# Ensure that the project has Dialogflow APIs enabled\n", + "!gcloud config set project {PROJECT_ID}\n", + "!gcloud services enable dialogflow.googleapis.com" + ], + "metadata": { + "id": "9ohBmJNaiZgr" + }, "execution_count": null, "outputs": [] }, @@ -98,6 +110,9 @@ " print(\"No Dialogflow CX agent name provided.\")\n", " virtual_agent = False\n", "\n", + "project_allowlisted = True\n", + "\n", + "\n", "# Create PhoneNumberOrder\n", "\n", "print(\"\\nCreating Phone Number Order Object:\\n\")\n", @@ -124,9 +139,9 @@ " print(f'\\n>>>> PROJECT \"{PROJECT_ID}\" HAS NOT BEEN ALLOWLISTED. <<<< \\n\\n\\n'\n", " 'Submit the form https://docs.google.com/forms/d/e/1FAIpQLSe2xMdpg_L2bhvl4EoNTUC4Nctzc3Qlw54uQ1_JNFgr0VhOfg/viewform '\n", " 'wait to hear back and then re-run this script.\\n\\n')\n", - " project_not_allowlisted = True\n", + " project_allowlisted = False\n", "\n", - "if not project_not_allowlisted:\n", + "if project_allowlisted:\n", "\n", " # Create Security Settings object\n", "\n",