Skip to content

Commit 6856735

Browse files
Fixes/Polishes for COVID vaccine hesitancy chatbot template (twilio-labs#246)
* Added placeholder file for GCP auth key This is needed for the uploading of the JSON to work. * Fix reference to configured phone number * Update .env file to clarify configuration Add link to dialogflow language options. Specify that user should paste JSON key contents. * .env polishes and update README with new language code env var * Fix linting error * chore(env-manifest): update manifest file Co-authored-by: twilio-labs-ci <[email protected]>
1 parent f0175e6 commit 6856735

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed

covid-vaccine-faq-bot/.env

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
TWILIO_PHONE_NUMBER=
55

66
# description: Your Google Cloud Project ID
7-
# link: https://cloud.google.com/dialogflow/cx/docs/quick/setup#project
7+
# link: https://cloud.google.com/dialogflow/cx/docs/quick/setup#project
88
# format: text
99
# required: true
1010
GOOGLE_CLOUD_PROJECT_ID=
1111

12-
# description: A JSON key file for your Google service account
12+
# description: A JSON key file for your Google service account. If deploying via CodeExchange, paste the JSON contents of the service account key below.
1313
# format: file(json)
1414
# contentKey: SERVICE_ACCOUNT_KEY_CONTENT
1515
# link: https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys
1616
# required: true
1717
GOOGLE_APPLICATION_CREDENTIALS=/service-account-key.json
1818

19-
#description: Language to be leveraged by chatbot, can be configured for multi-language chatbots
20-
#format: text
19+
# description: Language to be used by chatbot. Defaults to U.S. English (en-US). Do not change if using pre-build chatbot agents. If changing, set to Dialogflow language tag (e.g. es).
20+
# format: text
21+
# required: false
22+
# link: https://cloud.google.com/dialogflow/es/docs/reference/language
2123
LANGUAGE_CODE=en-US
2224

2325
# description: SID of the Vaccine Bot FAQ Studio Flow, will be set automatically by the app, no need to configure in advance

covid-vaccine-faq-bot/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ In your `.env` file, set the following values:
4040
| `TWILIO PHONE NUMBER` | Your Twilio phone number for sending and receiving SMS (find this [in the console here](https://www.twilio.com/console/phone-numbers/incoming))| Yes |
4141
| `DIALOGFLOW_ES_PROJECT_ID` | Your Google Dialog Flow Project ID ([instructions here](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)) | Yes |
4242
| `GOOGLE_APPLICATION_CREDENTIALS` | Path to service account key file (json) to authenticate into dialogflow API. Default is `/service-account-key.json`. | Yes |
43+
| `LANGUAGE_CODE` | Language to be used by chatbot. Default is
44+
U.S. English, `en-US`. If changing, set to Dialogflow language
45+
tag found [here](https://cloud.google.com/dialogflow/es/docs/reference/language) | Yes |
4346

44-
There is a fourth environment variable, `FLOW_SID`, but that will be set automatically by the app. **Do not** set this value.
47+
There is a fifth environment variable, `FLOW_SID`, but that will be set automatically by the app. **Do not** set this value.
4548
| Variable | Description | Required |
4649
| :------------------------------- | :---------------------------------------------------------------------------------------------------------------------- | :-- |
4750
| `FLOW_SID` | SID of Studio Flow to orchestrate chatbot messaging. Will be set automatically by the app. Do not configure in advance. | No |

covid-vaccine-faq-bot/assets/client.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable no-console */
22
/* eslint-disable no-undef */
3+
/* eslint-disable prefer-destructuring */
34
let phoneNumber;
45
let flowSid;
56

@@ -13,7 +14,7 @@ const fullUrl = baseUrl.href.substr(0, baseUrl.href.length - 1);
1314
fetch(`${fullUrl}/return-config`)
1415
.then((response) => response.json())
1516
.then((json) => {
16-
phoneNumber = json.phone_number;
17+
phoneNumber = json.phoneNumber;
1718
// Grab the phone number being used and display it to help the user test their app
1819
const phoneNumberElements = $('.phone-number');
1920
phoneNumberElements.html(phoneNumber);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"type": "service_account",
3+
"project_id": "<YOUR PROJECT ID HERE>",
4+
"private_key_id": "<YOUR PRIVATE KEY ID HERE>",
5+
"private_key": "<YOUR PRIVATE KEY BLOCK HERE>",
6+
"client_email": "<YOUR SERVICE ACCOUNT EMAIL ADDRESS>",
7+
"client_id": "<YOUR CLIENT ID>",
8+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
9+
"token_uri": "https://oauth2.googleapis.com/token",
10+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
11+
"client_x509_cert_url": "<YOUR X509 CERT URL>"
12+
}

env-variables.manifest.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1346,18 +1346,18 @@
13461346
"key": "GOOGLE_APPLICATION_CREDENTIALS",
13471347
"required": true,
13481348
"format": "file(json)",
1349-
"description": "A JSON key file for your Google service account",
1349+
"description": "A JSON key file for your Google service account. If deploying via CodeExchange, paste the JSON contents of the service account key below.",
13501350
"link": "https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating_service_account_keys",
13511351
"default": "/service-account-key.json",
13521352
"configurable": true,
13531353
"contentKey": "SERVICE_ACCOUNT_KEY_CONTENT"
13541354
},
13551355
{
13561356
"key": "LANGUAGE_CODE",
1357-
"required": true,
1357+
"required": false,
13581358
"format": "text",
1359-
"description": "Language to be leveraged by chatbot, can be configured for multi-language chatbots",
1360-
"link": null,
1359+
"description": "Language to be used by chatbot. Defaults to U.S. English (en-US). Do not change if using pre-build chatbot agents. If changing, set to Dialogflow language tag (e.g. es).",
1360+
"link": "https://cloud.google.com/dialogflow/es/docs/reference/language",
13611361
"default": "en-US",
13621362
"configurable": true,
13631363
"contentKey": null

0 commit comments

Comments
 (0)