diff --git a/.firebaserc b/.firebaserc index 3ba429ef..80edbbab 100644 --- a/.firebaserc +++ b/.firebaserc @@ -1,5 +1,9 @@ { "projects": { - "default": "checkmate-373101" - } -} + "default": "checkmate-373101", + "prod": "checkmate-373101", + "uat": "checkmate-uat" + }, + "targets": {}, + "etags": {} +} \ No newline at end of file diff --git a/.github/workflows/firebase-deploy.yml b/.github/workflows/firebase-deploy.yml index 82bc2b54..3b0f76c0 100644 --- a/.github/workflows/firebase-deploy.yml +++ b/.github/workflows/firebase-deploy.yml @@ -1,11 +1,14 @@ name: Deploy Cloud Functions + on: workflow_dispatch: push: branches: - main + - develop paths: - - 'functions/**' + - "functions/**" + jobs: build_and_deploy: runs-on: ubuntu-latest @@ -22,15 +25,30 @@ jobs: ${{ runner.os }}-node- - name: Create env file run: | - echo "${{ secrets.ENV_FILE }}" > .env + if [ "${{ github.ref }}" == "refs/heads/main" ]; then + echo "${{ secrets.ENV_FILE }}" > .env + else + echo "${{ secrets.ENV_FILE_NONPROD }}" > .env + fi working-directory: functions - name: Build Cloud Functions run: npm ci working-directory: functions - name: Create SA key - run: echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' > $HOME/gcloud.json + run: | + if [ "${{ github.ref }}" == "refs/heads/main" ]; then + echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' > $HOME/gcloud.json + else + echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NONPROD }}' > $HOME/gcloud.json + fi - name: Install Firebase CLI run: npm install -g firebase-tools - name: Deploy Cloud Functions - run: export GOOGLE_APPLICATION_CREDENTIALS=$HOME/gcloud.json && npm run deploy - working-directory: functions \ No newline at end of file + run: | + export GOOGLE_APPLICATION_CREDENTIALS=$HOME/gcloud.json + if [ "${{ github.ref }}" == "refs/heads/main" ]; then + npm run deploy -- --project checkmate-373101 + else + npm run deploy -- --project checkmate-uat + fi + working-directory: functions diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a8b34330..90f72ec3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,7 +17,7 @@ jobs: - name: Start docker compose for testing run: docker-compose -f docker-compose-base.yml up -d - name: Wait for emulator to start - run: timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:15001/checkmate-373101/asia-southeast1/healthcheck)" != "200" ]]; do sleep 1; done' || false + run: timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:15001/checkmate-uat/asia-southeast1/healthcheck)" != "200" ]]; do sleep 1; done' || false - name: Install newman and lodash run: npm ci working-directory: integration-tests diff --git a/documentation/dataSchema.md b/documentation/dataSchema.md index fb631412..b631112c 100644 --- a/documentation/dataSchema.md +++ b/documentation/dataSchema.md @@ -114,6 +114,7 @@ erDiagram string referralId "referral code" number referralCount map utm "map containing utm parameters, source, medium, content, campaign, term" + string language "en or cn, users preferred language" } message ||--|{ instance: has diff --git a/functions/.env.checkmate-uat b/functions/.env.checkmate-uat new file mode 100644 index 00000000..5af64148 --- /dev/null +++ b/functions/.env.checkmate-uat @@ -0,0 +1,5 @@ +NUM_SHARDS_INSTANCE_COUNT=5 +NUM_SHARDS_VOTE_COUNT=5 +GRAPH_API_VERSION=v15.0 +ENVIRONMENT=UAT +SIMILARITY_THRESHOLD=0.85 \ No newline at end of file diff --git a/functions/.env.local.test b/functions/.env.local.test index 541462fd..9b774d21 100644 --- a/functions/.env.local.test +++ b/functions/.env.local.test @@ -12,4 +12,5 @@ TYPESENSE_PROTOCOL=http EMBEDDER_HOST=http://embedder-server:12344 TELEGRAM_REPORT_CHANNEL_ID=111111111 TEST_IMAGE_URL=TEST -HASHIDS_SALT=SALT \ No newline at end of file +HASHIDS_SALT=SALT +WEBHOOK_PATH=whatsapp \ No newline at end of file diff --git a/functions/.secret.local.test b/functions/.secret.local.test index 82cfc551..d2f77eb3 100644 --- a/functions/.secret.local.test +++ b/functions/.secret.local.test @@ -4,7 +4,7 @@ WHATSAPP_TOKEN=WHATSAPP_TOKEN TELEGRAM_CHECKER_BOT_TOKEN=TELEGRAM_CHECKER_BOT_TOKEN TELEGRAM_REPORT_BOT_TOKEN=TELEGRAM_REPORT_BOT_TOKEN VERIFY_TOKEN=VERIFY_TOKEN -BITLY_TOKEN=BITLY_TOKEN +OPENAI_API_KEY=OPEN_API_KEY TYPESENSE_TOKEN=TYPESENSE_TOKEN ML_SERVER_TOKEN=ML_SERVER_TOKEN TELEGRAM_BOT_TOKEN=TELEGRAM_BOT_TOKEN diff --git a/functions/package-lock.json b/functions/package-lock.json index d06b0356..c48d3860 100644 --- a/functions/package-lock.json +++ b/functions/package-lock.json @@ -13,7 +13,7 @@ "express": "^4.18.2", "firebase": "^9.15.0", "firebase-admin": "^11.4.1", - "firebase-functions": "^4.4.1", + "firebase-functions": "^4.5.0", "googleapis": "^112.0.0", "hashids": "^2.3.0", "image-hash": "^5.3.1", @@ -27,7 +27,7 @@ "@babel/core": "^7.21.4", "@babel/preset-env": "^7.21.4", "@babel/preset-typescript": "^7.21.4", - "@types/express": "^4.17.17", + "@types/express": "^4.17.20", "@types/jest": "^29.5.1", "@types/node-telegram-bot-api": "^0.61.8", "@types/supertest": "^2.0.12", @@ -59,17 +59,89 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", - "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "dependencies": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/code-frame/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/code-frame/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/code-frame/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/compat-data": { "version": "7.21.4", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.4.tgz", @@ -125,12 +197,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", - "integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "dependencies": { - "@babel/types": "^7.21.4", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -272,9 +344,9 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true, "engines": { "node": ">=6.9.0" @@ -293,25 +365,25 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", - "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "dependencies": { - "@babel/template": "^7.20.7", - "@babel/types": "^7.21.0" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" @@ -441,30 +513,30 @@ } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true, "engines": { "node": ">=6.9.0" @@ -509,13 +581,13 @@ } }, "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { @@ -594,9 +666,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", - "integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "devOptional": true, "bin": { "parser": "bin/babel-parser.js" @@ -1817,33 +1889,33 @@ } }, "node_modules/@babel/template": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", - "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", - "integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.4", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.21.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.4", - "@babel/types": "^7.21.4", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1861,13 +1933,13 @@ } }, "node_modules/@babel/types": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", - "integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -4227,9 +4299,9 @@ } }, "node_modules/@types/express": { - "version": "4.17.17", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz", - "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==", + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.20.tgz", + "integrity": "sha512-rOaqlkgEvOW495xErXMsmyX3WKBInbhG5eqojXYi3cGUaLoRDlXa5d52fkfWZT963AZ3v2eZ4MbKE6WpDAGVsw==", "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -6847,9 +6919,9 @@ } }, "node_modules/firebase-functions": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-4.4.1.tgz", - "integrity": "sha512-3no53Lg12ToNlPSgLZtAFLQAz6si7ilHvzO8NC3/2EybyUwegpj5YhHwNiCw839lmAWp3znjATJDTvADFiZMrg==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-4.5.0.tgz", + "integrity": "sha512-y6HsasHtGLfXCp3Pfrz+JA19lO9hSzYiNxFDIDMffrfcsG7UbXzv0zfi2ASadMVRoDCaox5ppZBa1QJxZbctPQ==", "dependencies": { "@types/cors": "^2.8.5", "@types/express": "4.17.3", @@ -7917,9 +7989,9 @@ } }, "node_modules/image-hash": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/image-hash/-/image-hash-5.3.1.tgz", - "integrity": "sha512-tIOI//XqSnuzb60PBGPoulXNWWAZ2gww2z9P2VYgLpoCl3x8YwlhDVaR/1fgxTZObRshwEcaXYax4zF9MXBCKQ==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/image-hash/-/image-hash-5.3.2.tgz", + "integrity": "sha512-of8SekDXKFoaK4R93dP/Lzw6+NRGag8Jr9YlIIZ9jJVn9KYLfYVo/ARbKtbRn+tdTz/wDzBObx6yflKpLSYbxA==", "dependencies": { "@cwasm/webp": "^0.1.5", "file-type": "^16.5.3", @@ -12430,12 +12502,71 @@ } }, "@babel/code-frame": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", - "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "requires": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "@babel/compat-data": { @@ -12482,12 +12613,12 @@ } }, "@babel/generator": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", - "integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "requires": { - "@babel/types": "^7.21.4", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -12597,9 +12728,9 @@ } }, "@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true }, "@babel/helper-explode-assignable-expression": { @@ -12612,22 +12743,22 @@ } }, "@babel/helper-function-name": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", - "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "requires": { - "@babel/template": "^7.20.7", - "@babel/types": "^7.21.0" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" } }, "@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" } }, "@babel/helper-member-expression-to-functions": { @@ -12724,24 +12855,24 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" } }, "@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", "dev": true }, "@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true }, "@babel/helper-validator-option": { @@ -12774,13 +12905,13 @@ } }, "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "dependencies": { @@ -12843,9 +12974,9 @@ } }, "@babel/parser": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", - "integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "devOptional": true }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { @@ -13665,30 +13796,30 @@ } }, "@babel/template": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", - "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" } }, "@babel/traverse": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", - "integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.4", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.21.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.4", - "@babel/types": "^7.21.4", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -13702,13 +13833,13 @@ } }, "@babel/types": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", - "integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "requires": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" } }, @@ -15746,9 +15877,9 @@ } }, "@types/express": { - "version": "4.17.17", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz", - "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==", + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.20.tgz", + "integrity": "sha512-rOaqlkgEvOW495xErXMsmyX3WKBInbhG5eqojXYi3cGUaLoRDlXa5d52fkfWZT963AZ3v2eZ4MbKE6WpDAGVsw==", "requires": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -17862,9 +17993,9 @@ } }, "firebase-functions": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-4.4.1.tgz", - "integrity": "sha512-3no53Lg12ToNlPSgLZtAFLQAz6si7ilHvzO8NC3/2EybyUwegpj5YhHwNiCw839lmAWp3znjATJDTvADFiZMrg==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-4.5.0.tgz", + "integrity": "sha512-y6HsasHtGLfXCp3Pfrz+JA19lO9hSzYiNxFDIDMffrfcsG7UbXzv0zfi2ASadMVRoDCaox5ppZBa1QJxZbctPQ==", "requires": { "@types/cors": "^2.8.5", "@types/express": "4.17.3", @@ -18585,9 +18716,9 @@ "dev": true }, "image-hash": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/image-hash/-/image-hash-5.3.1.tgz", - "integrity": "sha512-tIOI//XqSnuzb60PBGPoulXNWWAZ2gww2z9P2VYgLpoCl3x8YwlhDVaR/1fgxTZObRshwEcaXYax4zF9MXBCKQ==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/image-hash/-/image-hash-5.3.2.tgz", + "integrity": "sha512-of8SekDXKFoaK4R93dP/Lzw6+NRGag8Jr9YlIIZ9jJVn9KYLfYVo/ARbKtbRn+tdTz/wDzBObx6yflKpLSYbxA==", "requires": { "@cwasm/webp": "^0.1.5", "file-type": "^16.5.3", diff --git a/functions/package.json b/functions/package.json index 373dc964..7fa348e2 100644 --- a/functions/package.json +++ b/functions/package.json @@ -3,7 +3,7 @@ "description": "Cloud Functions for Firebase", "scripts": { "lint": "", - "serve": "firebase emulators:start", + "serve": "firebase emulators:start --project checkmate-uat", "shell": "firebase functions:shell", "start": "npm run shell", "predeploy": "npm run build", @@ -25,7 +25,7 @@ "express": "^4.18.2", "firebase": "^9.15.0", "firebase-admin": "^11.4.1", - "firebase-functions": "^4.4.1", + "firebase-functions": "^4.5.0", "googleapis": "^112.0.0", "hashids": "^2.3.0", "image-hash": "^5.3.1", @@ -39,7 +39,7 @@ "@babel/core": "^7.21.4", "@babel/preset-env": "^7.21.4", "@babel/preset-typescript": "^7.21.4", - "@types/express": "^4.17.17", + "@types/express": "^4.17.20", "@types/jest": "^29.5.1", "@types/node-telegram-bot-api": "^0.61.8", "@types/supertest": "^2.0.12", diff --git a/functions/src/definitions/api/api.ts b/functions/src/definitions/api/api.ts index d25412c2..6194fa57 100644 --- a/functions/src/definitions/api/api.ts +++ b/functions/src/definitions/api/api.ts @@ -37,7 +37,7 @@ main.use("/api", app) const apiHandler = onRequest( { - secrets: ["TELEGRAM_BOT_TOKEN"], + secrets: ["TELEGRAM_CHECKER_BOT_TOKEN"], }, main ) diff --git a/functions/src/definitions/api/authentication.ts b/functions/src/definitions/api/authentication.ts index 630d5fc6..c303700e 100644 --- a/functions/src/definitions/api/authentication.ts +++ b/functions/src/definitions/api/authentication.ts @@ -14,7 +14,7 @@ const CHECKER1_PHONE_NUMBER: string = String(process.env.CHECKER1_PHONE_NUMBER) app.post("/", async (req, res) => { const initData = req.body // Assuming you send initData in the body of your requests - const botToken = String(process.env.TELEGRAM_BOT_TOKEN) // Replace with your bot token + const botToken = String(process.env.TELEGRAM_CHECKER_BOT_TOKEN) // Replace with your bot token // Extract the data from initData (convert from query string format) const params = new URLSearchParams(initData) @@ -99,7 +99,7 @@ main.use("/telegramAuth", app) const telegramAuthHandler = onRequest( { - secrets: ["TELEGRAM_BOT_TOKEN"], + secrets: ["TELEGRAM_CHECKER_BOT_TOKEN"], }, main ) diff --git a/functions/src/definitions/common/constants.ts b/functions/src/definitions/common/constants.ts deleted file mode 100644 index 6c5ec081..00000000 --- a/functions/src/definitions/common/constants.ts +++ /dev/null @@ -1,239 +0,0 @@ -const USER_BOT_RESPONSES = { - UNTRUE: `{{thanks}}{{matched}}{{methodology}}*untrue*.❌ - -Please do not spread it further⛔️⛔️ - -Thank you for keeping Singapore informed!`, - - MISLEADING: `{{thanks}}{{matched}}{{methodology}}*presented in a misleading or unbalanced way*, even though some elements within could be true!⚠️ - -Please take it with a pinch of salt and think twice before spreading it further🚧🚧. - -Thank you for keeping Singapore informed!`, - - ACCURATE: `{{thanks}}{{matched}}{{methodology}}*accurate*.✅ - -Thank you for keeping Singapore informed!`, - - ERROR: `Oops, we encountered an error assessing this message. - -You can try sending the message in again, or report the error via our form at https://bit.ly/checkmate-feedback. Sorry about that! 😔`, - - MESSAGE_NOT_YET_ASSESSED: - "Hello! 👋 Thanks for sending this in! Our *CheckMates🕵🏻 will review this* and *provide the results soon*.", - - //button - SCAM: `{{thanks}}{{matched}}{{methodology}}*a scam*!🚫 - -We recommend you do not engage further⛔️⛔️ - -CheckMate will report suspicious messages to ScamShield (https://scamshield.org.sg) on your behalf. - -To avoid reporting this message, select "Don't report this" below.`, - - //button - ILLICIT: `{{thanks}}{{matched}}{{methodology}}*suspicious*!🚨 - -We recommend you do not engage further⛔️⛔️ - -CheckMate will report suspicious messages to ScamShield (https://scamshield.org.sg) on your behalf. - -To avoid reporting this message, select "Don't report this" below.`, - - SPAM: `{{thanks}}{{matched}}{{methodology}}spam!🚧 - -It's likely harmless, but you should always make sure 🧐 - -Thank you for keeping Singapore safe!`, - - LEGITIMATE: `{{thanks}}{{matched}}{{methodology}}*from a legitimate source*.✅ - -Thank you for keeping Singapore safe!`, - - UNSURE: `{{thanks}} - -Unfortunately, our CheckMates are *unsure about this message*🤷🏻‍♂️🤷🏻‍♀️. Sorry, we're human too! 😞 - -If you haven't done so, you could send in the message with more context, e.g. sending in a screenshot containing the sender's number. - -Thank you for keeping Singapore safe!`, - - THANKS_IMMEDIATE: `Thanks for sending this in! `, - - THANKS_DELAYED: `Thanks for waiting! `, - - METHODOLOGY_HUMAN: `Our CheckMates have reviewed this message and think it's `, - - METHODOLOGY_AUTO: `Based on pattern matching, our auto-classifier is confident that this message is `, - - //not used - MATCHED: `In fact, other users have sent this message in {{numberInstances}} times. `, - - UNSUPPORTED_TYPE: - "Sorry, CheckMate currently doesn't support this type of message.", - - SCAMSHIELD_EXPLAINER: - "ScamShield is an anti-scam product developed by the National Crime Prevention Council and Open Government Products. You can learn more at https://scamshield.org.sg.", - - //not used - STATS_TEMPLATE: `{{top}}% of our CheckMates identified this as *{{category1}}**{{info_placeholder}}*. *{{second}}*% felt this was *{{category2}}*.`, - - //button - INTERIM_TEMPLATE: `At this time, {{%voted}}% of our CheckMates have assessed and voted on this message. The majority think is that this {{prelim_assessment}}{{info_placeholder}}. - -NOTE: This is a *preliminary result*. We aim to provide you with a more credible final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.{{get_feedback}}`, - - INTERIM_TEMPLATE_UNSURE: `At this time, {{%voted}}% of our CheckMates have assessed and voted on this message. Unfortunately, our CheckMates either have not reached any clear consensus, or are still unsure how to assess the message at this time. - -If you haven't done so, you could send in the message with more context, e.g. sending in a screenshot containing the sender's number.`, - - INTERIM_FEEDBACK: ` - -Thanks for trusting CheckMate! 👋🏼 If this interim update was useful to you, we'd appreciate it if you'd let us know by tapping on “Yes, it's useful” below. Otherwise, tap on “No, it's not” to continue waiting for the final result. Either way, you can continue to request more updates as more votes come in.`, - - //button - INTERIM_PROMPT: `Thanks for waiting! We are currently still pending the assessment from some of our network of trusted CheckMate volunteers and will only be able to provide a credible final result once enough votes have come in. - -You may press the button below *to get an interim update of the preliminary result*. However, do note that there may be discrepancies between the preliminary and the final result, and *the preliminary result should be interpreted with caution*. We appreciate your patience and hope to deliver the final result to you soon! 💪🏼`, - - INTERIM_USEFUL: `Thanks for your valuable feedback! We will provide you with the final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message. - -In the meantime, if you'd like another update after more votes come in, just tap the button below to request one.`, - - INTERIM_NOT_USEFUL: `Sorry to hear that, but thanks anyway for your valuable feedback! We will provide you with the final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message. - -If you'd like still another update after more votes come in, just tap the button below to request one.`, - - ALREADY_REPLIED: `CheckMate has already provided a final response to this message.`, - - SCAMSHIELD_ON_DECLINE: `No worries! We will not send your message to ScamShield. Thank you for sharing this message with us, and for keeping Singapore safe!`, - - //menu text list - MENU: `{{prefix}} - -If you know what to do, please go ahead! Else, select "View Menu" below to see what CheckMate can do! 👈 - -Do note that CheckMate *is designed to check dubious messages you send in. It cannot converse freely with you*. - -Anytime you need a refresher on what CheckMate can do, type "menu" to get here again! 😊`, - - //menu text list prefix - NEW_USER_MENU_PREFIX: `Hello and welcome to CheckMate! We noticed it's your first time here. We're glad you've joined us to battle scams and misinformation😊.`, - - //menu text list prefix - IRRELEVANT_MENU_PREFIX: `Thanks for waiting!🙏🏻 Our CheckMates didn't find anything to assess in this message.😕`, - - //menu text list prefix - IRRELEVANT_AUTO_MENU_PREFIX: `Hmm...There doesn't seem to be anything to assess in this message.😕`, - - //menu text list prefix - MENU_PREFIX: `Hi! Thanks for using CheckMate. 🙏🏻`, - - PROCEED_TO_SEND: `Nice! Just send/forward us the message. We'll help you check and/or report it! ✅✅ - -If you like, you can also send in screenshots 📷 or other images 🖼️! This can help to capture the sender's number, or a full conversation, which could help our CheckMates' assessment. - -One last thing: by continuing to use CheckMate, you're agreeing to our privacy policy, which can be found at https://checkmate.sg/privacy-policy. In short, we only collect the messages sent to us and your number to facilitate a response!`, - - HOW_TO: `Check out https://youtube.com/shorts/gFeO_qFOchs?feature=share to see how CheckMate works! - -Done? You're now ready to use CheckMate! Let's do our part in the fight against scams and misinformation! 💪`, - - LEARN_MORE: `To learn more about CheckMate, you can visit our website at https://checkmate.sg`, - - FEEDBACK: `You can submit feedback at https://bit.ly/checkmate-feedback. Rest assured, we'll read it ASAP!`, - - DISPUTE: `Thanks for letting us know! Our CheckMates will review the assessment of this message.`, - - CONTACT: `Here's our contact! Do add us to your contact list so you can find us in future. 😊`, - - REFERRAL: `Have you started checking and reporting suspicious messages using CheckMate yet? Sign up by clicking this link and sending in the pre-loaded message!! {{link}}`, - - REFERRAL_PREPOPULATED_PREFIX: `Welcome to CheckMate! Send in this entire message (including the code) to get started, and credit your friend with your referral. Code:`, - - GENERIC_PREPOPULATED_PREFIX: `Welcome to Checkmate! Send in this entire message (including the code) to get started. Code:`, - - REFERRAL_INVALID: `Sorry, referrals are only credited upon your first interaction with CheckMate.`, - - GENERIC_ERROR: `Sorry, an error occured. 😔 We'll be looking into this! Meanwhile, you can try out other functions of the bot. Apologies!`, - - SATISFACTION_SURVEY: `Thanks so much for using CheckMate🙏. We're improving the product from time to time, and your feedback is valuable to us. - -On a scale from 1-10, how likely are you to recommend us to a friend, colleague or family member?`, - - SATISFACTION_SURVEY_THANKS: `Thanks for your feedback!`, - - HOWD_WE_TELL: `*This is an experimental feature powered by generative AI*. Do let us know if it was useful below! - -{{rationalisation}}`, - RATIONALISATION_USEFUL: `Thanks for your valuable feedback!`, - - RATIONALISATION_NOT_USEFUL: `Sorry to hear that, but thanks anyway for your valuable feedback!`, -} - -const FACTCHECKER_BOT_RESPONSES = { - VOTE_NO: - "No problem! If you wish to come back and assess the message, you may do so by clicking the 'yes' button. See you soon!😊", - - //text list - FACTCHECK_PROMPT: - "Please assess the veracity of the claim(s) in this message on a scale from 0 to 5, where 0 means the claim(s) are entirely false, and 5 means the claim(s) are entirely true.", - - //text list - L1_ASSESSMENT_PROMPT: - "Which of these categories best describes this message?", - - //text list - L2_OTHERS_ASSESSEMENT_PROMPT: - "Which of these subcategories best describes this message?", - - RESPONSE_RECORDED: - "Got it! Your response has been recorded. Thank you for playing your part in the fight against scams and misinformation, one message at a time! 💪", - - HOLD_FOR_NEXT_POLL: - "Got it👍! Please hold for another poll to vote on how true the message is.", - - HOLD_FOR_L2_CATEGORISATION: "Got it👍! Please hold for another selection.", - - ONBOARDING_1: - "Welcome to our community of CheckMates! 👋🏻 We're grateful to have you on board to combat misinformation and scams. 🙇‍♀️🙇🏻 We'd love to get to know you better - could you *reply to this message* and share your name with us? (Reply to this message by swiping right)!", - - ONBOARDING_2: - "Thank you and welcome, {{name}}! We're thrilled to have you on board as we work together to combat misinformation and scams.😊 By using the CheckMate bot, you are accepting our privacy policy which can be found here: https://bit.ly/checkmate-privacy", - - ONBOARDING_3: `To ensure you're equipped with the necessary skills to identify misinformation and scams, let's start with a quick quiz. 📝 Simply follow the link (https://bit.ly/checkmates-quiz) to take the quiz. Once you've completed it, come back to this chat and click on "I've done the quiz!" to notify me. Let's get started! 🤖`, - - ONBOARDING_4: `Awesome! Now that you know how to identify misinformation and scams, you are ready to help us combat them! 🙌🏻 If you haven't already, do join this WhatsApp group (https://bit.ly/checkmates-groupchat) that brings together all the other CheckMates and the core product team for updates and feedback. If you're looking for resources, you can visit our wiki page (https://bit.ly/checkmates-wiki). Thanks again for joining our community of CheckMates. Enjoy! 👋🏻🤖`, - - NOT_A_REPLY: - "Sorry, did you forget to reply to a message? You need to swipe right on the message to reply to it.", - - //button - OUTSTANDING_REMINDER: - "You have *{{num_outstanding}} remaining messages* to assess. Would you like to be sent the next one in line?", - - NO_OUTSTANDING: - "Great, you have no further messages to assess. Keep it up!💪", -} - -const env = process.env.ENVIRONMENT - -const thresholds = { - endVote: 0.5, - endVoteSus: 0.2, - endVoteUnsure: 0.8, - startVote: 1, - isSpam: 0.5, - isLegitimate: 0.5, - isInfo: 0.5, - isIrrelevant: 0.5, - isUnsure: 0.5, - isSus: 0.5, - falseUpperBound: 1.5, - misleadingUpperBound: 3.5, - sendInterimMinVotes: 1, - surveyLikelihood: env !== "PROD" ? 1 : 0.25, - satisfactionSurveyCooldownDays: 30, -} - -export { USER_BOT_RESPONSES, FACTCHECKER_BOT_RESPONSES, thresholds } diff --git a/functions/src/definitions/common/parameters/checkerResponses.json b/functions/src/definitions/common/parameters/checkerResponses.json new file mode 100644 index 00000000..2300193c --- /dev/null +++ b/functions/src/definitions/common/parameters/checkerResponses.json @@ -0,0 +1,16 @@ +{ + "VOTE_NO": "No problem! If you wish to come back and assess the message, you may do so by clicking the 'yes' button. See you soon!😊", + "FACTCHECK_PROMPT": "Please assess the veracity of the claim(s) in this message on a scale from 0 to 5, where 0 means the claim(s) are entirely false, and 5 means the claim(s) are entirely true.", + "L1_ASSESSMENT_PROMPT": "Which of these categories best describes this message?", + "L2_OTHERS_ASSESSEMENT_PROMPT": "Which of these subcategories best describes this message?", + "RESPONSE_RECORDED": "Got it! Your response has been recorded. Thank you for playing your part in the fight against scams and misinformation, one message at a time! 💪", + "HOLD_FOR_NEXT_POLL": "Got it👍! Please hold for another poll to vote on how true the message is.", + "HOLD_FOR_L2_CATEGORISATION": "Got it👍! Please hold for another selection.", + "ONBOARDING_1": "Welcome to our community of CheckMates! 👋🏻 We're grateful to have you on board to combat misinformation and scams. 🙇‍♀️🙇🏻 We'd love to get to know you better - could you *reply to this message* and share your name with us? (Reply to this message by swiping right)!", + "ONBOARDING_2": "Thank you and welcome, {{name}}! We're thrilled to have you on board as we work together to combat misinformation and scams.😊 By using the CheckMate bot, you are accepting our privacy policy which can be found here: https://bit.ly/checkmate-privacy", + "ONBOARDING_3": "To ensure you're equipped with the necessary skills to identify misinformation and scams, let's start with a quick quiz. 📝 Simply follow the link (https://bit.ly/checkmates-quiz) to take the quiz. Once you've completed it, come back to this chat and click on \"I've done the quiz!\" to notify me. Let's get started! 🤖", + "ONBOARDING_4": "Awesome! Now that you know how to identify misinformation and scams, you are ready to help us combat them! 🙌🏻 If you haven't already, do join this WhatsApp group (https://bit.ly/checkmates-groupchat) that brings together all the other CheckMates and the core product team for updates and feedback. If you're looking for resources, you can visit our wiki page (https://bit.ly/checkmates-wiki). Thanks again for joining our community of CheckMates. Enjoy! 👋🏻🤖", + "NOT_A_REPLY": "Sorry, did you forget to reply to a message? You need to swipe right on the message to reply to it.", + "OUTSTANDING_REMINDER": "You have *{{num_outstanding}} remaining messages* to assess. Would you like to be sent the next one in line?", + "NO_OUTSTANDING": "Great, you have no further messages to assess. Keep it up!💪" +} diff --git a/functions/src/definitions/common/parameters/thresholds.json b/functions/src/definitions/common/parameters/thresholds.json new file mode 100644 index 00000000..b78eab6f --- /dev/null +++ b/functions/src/definitions/common/parameters/thresholds.json @@ -0,0 +1,17 @@ +{ + "endVote": 0.5, + "endVoteSus": 0.2, + "endVoteUnsure": 0.8, + "startVote": 1, + "isSpam": 0.5, + "isLegitimate": 0.5, + "isInfo": 0.5, + "isIrrelevant": 0.5, + "isUnsure": 0.5, + "isSus": 0.5, + "falseUpperBound": 1.5, + "misleadingUpperBound": 3.5, + "sendInterimMinVotes": 1, + "surveyLikelihood": 1, + "satisfactionSurveyCooldownDays": 30 +} diff --git a/functions/src/definitions/common/parameters/userResponses.json b/functions/src/definitions/common/parameters/userResponses.json new file mode 100644 index 00000000..5134f414 --- /dev/null +++ b/functions/src/definitions/common/parameters/userResponses.json @@ -0,0 +1,358 @@ +{ + "UNTRUE": { + "en": "{{thanks}}{{matched}}{{methodology}}*untrue*.❌{{image_caveat}}\n\nPlease do not spread it further⛔️⛔️\n\nThank you for keeping Singapore informed!", + "cn": "{thanks}}{{matched}}{{methodology}}不属实。❌{{image_caveat}}\n\n请不要转发⛔️⛔️\n\n感谢您对新加坡网络安全的支持和贡献!\n" + }, + "MISLEADING": { + "en": "{{thanks}}{{matched}}{{methodology}}*presented in a misleading or unbalanced way*, even though some elements within could be true!⚠️{{image_caveat}}\n\nPlease take it with a pinch of salt and think twice before spreading it further🚧🚧.\n\nThank you for keeping Singapore informed!", + "cn": "{{thanks}}{{matched}}{{methodology}}虽然包含一些真实的信息,但它存在误导性或缺乏公正性。⚠️{{image_caveat}}\n\n在分享之前,请三思🚧🚧。\n\n感谢您对新加坡网络安全的支持和贡献!" + }, + "ACCURATE": { + "en": "{{thanks}}{{matched}}{{methodology}}*accurate*.✅{{image_caveat}}\n\nThank you for keeping Singapore informed!", + "cn": "{{thanks}}{{matched}}{{methodology}}是准确的。✅{{image_caveat}}\n\n感谢您对新加坡网络安全的支持和贡献!" + }, + "ERROR": { + "en": "Oops, we encountered an error assessing this message.\n\nYou can try sending the message in again, or report the error via our form at https://bit.ly/checkmate-feedback. Sorry about that! 😔", + "cn": "抱歉,查友在评估您提供的短信时发生问题。\n\n欢迎您稍后重试,或者通过这份表格向我们反馈:https://bit.ly/checkmate-feedback。对此造成的不便,我们非常抱歉!😔" + }, + "MESSAGE_NOT_YET_ASSESSED": { + "en": "Hello! 👋 Thanks for sending this in! Our *CheckMates🕵🏻 will review this* and *provide the results soon*.", + "cn": "你好!👋 感谢您使用查友!我们的查哥查妹🕵🏻会尽快评估这条短信并回复。" + }, + "SCAM": { + "en": "{{thanks}}{{matched}}{{methodology}}*a scam*!🚫{{image_caveat}}\n\nWe recommend you do not engage further⛔️⛔️\n\nCheckMate will report suspicious messages to ScamShield (https://scamshield.org.sg) on your behalf.\n\nTo avoid reporting this message, select \"Don't report this\" below.", + "cn": "{{thanks}}{{matched}}{{methodology}}是诈骗信息! 🚫{{image_caveat}}\n\n建议您停止交流⛔️⛔️\n\n查友会代表您向ScamShield (https://scamshield.org.sg) 举报这条可疑的短信。\n\n如果您不想举报此短信,请选择\"不举报\"。" + }, + "ILLICIT": { + "en": "{{thanks}}{{matched}}{{methodology}}*suspicious*!🚨{{image_caveat}}\n\nWe recommend you do not engage further⛔️⛔️\n\nCheckMate will report suspicious messages to ScamShield (https://scamshield.org.sg) on your behalf.\n\nTo avoid reporting this message, select \"Don't report this\" below.", + "cn": "{{thanks}}{{matched}}{{methodology}}很可疑!🚨{{image_caveat}}\n\n建议您停止交流⛔️⛔️\n\n查友会代表您向ScamShield (https://scamshield.org.sg) 举报这条可疑的短信。\n\n如果您不想举报此短信,请选择\"不举报\"。" + }, + "SPAM": { + "en": "{{thanks}}{{matched}}{{methodology}}spam!🚧{{image_caveat}}\n\nIt's likely harmless, but you should always make sure 🧐\n\nThank you for keeping Singapore safe!", + "cn": "{{thanks}}{{matched}}{{methodology}}是垃圾信息!🚧{{image_caveat}}\n\n虽然它看似无害,但仍然请您保持警惕 🧐\n\n感谢您对新加坡网络安全的支持和贡献!" + }, + "LEGITIMATE": { + "en": "{{thanks}}{{matched}}{{methodology}}*from a legitimate source*.✅{{image_caveat}}\n\nThank you for keeping Singapore safe!", + "cn": "{{thanks}}{{matched}}{{methodology}}的来源是可靠的。✅{{image_caveat}}\n\n感谢您对新加坡网络安全的支持和贡献!" + }, + "UNSURE": { + "en": "{{thanks}}\n\nUnfortunately, our CheckMates are *unsure about this message*🤷🏻‍♂️🤷🏻‍♀️. Sorry, we're human too!😞\n\nIf you haven't done so, you could send in the message with more context, e.g. sending in a screenshot containing the sender's number.\n\nThank you for keeping Singapore safe!", + "cn": "{{thanks}}\n\n抱歉,我们的查哥查妹对这条短信无法得出结论🤷🏻‍♂️🤷🏻‍♀️。对不起,我们尽力了!😞\n\n如果您能提供更多信息,例如发信人电话号码或截图,将有助于我们更好地评估。\n\n感谢您对新加坡网络安全的支持和贡献!" + }, + "THANKS_IMMEDIATE": { + "en": "Thanks for sending this in!", + "cn": "感谢您提交这条短信!" + }, + "THANKS_DELAYED": { + "en": "Thanks for waiting!", + "cn": "感谢您的耐心等待!" + }, + "IMAGE_CAVEAT": { + "en": "This assessment refers to any claims made within the captions. If there are no claims/captions, it refers to the image itself.", + "cn": "我们的评估基于图片标题中的内容。如果您提交的短信里没有文字标题,我们对图片本身的内容进行了评估。" + }, + "METHODOLOGY_HUMAN": { + "en": "Our CheckMates have reviewed this message and think it's", + "cn": "经过查哥查妹的评估,我们认为这条短信" + }, + "METHODOLOGY_AUTO": { + "en": "Based on pattern matching, our auto-classifier is confident that this message is ", + "cn": "根据我们的AI技术,我们认为这条短信" + }, + "MATCHED": { + "en": "In fact, other users have sent this message in {{numberInstances}} times. ", + "cn": "其实查友已收到{{numberInstances}}条同样的短信。" + }, + "UNSUPPORTED_TYPE": { + "en": "Sorry, CheckMate currently doesn't support this type of message.", + "cn": "对不起,查友目前不支持这类短信。" + }, + "STATS_TEMPLATE_1": { + "en": "{{top}}% of our CheckMates felt this was *{{category}}*{{info_placeholder}}.", + "cn": "{{top}}%的查哥查妹认为这条短信{{category}}{{info_placeholder}}。" + }, + "STATS_TEMPLATE_2": { + "en": " {{second}}% felt this was *{{category}}*{{info_placeholder}}.", + "cn": "另外{{second}}%的人认为这条短信{{category}}{{info_placeholder}}。" + }, + "INTERIM_TEMPLATE": { + "en": "At this time, {{%voted}}% of our CheckMates have assessed and voted on this message. The majority think that this is {{prelim_assessment}}{{info_placeholder}}. \n\nNOTE: This is a *preliminary result*. We aim to provide you with a more credible final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.{{get_feedback}}", + "cn": "目前,{{%voted}}%的查哥查妹已经对这条短信进行投票评估。大多数人认为这条短信{{prelim_assessment}}{{info_placeholder}}。\n\n注意:这只是初步结果。我们将在更多的查哥查妹投票后,或在您提交短信的24小时内,为您提供最终的结果。{{get_feedback}}" + }, + "INFO_PLACEHOLDER": { + "en": ", with an average score of {{score}} on a scale of 0-5 (5 = completely true)", + "cn": "在0 - 5的评分内,平均投票分数为{{score}}(5 = 完全正确)" + }, + "INTERIM_TEMPLATE_UNSURE": { + "en": "At this time, {{%voted}}% of our CheckMates have assessed and voted on this message. Unfortunately, our CheckMates either have not reached any clear consensus, or are still unsure how to assess the message at this time.\n\nIf you haven't done so, you could send in the message with more context, e.g. sending in a screenshot containing the sender's number.", + "cn": "目前,{%voted}}%的查哥查妹已经对这条短信进行投票评估。不幸的是,他们无法达成一致,或缺乏足够的信息进行评估。\n\n如果您能提供更多信息,例如发信人电话号码或截图,将有助于我们更好地评估。" + }, + "INTERIM_FEEDBACK": { + "en": "\n\nThanks for trusting CheckMate! 👋🏼 If this interim update was useful to you, we'd appreciate it if you'd let us know by tapping on “Yes, it's useful” below. Otherwise, tap on “No, it's not” to continue waiting for the final result. Either way, you can continue to request more updates as more votes come in.", + "cn": "感谢您对查友的信任!👋🏼 如果这个初步结果对您有帮助,请点击“有帮助”。否则,请点击“没帮助”以继续等待最终结果。您可以在最终结果发布之前随时要求最新的初步结果。" + }, + "INTERIM_PROMPT": { + "en": "Thanks for waiting! We are currently still pending the assessment from some of our network of trusted CheckMate volunteers and will only be able to provide a credible final result once enough votes have come in. \n\nYou may press the button below *to get an interim update of the preliminary result*. However, do note that there may be discrepancies between the preliminary and the final result, and *the preliminary result should be interpreted with caution*. We appreciate your patience and hope to deliver the final result to you soon! 💪🏼", + "cn": "感谢您的耐心等待!查哥查妹正在对您提交的短信进行投票评估。我们将在足够多的查哥查妹票后,为您提供最终结果。\n\n在最终结果发布之前,您可以点击获取初步结果。请注意,初步结果和最终结果之间可能存在差异,应谨慎解读初步结果。我们感谢您的耐心,并希望尽快为您提供最终结果!💪🏼" + }, + "INTERIM_USEFUL": { + "en": "Thanks for your valuable feedback! We will provide you with the final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.\n\nIn the meantime, if you'd like another update after more votes come in, just tap the button below to request one.", + "cn": "感谢您的反馈!我们将在更多的查哥查妹投票后,或在您提交短信的24小时内,为您提供最终的结果。\n\n请点击下方按钮再次获取最新的初步结果。" + }, + "INTERIM_NOT_USEFUL": { + "en": "Sorry to hear that, but thanks anyway for your valuable feedback! We will provide you with the final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.\n\nIf you'd like still another update after more votes come in, just tap the button below to request one.", + "cn": "感谢您的反馈!我们将在更多的查哥查妹投票后,或在您提交短信的24小时内,尽快为您提供最终的结果。\n\n请点击下方按钮再次获取最新的初步结果。" + }, + "ALREADY_REPLIED": { + "en": "CheckMate has already provided a final response to this message.", + "cn": "查友已经对这条短信做出最终回应。" + }, + "SCAMSHIELD_ON_DECLINE": { + "en": "No worries! We will not send your message to ScamShield. Thank you for sharing this message with us, and for keeping Singapore safe!", + "cn": "我们不会将您的短信发送给ScamShield。感谢您与我们分享这条短信,也感谢您对新加坡网络安全的支持和贡献。" + }, + "MENU": { + "en": "{{prefix}}\n\nIf you know what to do, please go ahead! Else, select \"Menu\" below to see what CheckMate can do! 👈\n\nDo note that CheckMate *is designed to check dubious messages you send in. It cannot converse freely with you*.\n\nAnytime you need a refresher on what CheckMate can do, type \"menu\" to get here again! 😊", + "cn": "{{prefix}}\n\n请点击“菜单\"查看查友的功能!👈\n\n请注意,查友仅能评估您发送的短信,它无法与您进行对话。\n\n您只需输入\"菜单\"即可随时返回这里,查看查友的功能!😊" + }, + "NEW_USER_PREFIX_EN": { + "en": "Hello and welcome to CheckMate! We're glad you've joined us to battle scams and misinformation😊.", + "cn": "Hello and welcome to CheckMate! We're glad you've joined us to battle scams and misinformation😊." + }, + "NEW_USER_PREFIX_CN": { + "en": "您好,欢迎来到查友!我们很高兴您加入我们,一起对抗诈骗和误导信息😊。\n", + "cn": "您好,欢迎使用查友!很高兴您加入我们,一起参与反击诈骗和虚假信息😊。\n" + }, + "LANGUAGE_SELECTION": { + "en": "{{new_user_en}}\n\nPlease select your preferred language.\n\n{{new_user_cn}}请选择语言。", + "cn": "{{new_user_en}}\n\nPlease select your preferred language.\n\n{{new_user_cn}}请选择语言。" + }, + "IRRELEVANT_MENU_PREFIX": { + "en": "Thanks for waiting!🙏🏻 Our CheckMates didn't find anything to assess in this message.😕", + "cn": "感谢您的耐心等待!🙏🏻 我们的查哥查妹没有在这条短信中找到可以评估的内容。😕" + }, + "IRRELEVANT_AUTO_MENU_PREFIX": { + "en": "Hmm...There doesn't seem to be anything to assess in this message.😕", + "cn": "嗯...这条短信似乎没有可以评估的内容。😕" + }, + "MENU_PREFIX": { + "en": "Hi! Thanks for using CheckMate. 🙏🏻", + "cn": "您好!感谢您使用查友。🙏🏻" + }, + "PROCEED_TO_SEND": { + "en": "Nice! Just send/forward us the message. We'll help you check and/or report it! ✅✅\n\nIf you like, you can also send in screenshots 📷 or other images 🖼️! This can help to capture the sender's number, or a full conversation, which could help our CheckMates' assessment.\n\nOne last thing: by continuing to use CheckMate, you're agreeing to our privacy policy, which can be found at https://checkmate.sg/privacy-policy. In short, we only collect the messages sent to us and your number to facilitate a response!", + "cn": "好的!您只需将短信发送给查友,我们会对其进行评估!✅✅\n\n除了文字信息,您也可以发送截图📷或其他图片🖼️!这有助于查哥查妹通过发信人号码或完整的对话内容做出判断。\n\n最后,使用查友即表示您已同意我们的隐私政策。您可在 https://checkmate.sg/privacy-policy 查看我们的隐私政策。基本上,我们只收集您发送的消息以及您的手机号码,以便回复您!" + }, + "HOW_TO": { + "en": "Check out https://youtube.com/shorts/gFeO_qFOchs?feature=share to see how CheckMate works!\n\nDone? You're now ready to use CheckMate! Let's do our part in the fight against scams and misinformation! 💪", + "cn": "了解查友是如何运行的:https://youtube.com/shorts/gFeO_qFOchs?feature=share\n\n准备好了吗?您可以开始使用查友了!让我们一起为反击诈骗和虚假信息做出贡献!💪" + }, + "LEARN_MORE": { + "en": "To learn more about CheckMate, you can visit our website at https://checkmate.sg", + "cn": "若想了解有关查友的更多信息,您可以访问我们的网站 https://checkmate.sg" + }, + "FEEDBACK": { + "en": "You can submit feedback at https://bit.ly/checkmate-feedback. Rest assured, we'll read it ASAP!", + "cn": "您可以在 https://bit.ly/checkmate-feedback 提供反馈。我们会尽快查看!" + }, + "DISPUTE": { + "en": "Thanks for letting us know! Our CheckMates will review the assessment of this message.", + "cn": "感谢您的反馈!我们的查哥查妹将会重新评估这条短信。" + }, + "CONTACT": { + "en": "Here's our contact! Do add us to your contact list so you can find us in future. 😊", + "cn": "这是我们的联系方式!请将我们添加到您的联系人列表中,以便您以后能找到我们。😊" + }, + "REFERRAL": { + "en": "Have you started checking and reporting suspicious messages using CheckMate yet? Sign up by clicking this link and sending in the pre-loaded message!! {{link}}", + "cn": "您是否已经开始使用查友?点击此链接进行注册!{{link}}" + }, + "REFERRAL_PREPOPULATED_PREFIX": { + "en": "Welcome to CheckMate! Send in this entire message (including the code) to get started, and credit your friend with your referral. Code:", + "cn": "欢迎使用查友!请发送这条短信(包括推荐人代码)以开始使用。代码:" + }, + "GENERIC_PREPOPULATED_PREFIX": { + "en": "Welcome to Checkmate! Send in this entire message (including the code) to get started. Code:", + "cn": "欢迎使用查友!请发送这条短信(包括代码)以开始使用。代码:" + }, + "REFERRAL_INVALID": { + "en": "Sorry, referrals are only credited upon your first interaction with CheckMate.", + "cn": "对不起,推荐人代码仅在您首次与查友互动时才有效。" + }, + "GENERIC_ERROR": { + "en": "Sorry, an error occurred. 😔 We'll be looking into this! Meanwhile, you can try out other functions of the bot. Apologies!", + "cn": "抱歉,查友出现了错误。😔 我们会尽快解决这个问题!您可以尝试使用查友的其他功能。我们再次为此道歉!" + }, + "SATISFACTION_SURVEY": { + "en": "Thanks so much for using CheckMate🙏. We're improving the product from time to time, and your feedback is valuable to us.\n\nOn a scale from 1-10, how likely are you to recommend us to a friend, colleague or family member?", + "cn": "非常感谢您使用查友🙏。您的反馈对于不断改进查友非常重要。\n\n请问在1-10之间,您愿意向朋友、同事或家人推荐查友吗?" + }, + "SATISFACTION_SURVEY_THANKS": { + "en": "Thanks for your feedback!", + "cn": "感谢您的反馈!" + }, + "HOWD_WE_TELL": { + "en": "*This is an experimental feature powered by generative AI*. Do let us know if it was useful below!\n \n{{rationalisation}}", + "cn": "这是一项由AI技术提供的实验性功能。请在下方告诉我们它是否对您有所帮助!\n\n{{rationalisation}}" + }, + "RATIONALISATION_USEFUL": { + "en": "Thanks for your valuable feedback!", + "cn": "感谢您的反馈!" + }, + "RATIONALISATION_NOT_USEFUL": { + "en": "Sorry to hear that, but thanks anyway for your valuable feedback!", + "cn": "很遗憾此功能对您来说不是很有用。 查友已将您的反馈传递给我们的产品团队,以便进一步增强此功能。感谢您的反馈!" + }, + "MENU_BUTTON": { + "en": "Menu", + "cn": "菜单" + }, + "MENU_TITLE_CHECK": { + "en": "Check/Report", + "cn": "查询/举报" + }, + "MENU_DESCRIPTION_CHECK": { + "en": "Send in messages, images, or screenshots for checking!", + "cn": "提交文字内容、图片或截图进行评估" + }, + "MENU_TITLE_REFERRAL": { + "en": "Get Referral Link", + "cn": "获取推荐链接" + }, + "MENU_DESCRIPTION_REFERRAL": { + "en": "Get referral link to forward to others", + "cn": "获取加入查友的推荐链接以转发给好友" + }, + "MENU_TITLE_HELP": { + "en": "Get Help", + "cn": "使用说明" + }, + "MENU_DESCRIPTION_HELP": { + "en": "Find out how to use CheckMate to check or report dubious messages", + "cn": "了解如何使用查友来查询或举报可疑短信" + }, + "MENU_TITLE_ABOUT": { + "en": "About CheckMate", + "cn": "关于查友" + }, + "MENU_DESCRIPTION_ABOUT": { + "en": "Learn more about CheckMate and the team behind it", + "cn": "了解查友及幕后团队" + }, + "MENU_TITLE_FEEDBACK": { + "en": "Send Feedback", + "cn": "反馈" + }, + "MENU_DESCRIPTION_FEEDBACK": { + "en": "Send us feedback on anything to do with CheckMate", + "cn": "给予有关查友的反馈" + }, + "MENU_TITLE_CONTACT": { + "en": "Get Contact", + "cn": "获取联系方式" + }, + "MENU_DESCRIPTION_CONTACT": { + "en": "Get CheckMate's contact to add to your contact list", + "cn": "获取查友的联系方式并添加查友到您的通讯列表" + }, + "MENU_TITLE_DISPUTE": { + "en": "Dispute Assessment", + "cn": "提出异议" + }, + "MENU_DESCRIPTION_DISPUTE": { + "en": "Dispute CheckMate's assesment of this message", + "cn": "对查友的评估提出异议" + }, + "MENU_TITLE_LANGUAGE": { + "en": "Language / 语言", + "cn": "Language / 语言" + }, + "MENU_DESCRIPTION_LANGUAGE": { + "en": "Select Language / 选择语言", + "cn": "Select Language / 选择语言" + }, + "MENU_DESCRIPTION_NPS_LIKELY": { + "en": "Extremely likely 🤩", + "cn": "一定会🤩" + }, + "MENU_DESCRIPTION_NPS_UNLIKELY": { + "en": "Not at all likely 😥", + "cn": "不会😥" + }, + "NPS_MENU_BUTTON": { + "en": "Respond", + "cn": "回应" + }, + "BUTTON_ENGLISH": { + "en": "English", + "cn": "English" + }, + "BUTTON_CHINESE": { + "en": "华语", + "cn": "华语" + }, + "BUTTON_USEFUL": { + "en": "Yes, it's useful", + "cn": "有帮助" + }, + "BUTTON_NOT_USEFUL": { + "en": "No, it's not", + "cn": "没帮助" + }, + "BUTTON_ANOTHER_UPDATE": { + "en": "Get another update", + "cn": "获取初步结果更新" + }, + "BUTTON_GET_INTERIM": { + "en": "Get interim update", + "cn": "获取初步结果" + }, + "BUTTON_RESULTS": { + "en": "See voting results", + "cn": "查看投票结果" + }, + "BUTTON_DECLINE_REPORT": { + "en": "Don't report this", + "cn": "不举报" + }, + "BUTTON_RATIONALISATION": { + "en": "How'd we tell?", + "cn": "我们是如何判断的?" + }, + "PLACEHOLDER_SCAM": { + "en": "a scam🚫", + "cn": "是诈骗信息🚫" + }, + "PLACEHOLDER_SUSPICIOUS": { + "en": "illicit🚨", + "cn": "包含非法内容🚨" + }, + "PLACEHOLDER_UNTRUE": { + "en": "untrue❌", + "cn": "不真实❌" + }, + "PLACEHOLDER_MISLEADING": { + "en": "misleading⚠️", + "cn": "具有误导性⚠️" + }, + "PLACEHOLDER_ACCURATE": { + "en": "accurate✅", + "cn": "是准确的✅" + }, + "PLACEHOLDER_SPAM": { + "en": "spam🚧", + "cn": "是垃圾信息🚧" + }, + "PLACEHOLDER_LEGITIMATE": { + "en": "legitimate✅", + "cn": "来自可靠的来源✅" + }, + "PLACEHOLDER_IRRELEVANT": { + "en": "message doesn't contain a meaningful claim to assess.😕", + "cn": "没有可以评估的内容😕" + }, + "PLACEHOLDER_UNSURE": { + "en": "too difficult to assess", + "cn": "很难做评估" + } +} diff --git a/functions/src/definitions/common/responseUtils.ts b/functions/src/definitions/common/responseUtils.ts index ea45bb14..3aa18535 100644 --- a/functions/src/definitions/common/responseUtils.ts +++ b/functions/src/definitions/common/responseUtils.ts @@ -1,6 +1,7 @@ import * as functions from "firebase-functions" import * as admin from "firebase-admin" -import { USER_BOT_RESPONSES, FACTCHECKER_BOT_RESPONSES } from "./constants" +import USER_BOT_RESPONSES from "./parameters/userResponses.json" +import CHECKER_BOT_RESPONSES from "./parameters/checkerResponses.json" import { sendWhatsappButtonMessage, sendWhatsappTextListMessage, @@ -13,10 +14,66 @@ import { getCount } from "./counters" const db = admin.firestore() -function getInfoLiner(truthScore: null | number) { - return `, with an average score of ${ +type BotResponses = { + [key: string]: { + [key: string]: string + } +} + +type ResponseObject = { + [key: string]: string +} + +async function getResponsesObj(botType: "factChecker"): Promise +async function getResponsesObj(botType: "user"): Promise +async function getResponsesObj( + botType: "user", + user: string +): Promise +async function getResponsesObj( + botType: "user" | "factChecker" = "user", + user: string | null = null +) { + let path + if (botType === "factChecker") { + path = "systemParameters/factCheckerBotResponses" + const checkerResponseSnap = await db.doc(path).get() + return checkerResponseSnap.data() ?? CHECKER_BOT_RESPONSES + } else { + if (typeof user !== "string") { + functions.logger.error("user not provided to getResponsesObj") + return "error" + } + path = "systemParameters/userBotResponses" + const userResponseSnap = await db.doc(path).get() + const userResponseObject = userResponseSnap.data() ?? USER_BOT_RESPONSES + const userSnap = await db.collection("users").doc(user).get() + const language = userSnap.get("language") ?? "en" + const responseProxy = new Proxy(userResponseObject as BotResponses, { + get(target, prop: string) { + if (prop === "then") { + //somehow code tries to access then property + return undefined + } + if (target[prop] && target[prop][language]) { + return target[prop][language] + } else if (target[prop] && target[prop]["en"]) { + // Fallback to English + return target[prop]["en"] + } + functions.logger.error(`Error getting ${prop} from user bot responses`) + return "error" // Or some default value or error handling + }, + }) + return responseProxy + } +} + +function getInfoLiner(truthScore: null | number, infoPlaceholder: string) { + return infoPlaceholder.replace( + "{{score}}", typeof truthScore === "number" ? truthScore.toFixed(2) : "NA" - } on a scale of 0-5 (5 = completely true)` + ) } async function respondToInterimFeedback( @@ -25,8 +82,9 @@ async function respondToInterimFeedback( ) { const instanceRef = db.doc(instancePath) const instanceSnap = await instanceRef.get() - const responses = await getResponsesObj("user") const data = instanceSnap.data() + const from = data?.from ?? null + const responses = await getResponsesObj("user", from) if (!data) { functions.logger.log("Missing data in respondToInterimFeedback") return @@ -36,7 +94,7 @@ async function respondToInterimFeedback( type: "reply", reply: { id: `sendInterim_${instancePath}`, - title: "Get another update", + title: responses.BUTTON_ANOTHER_UPDATE, }, }, ] @@ -52,7 +110,7 @@ async function respondToInterimFeedback( break } - await sendWhatsappButtonMessage("user", data.from, response, buttons, data.id) + await sendWhatsappButtonMessage("user", from, response, buttons, data.id) } async function respondToRationalisationFeedback( @@ -61,8 +119,9 @@ async function respondToRationalisationFeedback( ) { const instanceRef = db.doc(instancePath) const instanceSnap = await instanceRef.get() - const responses = await getResponsesObj("user") const data = instanceSnap.data() + const from = data?.from ?? null + const responses = await getResponsesObj("user", from) if (!data) { functions.logger.log("Missing data in respondToRationalisationFeedback") return @@ -79,28 +138,7 @@ async function respondToRationalisationFeedback( break } - await sendWhatsappTextMessage("user", data.from, response) -} - -async function getResponsesObj( - botType: "factChecker" -): Promise -async function getResponsesObj( - botType: "user" -): Promise -async function getResponsesObj(botType: "user" | "factChecker" = "user") { - let path - let fallbackResponses - if (botType === "factChecker") { - path = "systemParameters/factCheckerBotResponses" - fallbackResponses = FACTCHECKER_BOT_RESPONSES - } else { - path = "systemParameters/userBotResponses" - fallbackResponses = USER_BOT_RESPONSES - } - const defaultResponsesRef = db.doc(path) - const defaultResponsesSnap = await defaultResponsesRef.get() - return defaultResponsesSnap.data() ?? fallbackResponses + await sendWhatsappTextMessage("user", from, response) } async function sendMenuMessage( @@ -110,7 +148,7 @@ async function sendMenuMessage( replyMessageId: string | null = null, disputedInstancePath: string | null = null ) { - const responses = await getResponsesObj("user") + const responses = await getResponsesObj("user", to) if (!(prefixName in responses)) { functions.logger.error(`prefixName ${prefixName} not found in responses`) return @@ -128,34 +166,38 @@ async function sendMenuMessage( const rows = [ { id: `${type}_check`, - title: "Check/Report", - description: "Send in messages, images, or screenshots for checking!", + title: responses.MENU_TITLE_CHECK, + description: responses.MENU_DESCRIPTION_CHECK, }, { id: `${type}_referral`, - title: "Get Referral Link", - description: "Get referral link to forward to others", + title: responses.MENU_TITLE_REFERRAL, + description: responses.MENU_DESCRIPTION_REFERRAL, }, { id: `${type}_help`, - title: "Get Help", - description: - "Find out how to use CheckMate to check or report dubious messages", + title: responses.MENU_TITLE_HELP, + description: responses.MENU_DESCRIPTION_HELP, }, { id: `${type}_about`, - title: "About CheckMate", - description: "Learn more about CheckMate and the team behind it", + title: responses.MENU_TITLE_ABOUT, + description: responses.MENU_DESCRIPTION_ABOUT, }, { id: `${type}_feedback`, - title: "Send Feedback", - description: "Send us feedback on anything to do with CheckMate", + title: responses.MENU_TITLE_FEEDBACK, + description: responses.MENU_DESCRIPTION_FEEDBACK, + }, + { + id: `${type}_language`, + title: responses.MENU_TITLE_LANGUAGE, + description: responses.MENU_DESCRIPTION_LANGUAGE, }, { id: `${type}_contact`, - title: "Get Contact", - description: "Get CheckMate's contact to add to your contact list", + title: responses.MENU_TITLE_CONTACT, + description: responses.MENU_DESCRIPTION_CONTACT, }, //TODO: Implement these next time @@ -178,8 +220,8 @@ async function sendMenuMessage( if (disputedInstancePath) { rows.splice(5, 0, { id: `${type}_dispute_${disputedInstancePath}`, - title: "Dispute Assessment", - description: "Dispute CheckMate's assesment of this message", + title: responses.MENU_TITLE_DISPUTE, + description: responses.MENU_DESCRIPTION_DISPUTE, }) } const sections = [ @@ -191,7 +233,7 @@ async function sendMenuMessage( "user", to, text, - "View Menu", + responses.MENU_BUTTON, sections, replyMessageId ) @@ -204,9 +246,10 @@ async function sendSatisfactionSurvey(instanceSnap: DocumentSnapshot) { if (!data) { return } - const responses = await getResponsesObj("user") + const from = data?.from ?? null + const responses = await getResponsesObj("user", from) const isSatisfactionSurveySent = instanceSnap.get("isSatisfactionSurveySent") - const userRef = db.collection("users").doc(data.from) + const userRef = db.collection("users").doc(from) const thresholds = await getThresholds() const cooldown = thresholds.satisfactionSurveyCooldownDays ?? 30 const userSnap = await userRef.get() @@ -226,8 +269,8 @@ async function sendSatisfactionSurvey(instanceSnap: DocumentSnapshot) { title: `${number}`, } }) - rows[0].description = "Extremely likely 🤩" - rows[9].description = "Not at all likely 😥" + rows[0].description = responses.MENU_DESCRIPTION_NPS_LIKELY + rows[9].description = responses.MENU_DESCRIPTION_NPS_UNLIKELY const sections = [ { rows: rows, @@ -235,9 +278,9 @@ async function sendSatisfactionSurvey(instanceSnap: DocumentSnapshot) { ] await sendWhatsappTextListMessage( "user", - data.from, + from, responses.SATISFACTION_SURVEY, - "Tap to respond", + responses.NPS_MENU_BUTTON, sections ) const batch = db.batch() @@ -270,8 +313,8 @@ async function sendVotingStats(instancePath: string) { const voteTotal = await getCount(messageRef, "totalVoteScore") const truthScore = infoCount > 0 ? voteTotal / infoCount : null const thresholds = await getThresholds() - const responses = await getResponsesObj("user") const from = instanceSnap.get("from") + const responses = await getResponsesObj("user", from) let truthCategory if (responseCount <= 0) { @@ -281,7 +324,7 @@ async function sendVotingStats(instancePath: string) { await sendTextMessage( "user", from, - "Sorry, an error occured!", + responses.GENERIC_ERROR, instanceSnap.get("id") ) return @@ -289,45 +332,62 @@ async function sendVotingStats(instancePath: string) { if (truthScore !== null) { if (truthScore < (thresholds.falseUpperBound || 1.5)) { - truthCategory = "untrue" + truthCategory = responses.PLACEHOLDER_UNTRUE } else if (truthScore < (thresholds.misleadingUpperBound || 3.5)) { - truthCategory = "misleading" + truthCategory = responses.PLACEHOLDER_MISLEADING } else { - truthCategory = "accurate" + truthCategory = responses.PLACEHOLDER_MISLEADING } } else truthCategory = "NA" const categories = [ { name: "trivial", count: irrelevantCount, isInfo: false }, { - name: scamCount >= illicitCount ? "scam" : "illicit", + name: + scamCount >= illicitCount + ? responses.PLACEHOLDER_SCAM + : responses.PLACEHOLDER_ILLICIT, count: susCount, isInfo: false, }, - { name: "spam", count: spamCount, isInfo: false }, + { name: responses.PLACEHOLDER_SPAM, count: spamCount, isInfo: false }, { name: truthCategory, count: infoCount, isInfo: true }, - { name: "legitimate", count: legitimateCount, isInfo: false }, + { + name: responses.PLACEHOLDER_LEGITIMATE, + count: legitimateCount, + isInfo: false, + }, { name: "unsure", count: unsureCount, isInfo: false }, ] categories.sort((a, b) => b.count - a.count) // sort in descending order - const highestCategory = - categories[0].name === "scam" ? "a scam" : categories[0].name - const secondCategory = - categories[1].name === "scam" ? "a scam" : categories[1].name + const highestCategory = categories[0].name + const secondCategory = categories[1].name const highestPercentage = (categories[0].count / responseCount) * 100 const secondPercentage = (categories[1].count / responseCount) * 100 const isHighestInfo = categories[0].isInfo const isSecondInfo = categories[1].isInfo - const infoLiner = getInfoLiner(truthScore) - let response = `${highestPercentage.toFixed(2)}% of our CheckMates ${ - isHighestInfo ? "collectively " : "" - }thought this was *${highestCategory}*${isHighestInfo ? infoLiner : ""}.` + const infoLiner = getInfoLiner(truthScore, responses.INFO_PLACEHOLDER) + let response = responses.STATS_TEMPLATE_1.replace( + "{{top}}", + `${highestPercentage.toFixed(2)}` + ) + .replace("{{category}}", highestCategory) + .replace("{{info_placeholder}}", isHighestInfo ? infoLiner : "") + // let response = `${highestPercentage.toFixed(2)}% of our CheckMates ${ + // isHighestInfo ? "collectively " : "" + // }thought this was *${highestCategory}*${isHighestInfo ? infoLiner : ""}.` if (secondPercentage > 0) { - response += ` ${secondPercentage.toFixed(2)}% ${ - isSecondInfo ? "collectively " : "" - } thought this was *${secondCategory}*${isSecondInfo ? infoLiner : ""}.` + response += responses.STATS_TEMPLATE_2.replace( + "{{second}}", + `${secondPercentage.toFixed(2)}` + ) + .replace("{{category}}", secondCategory) + .replace("{{info_placeholder}}", isSecondInfo ? infoLiner : "") + // response += ` ${secondPercentage.toFixed(2)}% ${ + // isSecondInfo ? "collectively " : "" + // } thought this was *${secondCategory}*${isSecondInfo ? infoLiner : ""}.` } await sendTextMessage("user", from, response, instanceSnap.get("id")) @@ -364,7 +424,8 @@ async function sendRationalisation(instancePath: string) { const instanceRef = db.doc(instancePath) const instanceSnap = await instanceRef.get() const data = instanceSnap.data() - const responses = await getResponsesObj("user") + const from = data?.from ?? null + const responses = await getResponsesObj("user", from) try { const messageRef = instanceRef.parent.parent if (!data) { @@ -390,14 +451,14 @@ async function sendRationalisation(instancePath: string) { type: "reply", reply: { id: `feedbackRationalisation_${instancePath}_yes`, - title: "Yes, it's useful", + title: responses.BUTTON_USEFUL, }, }, { type: "reply", reply: { id: `feedbackRationalisation_${instancePath}_no`, - title: "No, it's not", + title: responses.BUTTON_NOT_USEFUL, }, }, ] @@ -408,31 +469,34 @@ async function sendRationalisation(instancePath: string) { await instanceRef.update({ isRationalisationSent: true, }) - await sendWhatsappButtonMessage( - "user", - data.from, - replyText, - buttons, - data.id - ) + await sendWhatsappButtonMessage("user", from, replyText, buttons, data.id) } catch (e) { functions.logger.error(`Error sending rationalisation: ${e}`) if (data?.from) { - await sendTextMessage("user", data.from, responses.GENERIC_ERROR) + await sendTextMessage("user", from, responses.GENERIC_ERROR) } } } +async function updateLanguageAndSendMenu(from: string, language: string) { + const userRef = db.collection("users").doc(from) + await userRef.update({ + language: language, + }) + await sendMenuMessage(from, "MENU_PREFIX") +} + async function sendInterimUpdate(instancePath: string) { //get statistics const FEEDBACK_FEATURE_FLAG = true - const responses = await getResponsesObj("user") const instanceRef = db.doc(instancePath) const instanceSnap = await instanceRef.get() const data = instanceSnap.data() if (!data) { return } + const from = data?.from ?? null + const responses = await getResponsesObj("user", from) if (instanceSnap.get("isReplied")) { await sendTextMessage( "user", @@ -457,38 +521,37 @@ async function sendInterimUpdate(instancePath: string) { const percentageVoted = ((voteCount / numFactCheckers) * 100).toFixed(2) let prelimAssessment let infoPlaceholder = "" - const infoLiner = getInfoLiner(truthScore) + const infoLiner = getInfoLiner(truthScore, responses.INFO_PLACEHOLDER) switch (primaryCategory) { case "scam": - prelimAssessment = "is a scam🚫" + prelimAssessment = responses.PLACEHOLDER_SCAM break case "illicit": - prelimAssessment = "is suspicious🚨" + prelimAssessment = responses.PLACEHOLDER_SUSPICIOUS break case "untrue": - prelimAssessment = "is untrue❌" + prelimAssessment = responses.PLACEHOLDER_UNTRUE infoPlaceholder = infoLiner break case "misleading": - prelimAssessment = "is misleading⚠️" + prelimAssessment = responses.PLACEHOLDER_MISLEADING infoPlaceholder = infoLiner break case "accurate": - prelimAssessment = "is accurate✅" + prelimAssessment = responses.PLACEHOLDER_ACCURATE infoPlaceholder = infoLiner break case "spam": - prelimAssessment = "is spam🚧" + prelimAssessment = responses.PLACEHOLDER_SPAM break case "legitimate": - prelimAssessment = "is legitimate✅" + prelimAssessment = responses.PLACEHOLDER_LEGITIMATE break case "irrelevant": - prelimAssessment = - "message doesn't contain a meaningful claim to assess.😕" + prelimAssessment = responses.PLACEHOLDER_IRRELEVANT break case "unsure": - prelimAssessment = "unsure" + prelimAssessment = responses.PLACEHOLDER_UNSURE break default: functions.logger.log("primaryCategory did not match available cases") @@ -534,14 +597,14 @@ async function sendInterimUpdate(instancePath: string) { type: "reply", reply: { id: `feedbackInterim_${instancePath}_yes`, - title: "Yes, it's useful", + title: responses.BUTTON_USEFUL, }, }, { type: "reply", reply: { id: `feedbackInterim_${instancePath}_no`, - title: "No, it's not", + title: responses.BUTTON_NOT_USEFUL, }, }, ] @@ -551,18 +614,12 @@ async function sendInterimUpdate(instancePath: string) { type: "reply", reply: { id: `sendInterim_${instancePath}`, - title: "Get another update", + title: responses.BUTTON_ANOTHER_UPDATE, }, }, ] } - await sendWhatsappButtonMessage( - "user", - data.from, - finalResponse, - buttons, - data.id - ) + await sendWhatsappButtonMessage("user", from, finalResponse, buttons, data.id) if (!instanceSnap.get("isInterimReplySent")) { updateObj.isInterimReplySent = true } @@ -577,19 +634,20 @@ async function sendInterimPrompt(instanceSnap: DocumentSnapshot) { if (!data) { return } - const responses = await getResponsesObj("user") + const from = data?.from ?? null + const responses = await getResponsesObj("user", from) const buttons = [ { type: "reply", reply: { id: `sendInterim_${instanceSnap.ref.path}`, - title: "Get interim update", + title: responses.BUTTON_GET_INTERIM, }, }, ] await sendWhatsappButtonMessage( "user", - data.from, + from, responses.INTERIM_PROMPT, buttons, data.id @@ -613,7 +671,8 @@ async function respondToInstance( functions.logger.log("Missing 'from' field in instance data") return Promise.resolve() } - const responses = await getResponsesObj("user") + const from = data.from + const responses = await getResponsesObj("user", from) const thresholds = await getThresholds() const isAssessed = parentMessageSnap.get("isAssessed") const isIrrelevant = parentMessageSnap.get("isIrrelevant") @@ -627,6 +686,7 @@ async function respondToInstance( const isMachineCategorised = parentMessageSnap.get("isMachineCategorised") const instanceCount = parentMessageSnap.get("instanceCount") const responseCount = await getCount(parentMessageRef, "responses") + const isImage = data?.type === "image" function getFinalResponseText(responseText: string) { return responseText @@ -637,7 +697,7 @@ async function respondToInstance( .replace( "{{matched}}", instanceCount >= 5 - ? `In fact, others have already sent this message in ${instanceCount} times. ` + ? responses.MATCHED.replace("{{numberInstances}}", `${instanceCount}`) : "" ) .replace( @@ -646,12 +706,13 @@ async function respondToInstance( ? responses.METHODOLOGY_AUTO : responses.METHODOLOGY_HUMAN ) + .replace("{{image_caveat}}", isImage ? responses.IMAGE_CAVEAT : "") } if (!isAssessed && !forceReply) { await sendTextMessage( "user", - data.from, + from, responses.MESSAGE_NOT_YET_ASSESSED, data.id ) @@ -675,7 +736,7 @@ async function respondToInstance( type: "reply", reply: { id: `votingResults_${instanceSnap.ref.path}`, - title: "See voting results", + title: responses.BUTTON_RESULTS, }, } @@ -683,7 +744,7 @@ async function respondToInstance( type: "reply", reply: { id: `scamshieldDecline_${instanceSnap.ref.path}`, - title: "Don't report this", + title: responses.BUTTON_DECLINE_REPORT, }, } @@ -691,7 +752,7 @@ async function respondToInstance( type: "reply", reply: { id: `rationalisation_${instanceSnap.ref.path}`, - title: "How'd we tell?", + title: responses.BUTTON_RATIONALISATION, }, } @@ -735,7 +796,7 @@ async function respondToInstance( switch (category) { case "irrelevant_auto": await sendMenuMessage( - data.from, + from, "IRRELEVANT_AUTO_MENU_PREFIX", "whatsapp", data.id, @@ -744,7 +805,7 @@ async function respondToInstance( break case "irrelevant": await sendMenuMessage( - data.from, + from, "IRRELEVANT_MENU_PREFIX", "whatsapp", data.id, @@ -753,7 +814,7 @@ async function respondToInstance( break case "error": responseText = getFinalResponseText(responses.ERROR) - await sendTextMessage("user", data.from, responseText, data.id) + await sendTextMessage("user", from, responseText, data.id) break default: if (!(category.toUpperCase() in responses)) { @@ -771,7 +832,11 @@ async function respondToInstance( const rationalisation = parentMessageSnap.get("rationalisation") if ((category === "scam" || category === "illicit") && rationalisation) { - buttons.push(viewRationalisationButton) + const language = + (await db.collection("users").doc(from).get()).get("language") ?? "en" + if (language === "en") { + buttons.push(viewRationalisationButton) + } } if (category === "scam" || category === "illicit") { @@ -782,13 +847,13 @@ async function respondToInstance( if (buttons.length > 0) { await sendWhatsappButtonMessage( "user", - data.from, + from, responseText, buttons, data.id ) } else { - await sendTextMessage("user", data.from, responseText, data.id) + await sendTextMessage("user", from, responseText, data.id) } } updateObj.replyCategory = category @@ -806,7 +871,7 @@ async function respondToInstance( async function sendReferralMessage(user: string) { let referralResponse const code = (await db.collection("users").doc(user).get()).get("referralId") - const responses = await getResponsesObj("user") + const responses = await getResponsesObj("user", user) if (code) { referralResponse = responses.REFERRAL.replace( "{{link}}", @@ -819,6 +884,31 @@ async function sendReferralMessage(user: string) { await sendTextMessage("user", user, referralResponse, null, "whatsapp", true) } +async function sendLanguageSelection(user: string, newUser: boolean) { + const responses = await getResponsesObj("user", user) + const response = responses.LANGUAGE_SELECTION.replace( + "{{new_user_en}}", + newUser ? responses.NEW_USER_PREFIX_EN : "" + ).replace("{{new_user_cn}}", newUser ? responses.NEW_USER_PREFIX_CN : "") + const buttons = [ + { + type: "reply", + reply: { + id: `languageSelection_en`, + title: responses.BUTTON_ENGLISH, + }, + }, + { + type: "reply", + reply: { + id: `languageSelection_cn`, + title: responses.BUTTON_CHINESE, + }, + }, + ] + await sendWhatsappButtonMessage("user", user, response, buttons) +} + export { getResponsesObj, respondToInstance, @@ -830,4 +920,6 @@ export { respondToInterimFeedback, sendRationalisation, respondToRationalisationFeedback, + updateLanguageAndSendMenu, + sendLanguageSelection, } diff --git a/functions/src/definitions/common/utils.ts b/functions/src/definitions/common/utils.ts index 8d401365..375da0f4 100644 --- a/functions/src/definitions/common/utils.ts +++ b/functions/src/definitions/common/utils.ts @@ -1,4 +1,4 @@ -import { thresholds } from "./constants" +import thresholds from "./parameters/thresholds.json" import * as admin from "firebase-admin" import { findPhoneNumbersInText } from "libphonenumber-js" import { createHash } from "crypto" @@ -9,6 +9,8 @@ if (!admin.apps.length) { admin.initializeApp() } +const env = process.env.ENVIRONMENT + function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)) } @@ -17,7 +19,12 @@ const getThresholds = async function () { const db = admin.firestore() const theresholdsRef = db.doc("systemParameters/thresholds") const theresholdsSnap = await theresholdsRef.get() - return (theresholdsSnap.data() as typeof thresholds | undefined) ?? thresholds + const returnThresholds = + (theresholdsSnap.data() as typeof thresholds | undefined) ?? thresholds + if (env !== "PROD") { + returnThresholds.surveyLikelihood = 1 + } + return returnThresholds } function normalizeSpaces(str: string) { diff --git a/functions/src/definitions/eventHandlers/checkerHandlers.ts b/functions/src/definitions/eventHandlers/checkerHandlers.ts index bb7c4ba6..f5e0bc4e 100644 --- a/functions/src/definitions/eventHandlers/checkerHandlers.ts +++ b/functions/src/definitions/eventHandlers/checkerHandlers.ts @@ -225,18 +225,32 @@ async function onFactCheckerYes( latestInstanceSnap.get("storageUrl") ) if (temporaryUrl) { - res = await sendImageMessage( - "factChecker", - from, - temporaryUrl, - latestInstanceSnap.get("caption"), - null, - platform - ) - if (!res) { + try { + res = await sendImageMessage( + "factChecker", + from, + temporaryUrl, + latestInstanceSnap.get("caption"), + null, + platform + ) + if (!res) { + return + } + updateObj.sentMessageId = res.data.messages[0].id + } catch { + functions.logger.error( + `Problem sending message ${messageRef.id} to ${from}}` + ) + await sendTextMessage( + "factChecker", + from, + "Sorry, an error occured", + null, + platform + ) return } - updateObj.sentMessageId = res.data.messages[0].id } else { functions.logger.error( `Problem creating URL while sending message ${messageRef.id} to ${from}}` diff --git a/functions/src/definitions/eventHandlers/onInstanceCreate.ts b/functions/src/definitions/eventHandlers/onInstanceCreate.ts index 59d80a25..0832a8f9 100644 --- a/functions/src/definitions/eventHandlers/onInstanceCreate.ts +++ b/functions/src/definitions/eventHandlers/onInstanceCreate.ts @@ -9,12 +9,8 @@ import { CollectionTypes, } from "../common/typesense/collectionOperations" import { FieldValue } from "@google-cloud/firestore" -import { defineInt } from "firebase-functions/params" import { Timestamp } from "firebase-admin/firestore" -// Define some parameters -const numInstanceShards = defineInt("NUM_SHARDS_INSTANCE_COUNT") - interface MessageUpdate { [x: string]: any } diff --git a/functions/src/definitions/eventHandlers/userHandlers.ts b/functions/src/definitions/eventHandlers/userHandlers.ts index d565ba4e..a8b7da9b 100644 --- a/functions/src/definitions/eventHandlers/userHandlers.ts +++ b/functions/src/definitions/eventHandlers/userHandlers.ts @@ -23,6 +23,8 @@ import { respondToInterimFeedback, sendRationalisation, respondToRationalisationFeedback, + updateLanguageAndSendMenu, + sendLanguageSelection, } from "../common/responseUtils" import { downloadWhatsappMedia, @@ -37,6 +39,7 @@ import { classifyText } from "../common/classifier" import { FieldValue } from "@google-cloud/firestore" import Hashids from "hashids" import { Message } from "../../types" +import { user } from "firebase-functions/v1/auth" const runtimeEnvironment = defineString("ENVIRONMENT") const similarityThreshold = defineString("SIMILARITY_THRESHOLD") @@ -62,7 +65,7 @@ const userHandlerWhatsapp = async function (message: Message) { let from = message.from // extract the phone number from the webhook payload let type = message.type - const responses = await getResponsesObj("user") + const responses = await getResponsesObj("user", from) //check whether new user const userRef = db.collection("users").doc(from) @@ -168,8 +171,7 @@ const userHandlerWhatsapp = async function (message: Message) { } break } - - if (message.text.body.toLowerCase() === "menu") { + if (checkMenu(message.text.body)) { step = "text_menu" await sendMenuMessage(from, "MENU_PREFIX", "whatsapp", null, null) break @@ -606,7 +608,7 @@ async function newImageInstanceHandler({ machineCategory ) } - if (extractedMessage) messageRef = db.collection("messages").doc() + messageRef = db.collection("messages").doc() messageUpdateObj = { machineCategory: machineCategory, //Can be "fake news" or "scam" isMachineCategorised: isMachineAssessed, @@ -713,13 +715,13 @@ async function newImageInstanceHandler({ } async function newUserHandler(from: string) { - await sendMenuMessage(from, "NEW_USER_MENU_PREFIX", "whatsapp", null, null) + await sendLanguageSelection(from, true) } async function onButtonReply(messageObj: Message, platform = "whatsapp") { const buttonId = messageObj.interactive.button_reply.id const from = messageObj.from - const responses = await getResponsesObj("user") + const responses = await getResponsesObj("user", from) const [type, ...rest] = buttonId.split("_") let instancePath, selection, @@ -763,6 +765,10 @@ async function onButtonReply(messageObj: Message, platform = "whatsapp") { ;[instancePath, selection] = rest await respondToRationalisationFeedback(instancePath, selection) break + case "languageSelection": + ;[selection] = rest + await updateLanguageAndSendMenu(from, selection) + break } const step = type + (selection ? `_${selection}` : "") return Promise.resolve(step) @@ -771,7 +777,7 @@ async function onButtonReply(messageObj: Message, platform = "whatsapp") { async function onTextListReceipt(messageObj: Message, platform = "whatsapp") { const listId = messageObj.interactive.list_reply.id const from = messageObj.from - const responses = await getResponsesObj("user") + const responses = await getResponsesObj("user", from) const [type, selection, ...rest] = listId.split("_") let response, instancePath const step = `${type}_${selection}` @@ -794,6 +800,11 @@ async function onTextListReceipt(messageObj: Message, platform = "whatsapp") { response = responses.FEEDBACK break + case "language": + await sendLanguageSelection(from, false) + hasReplied = true + break + case "contact": const nameObj = { formatted_name: "CheckMate", suffix: "CheckMate" } response = responses.CONTACT @@ -889,6 +900,11 @@ async function addInstanceToDb( } } +function checkMenu(text: string) { + const menuKeywords = ["menu", "菜单", "菜單"] + return menuKeywords.includes(text.toLowerCase()) +} + async function createNewUser( userRef: admin.firestore.DocumentReference, messageTimestamp: Timestamp @@ -904,6 +920,7 @@ async function createNewUser( initialJourney: {}, referralId: referralId, referralCount: 0, + language: "en", }) } diff --git a/functions/src/definitions/webhookHandlers/specialCommands.ts b/functions/src/definitions/webhookHandlers/specialCommands.ts index 919a1707..43897e4b 100644 --- a/functions/src/definitions/webhookHandlers/specialCommands.ts +++ b/functions/src/definitions/webhookHandlers/specialCommands.ts @@ -3,11 +3,9 @@ import * as admin from "firebase-admin" import { defineString } from "firebase-functions/params" import { WhatsappMessage } from "../../types" import { sendWhatsappTextMessage } from "../common/sendWhatsappMessage" -import { - USER_BOT_RESPONSES, - FACTCHECKER_BOT_RESPONSES, - thresholds, -} from "../common/constants" +import USER_BOT_RESPONSES from "../common/parameters/userResponses.json" +import CHECKER_BOT_RESPONSES from "../common/parameters/checkerResponses.json" +import thresholds from "../common/parameters/thresholds.json" import { interimPromptHandler } from "../batchJobs/batchJobs" const runtimeEnvironment = defineString("ENVIRONMENT") @@ -64,7 +62,7 @@ const mockDb = async function () { await systemParametersRef.doc("userBotResponses").set(USER_BOT_RESPONSES) await systemParametersRef .doc("factCheckerBotResponses") - .set(FACTCHECKER_BOT_RESPONSES) + .set(CHECKER_BOT_RESPONSES) await systemParametersRef.doc("supportedTypes").set({ whatsapp: ["text", "image"], }) diff --git a/functions/src/definitions/webhookHandlers/telegram.ts b/functions/src/definitions/webhookHandlers/telegram.ts index c949140a..60291b09 100644 --- a/functions/src/definitions/webhookHandlers/telegram.ts +++ b/functions/src/definitions/webhookHandlers/telegram.ts @@ -5,7 +5,7 @@ import express from "express" import TelegramBot from "node-telegram-bot-api" import { onRequest } from "firebase-functions/v2/https" -const TOKEN = "YOUR_TELEGRAM_BOT_TOKEN" +const TOKEN = String(process.env.TELEGRAM_CHECKER_BOT_TOKEN) const bot = new TelegramBot(TOKEN) const app = express() @@ -23,7 +23,7 @@ app.post("/", async (req, res) => { const telegramHandler = onRequest( { - secrets: ["TELEGRAM_BOT_TOKEN"], + secrets: ["TELEGRAM_CHECKER_BOT_TOKEN"], }, app ) diff --git a/functions/src/definitions/webhookHandlers/whatsapp.ts b/functions/src/definitions/webhookHandlers/whatsapp.ts index d88fc2fa..7b7b0455 100644 --- a/functions/src/definitions/webhookHandlers/whatsapp.ts +++ b/functions/src/definitions/webhookHandlers/whatsapp.ts @@ -6,16 +6,47 @@ import { handleSpecialCommands } from "./specialCommands" import { publishToTopic } from "../common/pubsub" import { onRequest } from "firebase-functions/v2/https" import { checkMessageId } from "../common/utils" +import { Request, Response } from "express" const runtimeEnvironment = defineString("ENVIRONMENT") +const webhookPath = process.env.WEBHOOK_PATH +const ingressSetting = + process.env.ENVIRONMENT === "PROD" ? "ALLOW_INTERNAL_AND_GCLB" : "ALLOW_ALL" + if (!admin.apps.length) { admin.initializeApp() } const app = express() -// Accepts POST requests at /webhook endpoint -app.post("/whatsapp", async (req, res) => { +const getHandler = async (req: Request, res: Response) => { + /** + * UPDATE YOUR VERIFY TOKEN + *This will be the Verify Token value when you set up webhook + **/ + const verifyToken = process.env.VERIFY_TOKEN + // Parse params from the webhook verification request + const mode = req.query["hub.mode"] + const token = req.query["hub.verify_token"] + const challenge = req.query["hub.challenge"] + + // Check if a token and mode were sent + if (mode && token) { + // Check the mode and token sent are correct + if (mode === "subscribe" && token === verifyToken) { + // Respond with 200 OK and challenge token from the request + functions.logger.log("WEBHOOK_VERIFIED") + res.status(200).send(challenge) + } else { + // Responds with '403 Forbidden' if verify tokens do not match + res.sendStatus(403) + } + } else { + res.sendStatus(400) + } +} + +const postHandler = async (req: Request, res: Response) => { if (req.body.object) { if (req?.body?.entry?.[0]?.changes?.[0]?.value) { let value = req.body.entry[0].changes[0].value @@ -108,7 +139,11 @@ app.post("/whatsapp", async (req, res) => { functions.logger.log(JSON.stringify(req.body, null, 2)) res.sendStatus(404) } -}) +} + +// Accepts POST requests at /{webhookPath} endpoint +app.post(`/${webhookPath}`, postHandler) +app.get(`/${webhookPath}`, getHandler) app.post("/telegram", async (req, res) => { const db = admin.firestore() @@ -118,35 +153,10 @@ app.post("/telegram", async (req, res) => { // Accepts GET requests at the /webhook endpoint. You need this URL to setup webhook initially. // info on verification request payload: https://developers.facebook.com/docs/graph-api/webhooks/getting-started#verification-requests -app.get("/whatsapp", (req, res) => { - /** - * UPDATE YOUR VERIFY TOKEN - *This will be the Verify Token value when you set up webhook - **/ - const verifyToken = process.env.VERIFY_TOKEN - // Parse params from the webhook verification request - const mode = req.query["hub.mode"] - const token = req.query["hub.verify_token"] - const challenge = req.query["hub.challenge"] - - // Check if a token and mode were sent - if (mode && token) { - // Check the mode and token sent are correct - if (mode === "subscribe" && token === verifyToken) { - // Respond with 200 OK and challenge token from the request - functions.logger.log("WEBHOOK_VERIFIED") - res.status(200).send(challenge) - } else { - // Responds with '403 Forbidden' if verify tokens do not match - res.sendStatus(403) - } - } else { - res.sendStatus(400) - } -}) const webhookHandlerV2 = onRequest( { + ingressSettings: ingressSetting, secrets: [ "WHATSAPP_USER_BOT_PHONE_NUMBER_ID", "WHATSAPP_CHECKERS_BOT_PHONE_NUMBER_ID", diff --git a/integration-tests/checkmate.postman_collection.json b/integration-tests/checkmate.postman_collection.json index 6873384b..d8d70522 100644 --- a/integration-tests/checkmate.postman_collection.json +++ b/integration-tests/checkmate.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "5218f5ab-c512-43d1-b8a3-0831e12514c1", + "_postman_id": "c96bcaae-e133-42b3-b840-ed90f0840413", "name": "checkmate", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "25230076" @@ -32,12 +32,12 @@ "method": "GET", "header": [], "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/healthcheck", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/healthcheck", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "healthcheck" ] @@ -97,15 +97,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -147,14 +147,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents:listCollectionIds", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents:listCollectionIds", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents:listCollectionIds" @@ -215,15 +215,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -334,15 +334,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -467,15 +467,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -599,15 +599,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -716,15 +716,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -835,15 +835,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -973,89 +973,247 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, "response": [] }, { - "name": "Get last message (NEW_USER_MENU)", + "name": "Get last message (SELECT LANGUAGE)", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Your test name\", function () {\r", - " const MENU = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU\");\r", - " const PREFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_MENU_PREFIX\");\r", - " const MENU_TEXT = MENU.replace(\"{{prefix}}\",PREFIX)\r", - " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", + "pm.test(\"Select language\", function () {\r", + " const NEW_USER_PREFIX_EN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_PREFIX_EN.en\")\r", + " const NEW_USER_PREFIX_CN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_PREFIX_CN.en\")\r", + " const LANGUAGE_SELECTION = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.LANGUAGE_SELECTION.en\")\r", + " const BUTTON_ENGLISH = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ENGLISH.en\")\r", + " const BUTTON_CHINESE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_CHINESE.en\")\r", + " const BODY_TEXT = LANGUAGE_SELECTION.replace(\"{{new_user_en}}\",NEW_USER_PREFIX_EN).replace(\"{{new_user_cn}}\",NEW_USER_PREFIX_CN)\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", - " \"hostname\": \"resultserver\",\r", - " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", - " \"body\": {\r", - " \"messaging_product\": \"whatsapp\",\r", - " \"recipient_type\": \"individual\",\r", - " \"to\": USER_1_NUMBER,\r", - " \"type\": \"interactive\",\r", - " \"interactive\": {\r", - " \"type\": \"list\",\r", - " \"body\": {\r", - " \"text\": MENU_TEXT\r", - " },\r", - " \"action\": {\r", - " \"button\": \"View Menu\",\r", - " \"sections\": [\r", - " {\r", - " \"rows\": [\r", - " {\r", - " \"id\": \"menu_check\",\r", - " \"title\": \"Check/Report\",\r", - " \"description\": \"Send in messages, images, or screenshots for checking!\"\r", - " },\r", - " {\r", - " \"id\": \"menu_referral\",\r", - " \"title\": \"Get Referral Link\",\r", - " \"description\": \"Get referral link to forward to others\"\r", - " },\r", - " {\r", - " \"id\": \"menu_help\",\r", - " \"title\": \"Get Help\",\r", - " \"description\": \"Find out how to use CheckMate to check or report dubious messages\"\r", - " },\r", - " {\r", - " \"id\": \"menu_about\",\r", - " \"title\": \"About CheckMate\",\r", - " \"description\": \"Learn more about CheckMate and the team behind it\"\r", - " },\r", - " {\r", - " \"id\": \"menu_feedback\",\r", - " \"title\": \"Send Feedback\",\r", - " \"description\": \"Send us feedback on anything to do with CheckMate\"\r", - " },\r", - " {\r", - " \"id\": \"menu_contact\",\r", - " \"title\": \"Get Contact\",\r", - " \"description\": \"Get CheckMate's contact to add to your contact list\"\r", + " \"hostname\": \"resultserver\",\r", + " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", + " \"body\": {\r", + " \"messaging_product\": \"whatsapp\",\r", + " \"recipient_type\": \"individual\",\r", + " \"to\": USER_1_NUMBER,\r", + " \"type\": \"interactive\",\r", + " \"interactive\": {\r", + " \"type\": \"button\",\r", + " \"body\": {\r", + " \"text\": BODY_TEXT\r", + " },\r", + " \"action\": {\r", + " \"buttons\": [\r", + " {\r", + " \"type\": \"reply\",\r", + " \"reply\": {\r", + " \"id\": \"languageSelection_en\",\r", + " \"title\": BUTTON_ENGLISH\r", + " }\r", + " },\r", + " {\r", + " \"type\": \"reply\",\r", + " \"reply\": {\r", + " \"id\": \"languageSelection_cn\",\r", + " \"title\": BUTTON_CHINESE\r", " }\r", - " ]\r", - " }\r", - " ]\r", + " }\r", + " ]\r", + " }\r", + " },\r", + " },\r", + " \"method\": \"POST\"\r", + " }\r", + "\r", + " var jsonData = pm.response.json();\r", + "\r", + " pm.expect(jsonData).to.eql(expected);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(() => {}, 3000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{RESULT_SERVER_URL}}/testresultdata", + "host": [ + "{{RESULT_SERVER_URL}}" + ], + "path": [ + "testresultdata" + ] + } + }, + "response": [] + }, + { + "name": "Press English Button", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"6580431949\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n {\r\n \"profile\": {\r\n \"name\": \"{{USER_1_NAME}}\"\r\n },\r\n \"wa_id\": \"{{USER_1_NUMBER}}\"\r\n }\r\n ],\r\n \"messages\": [\r\n {\r\n \"context\": {\r\n \"from\": \"6580431949\",\r\n \"id\": \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==\"\r\n },\r\n \"from\": \"{{USER_1_NUMBER}}\",\r\n \"id\": \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==\",\r\n \"timestamp\": {{$timestamp}},\r\n \"type\": \"interactive\",\r\n \"interactive\": {\r\n \"type\": \"button_reply\",\r\n \"button_reply\": {\r\n \"id\": \"languageSelection_en\",\r\n \"title\": \"{{__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ENGLISH.en}}\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", + "host": [ + "{{FUNCTIONS_URL}}" + ], + "path": [ + "{{PROJECT_ID}}", + "asia-southeast1", + "webhookHandlerV2", + "{{WEBHOOK_PATH}}" + ] + } + }, + "response": [] + }, + { + "name": "Get last message (USER_MENU)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Your test name\", function () {\r", + " const MENU = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU.en\");\r", + " const PREFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_PREFIX.en\");\r", + " const MENU_TEXT = MENU.replace(\"{{prefix}}\",PREFIX);\r", + " const MENU_BUTTON = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_BUTTON.en\");\r", + " const MENU_TITLE_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CHECK.en\");\r", + " const MENU_DESCRIPTION_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CHECK.en\");\r", + " const MENU_TITLE_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_REFERRAL.en\");\r", + " const MENU_DESCRIPTION_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_REFERRAL.en\");\r", + " const MENU_TITLE_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_ABOUT.en\");\r", + " const MENU_DESCRIPTION_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_ABOUT.en\");\r", + " const MENU_TITLE_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_HELP.en\");\r", + " const MENU_DESCRIPTION_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_HELP.en\");\r", + " const MENU_TITLE_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_FEEDBACK.en\");\r", + " const MENU_DESCRIPTION_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_FEEDBACK.en\");\r", + " const MENU_TITLE_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_LANGUAGE.en\")\r", + " const MENU_DESCRIPTION_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_LANGUAGE.en\")\r", + " const MENU_TITLE_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CONTACT.en\");\r", + " const MENU_DESCRIPTION_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CONTACT.en\");\r", + " const MENU_TITLE_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_DISPUTE.en\")\r", + " const MENU_DESCRIPTION_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_DISPUTE.en\")\r", + " \r", + " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", + " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", + " const expected = {\r", + " \"hostname\": \"resultserver\",\r", + " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", + " \"body\": {\r", + " \"messaging_product\": \"whatsapp\",\r", + " \"recipient_type\": \"individual\",\r", + " \"to\": USER_1_NUMBER,\r", + " \"type\": \"interactive\",\r", + " \"interactive\": {\r", + " \"type\": \"list\",\r", + " \"body\": {\r", + " \"text\": MENU_TEXT\r", + " },\r", + " \"action\": {\r", + " \"button\": MENU_BUTTON,\r", + " \"sections\": [\r", + " {\r", + " \"rows\": [\r", + " {\r", + " \"id\": \"menu_check\",\r", + " \"title\": MENU_TITLE_CHECK,\r", + " \"description\": MENU_DESCRIPTION_CHECK\r", + " },\r", + " {\r", + " \"id\": \"menu_referral\",\r", + " \"title\": MENU_TITLE_REFERRAL,\r", + " \"description\": MENU_DESCRIPTION_REFERRAL\r", + " },\r", + " {\r", + " \"id\": \"menu_help\",\r", + " \"title\": MENU_TITLE_HELP,\r", + " \"description\": MENU_DESCRIPTION_HELP\r", + " },\r", + " {\r", + " \"id\": \"menu_about\",\r", + " \"title\": MENU_TITLE_ABOUT,\r", + " \"description\": MENU_DESCRIPTION_ABOUT\r", + " },\r", + " {\r", + " \"id\": \"menu_feedback\",\r", + " \"title\": MENU_TITLE_FEEDBACK,\r", + " \"description\": MENU_DESCRIPTION_FEEDBACK\r", + " },\r", + " {\r", + " \"id\": \"menu_language\",\r", + " \"title\": MENU_TITLE_LANGUAGE,\r", + " \"description\": MENU_DESCRIPTION_LANGUAGE\r", + " },\r", + " {\r", + " \"id\": \"menu_contact\",\r", + " \"title\": MENU_TITLE_CONTACT,\r", + " \"description\": MENU_DESCRIPTION_CONTACT\r", + " }\r", + " ]\r", + " }\r", + " ]\r", + " }\r", " }\r", - " }\r", - " },\r", - " \"method\": \"POST\"\r", - "}\r", + " },\r", + " \"method\": \"POST\"\r", + " }\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData).to.eql(expected);\r", "});" @@ -1118,14 +1276,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/users/{{USER_1_NUMBER}}", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/users/{{USER_1_NUMBER}}", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -1189,15 +1347,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -1211,16 +1369,34 @@ "script": { "exec": [ "pm.test(\"Message auto-categorised as irrelevant returns correct menu\", function () {\r", - " const MENU = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU\");\r", - " const PREFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.IRRELEVANT_AUTO_MENU_PREFIX\");\r", - " const MENU_TEXT = MENU.replace(\"{{prefix}}\",PREFIX)\r", - " const wamid = pm.variables.get(\"whatsapp_id_9\")\r", - " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", - " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const expected = {\r", - " \"hostname\": \"resultserver\",\r", - " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", - " \"body\": {\r", + " const MENU = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU.en\");\r", + " const PREFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.IRRELEVANT_AUTO_MENU_PREFIX.en\");\r", + " const MENU_TEXT = MENU.replace(\"{{prefix}}\",PREFIX);\r", + " const MENU_BUTTON = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_BUTTON.en\");\r", + " const MENU_TITLE_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CHECK.en\");\r", + " const MENU_DESCRIPTION_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CHECK.en\");\r", + " const MENU_TITLE_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_REFERRAL.en\");\r", + " const MENU_DESCRIPTION_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_REFERRAL.en\");\r", + " const MENU_TITLE_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_ABOUT.en\");\r", + " const MENU_DESCRIPTION_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_ABOUT.en\");\r", + " const MENU_TITLE_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_HELP.en\");\r", + " const MENU_DESCRIPTION_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_HELP.en\");\r", + " const MENU_TITLE_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_FEEDBACK.en\");\r", + " const MENU_DESCRIPTION_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_FEEDBACK.en\");\r", + " const MENU_TITLE_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_LANGUAGE.en\")\r", + " const MENU_DESCRIPTION_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_LANGUAGE.en\")\r", + " const MENU_TITLE_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CONTACT.en\");\r", + " const MENU_DESCRIPTION_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CONTACT.en\");\r", + " const MENU_TITLE_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_DISPUTE.en\")\r", + " const MENU_DESCRIPTION_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_DISPUTE.en\")\r", + " const wamid = pm.variables.get(\"whatsapp_id_9\")\r", + " \r", + " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", + " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", + " const expected = {\r", + " \"hostname\": \"resultserver\",\r", + " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", + " \"body\": {\r", " \"messaging_product\": \"whatsapp\",\r", " \"recipient_type\": \"individual\",\r", " \"to\": USER_1_NUMBER,\r", @@ -1231,44 +1407,49 @@ " \"text\": MENU_TEXT\r", " },\r", " \"action\": {\r", - " \"button\": \"View Menu\",\r", + " \"button\": MENU_BUTTON,\r", " \"sections\": [\r", " {\r", " \"rows\": [\r", " {\r", " \"id\": \"menu_check\",\r", - " \"title\": \"Check/Report\",\r", - " \"description\": \"Send in messages, images, or screenshots for checking!\"\r", + " \"title\": MENU_TITLE_CHECK,\r", + " \"description\": MENU_DESCRIPTION_CHECK\r", " },\r", " {\r", " \"id\": \"menu_referral\",\r", - " \"title\": \"Get Referral Link\",\r", - " \"description\": \"Get referral link to forward to others\",\r", + " \"title\": MENU_TITLE_REFERRAL,\r", + " \"description\": MENU_DESCRIPTION_REFERRAL\r", " },\r", " {\r", " \"id\": \"menu_help\",\r", - " \"title\": \"Get Help\",\r", - " \"description\": \"Find out how to use CheckMate to check or report dubious messages\"\r", + " \"title\": MENU_TITLE_HELP,\r", + " \"description\": MENU_DESCRIPTION_HELP\r", " },\r", " {\r", " \"id\": \"menu_about\",\r", - " \"title\": \"About CheckMate\",\r", - " \"description\": \"Learn more about CheckMate and the team behind it\"\r", + " \"title\": MENU_TITLE_ABOUT,\r", + " \"description\": MENU_DESCRIPTION_ABOUT\r", " },\r", " {\r", " \"id\": \"menu_feedback\",\r", - " \"title\": \"Send Feedback\",\r", - " \"description\": \"Send us feedback on anything to do with CheckMate\"\r", + " \"title\": MENU_TITLE_FEEDBACK,\r", + " \"description\": MENU_DESCRIPTION_FEEDBACK\r", " },\r", " {\r", " \"id\": \"menu_dispute_messages/*/instances/*\",\r", - " \"title\": \"Dispute Assessment\",\r", - " \"description\": \"Dispute CheckMate's assesment of this message\"\r", + " \"title\": MENU_TITLE_DISPUTE,\r", + " \"description\": MENU_DESCRIPTION_DISPUTE\r", + " },\r", + " {\r", + " \"id\": \"menu_language\",\r", + " \"title\": MENU_TITLE_LANGUAGE,\r", + " \"description\": MENU_DESCRIPTION_LANGUAGE\r", " },\r", " {\r", " \"id\": \"menu_contact\",\r", - " \"title\": \"Get Contact\",\r", - " \"description\": \"Get CheckMate's contact to add to your contact list\"\r", + " \"title\": MENU_TITLE_CONTACT,\r", + " \"description\": MENU_DESCRIPTION_CONTACT\r", " }\r", " ]\r", " }\r", @@ -1277,12 +1458,11 @@ " },\r", " \"context\": {\r", " \"message_id\": wamid\r", - " }\r", + " },\r", " },\r", " \"method\": \"POST\"\r", " }\r", " var jsonData = pm.response.json();\r", - " \r", " // get the id of \"Dispute Assessment\" for validation\r", " let disputeAssessmentId = jsonData.body.interactive.action.sections[0].rows.find(row => row.title === \"Dispute Assessment\").id;\r", " let [, , disputedInstancePath] = disputeAssessmentId.split(\"_\")\r", @@ -1299,7 +1479,7 @@ " return row;\r", " }\r", " });\r", - "\r", + " \r", " pm.expect(jsonData).to.eql(expected);\r", "});" ], @@ -1380,15 +1560,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -1455,7 +1635,7 @@ "script": { "exec": [ "pm.test(\"Your test name\", function () {\r", - " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.DISPUTE\");\r", + " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.DISPUTE.en\");\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", @@ -1551,15 +1731,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -1576,7 +1756,7 @@ " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const wamid = pm.variables.get(\"whatsapp_id_11\")\r", - " const MESSAGE_NOT_YET_ASSESSED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MESSAGE_NOT_YET_ASSESSED\");\r", + " const MESSAGE_NOT_YET_ASSESSED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MESSAGE_NOT_YET_ASSESSED.en\");\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -1998,15 +2178,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -2188,15 +2368,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -2393,15 +2573,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -2578,15 +2758,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -2631,14 +2811,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages/{{spamMessageId}}/instances", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages/{{spamMessageId}}/instances", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -2665,7 +2845,8 @@ " const wamid = pm.variables.get(\"whatsapp_id_11\")\r", " const [, messageId, , voteRequestId] = pm.variables.get(\"spamVoteRequestPath_CHECKER1\").split(\"/\")\r", " const instanceId = pm.variables.get(\"spamInstanceId\")\r", - " const INTERIM_PROMPT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_PROMPT\");\r", + " const INTERIM_PROMPT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_PROMPT.en\");\r", + " const BUTTON_GET_INTERIM = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_GET_INTERIM.en\")\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -2685,7 +2866,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get interim update\"\r", + " \"title\": BUTTON_GET_INTERIM\r", " }\r", " }\r", " ]\r", @@ -2778,15 +2959,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -2805,11 +2986,13 @@ " const [, messageId, , voteRequestId] = pm.variables.get(\"spamVoteRequestPath_CHECKER1\").split(\"/\")\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const INTERIM_TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE\");\r", - " const INTERIM_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK\")\r", + " const INTERIM_TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE.en\");\r", + " const INTERIM_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK.en\");\r", + " const BUTTON_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_USEFUL.en\");\r", + " const BUTTON_NOT_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_NOT_USEFUL.en\")\r", " const wamid = pm.variables.get(\"whatsapp_id_11\")\r", " const instanceId = pm.variables.get(\"spamInstanceId\")\r", - " const interimResponse = INTERIM_TEMPLATE.replace(\"{{%voted}}\", \"33.33\").replace(\"{{prelim_assessment}}\",\"is spam🚧\").replace(\"{{info_placeholder}}\",\"\").replace(\"{{get_feedback}}\",INTERIM_FEEDBACK)\r", + " const interimResponse = INTERIM_TEMPLATE.replace(\"{{%voted}}\", \"33.33\").replace(\"{{prelim_assessment}}\",\"spam🚧\").replace(\"{{info_placeholder}}\",\"\").replace(\"{{get_feedback}}\",INTERIM_FEEDBACK)\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -2829,14 +3012,14 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `feedbackInterim_messages/${messageId}/instances/${instanceId}_yes`,\r", - " \"title\": \"Yes, it's useful\"\r", + " \"title\": BUTTON_USEFUL\r", " }\r", " },\r", " {\r", " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `feedbackInterim_messages/${messageId}/instances/${instanceId}_no`,\r", - " \"title\": \"No, it's not\"\r", + " \"title\": BUTTON_NOT_USEFUL\r", " }\r", " }\r", " ]\r", @@ -2930,15 +3113,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -2957,7 +3140,8 @@ " const [, messageId, , voteRequestId] = pm.variables.get(\"spamVoteRequestPath_CHECKER1\").split(\"/\")\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const INTERIM_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_USEFUL\");\r", + " const INTERIM_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_USEFUL.en\");\r", + " const BUTTON_ANOTHER_UPDATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ANOTHER_UPDATE.en\")\r", " const instanceId = pm.variables.get(\"spamInstanceId\")\r", " const wamid = pm.variables.get(\"whatsapp_id_11\")\r", " const expected = {\r", @@ -2979,7 +3163,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get another update\"\r", + " \"title\": BUTTON_ANOTHER_UPDATE\r", " }\r", " }\r", " ]\r", @@ -3060,15 +3244,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -3087,7 +3271,8 @@ " const [, messageId, , voteRequestId] = pm.variables.get(\"spamVoteRequestPath_CHECKER1\").split(\"/\")\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const INTERIM_NOT_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_NOT_USEFUL\");\r", + " const INTERIM_NOT_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_NOT_USEFUL.en\");\r", + " const BUTTON_ANOTHER_UPDATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ANOTHER_UPDATE.en\")\r", " const instanceId = pm.variables.get(\"spamInstanceId\")\r", " const wamid = pm.variables.get(\"whatsapp_id_11\")\r", " const expected = {\r", @@ -3109,7 +3294,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get another update\"\r", + " \"title\": BUTTON_ANOTHER_UPDATE\r", " }\r", " }\r", " ]\r", @@ -3202,15 +3387,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -3229,11 +3414,12 @@ " const [, messageId, , voteRequestId] = pm.variables.get(\"spamVoteRequestPath_CHECKER1\").split(\"/\")\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const INTERIM_TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE\");\r", - " const INTERIM_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK\")\r", + " const INTERIM_TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE.en\");\r", + " const INTERIM_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK.en\")\r", + " const BUTTON_ANOTHER_UPDATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ANOTHER_UPDATE.en\")\r", " const instanceId = pm.variables.get(\"spamInstanceId\")\r", " const wamid = pm.variables.get(\"whatsapp_id_11\")\r", - " const interimResponse = INTERIM_TEMPLATE.replace(\"{{%voted}}\", \"33.33\").replace(\"{{prelim_assessment}}\",\"is spam🚧\").replace(\"{{info_placeholder}}\",\"\").replace(\"{{get_feedback}}\",\"\")\r", + " const interimResponse = INTERIM_TEMPLATE.replace(\"{{%voted}}\", \"33.33\").replace(\"{{prelim_assessment}}\",\"spam🚧\").replace(\"{{info_placeholder}}\",\"\").replace(\"{{get_feedback}}\",\"\")\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -3253,7 +3439,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get another update\"\r", + " \"title\": BUTTON_ANOTHER_UPDATE\r", " }\r", " }\r", " ]\r", @@ -3266,6 +3452,7 @@ " \"method\": \"POST\"\r", " }\r", " var jsonData = pm.response.json();\r", + " \r", " pm.expect(jsonData).to.eql(expected);\r", "});" ], @@ -3330,15 +3517,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -3520,15 +3707,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -3725,15 +3912,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -3906,15 +4093,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -3933,7 +4120,8 @@ " const [, messageId, , voteRequestId] = pm.variables.get(\"spamVoteRequestPath_CHECKER1\").split(\"/\")\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const INTERIM_TEMPLATE_UNSURE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE_UNSURE\");\r", + " const INTERIM_TEMPLATE_UNSURE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE_UNSURE.en\");\r", + " const BUTTON_ANOTHER_UPDATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ANOTHER_UPDATE.en\")\r", " const instanceId = pm.variables.get(\"spamInstanceId\")\r", " const interimResponse = INTERIM_TEMPLATE_UNSURE.replace(\"{{%voted}}\", \"66.67\")\r", " const wamid = pm.variables.get(\"whatsapp_id_11\")\r", @@ -3956,7 +4144,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get another update\"\r", + " \"title\": BUTTON_ANOTHER_UPDATE\r", " }\r", " }\r", " ]\r", @@ -4033,15 +4221,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -4223,15 +4411,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -4428,15 +4616,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -4570,16 +4758,21 @@ "pm.test(\"SPAM final reply sent to checker 1\", function () {\r", " const [, messageId, , voteRequestId] = pm.variables.get(\"spamVoteRequestPath_CHECKER3\").split(\"/\")\r", " const instanceId = pm.variables.get(\"spamInstanceId\")\r", - " const SPAM = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SPAM\");\r", - " const THANKS_DELAYED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED\");\r", - " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE\");\r", - " const METHODOLOGY_HUMAN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN\");\r", - " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO\");\r", - " const VOTE_RESULTS_SUFFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.VOTE_RESULTS_SUFFIX\");\r", + " const SPAM = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SPAM.en\");\r", + " const THANKS_DELAYED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED.en\");\r", + " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE.en\");\r", + " const METHODOLOGY_HUMAN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN.en\");\r", + " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO.en\");\r", + " const VOTE_RESULTS_SUFFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.VOTE_RESULTS_SUFFIX.en\");\r", + " const BUTTON_RESULTS = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RESULTS.en\")\r", + " const BUTTON_DECLINE_REPORT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_DECLINE_REPORT.en\")\r", + " const BUTTON_RATIONALISATION = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RATIONALISATION.en\")\r", " const wamid = pm.variables.get(\"whatsapp_id_11\")\r", " const isMachineCategorised = false\r", " const instanceCount = 1\r", " const isImmediate = false\r", + " const isImage = false\r", + " const IMAGE_CAVEAT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.IMAGE_CAVEAT.en\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " function getFinalResponseText(responseText) {\r", " return responseText\r", @@ -4600,6 +4793,7 @@ " : METHODOLOGY_HUMAN\r", " )\r", " .replace(\"{{results}}\", isImmediate ? \"\" : VOTE_RESULTS_SUFFIX)\r", + " .replace(\"{{image_caveat}}\", isImage ? IMAGE_CAVEAT : \"\")\r", " }\r", " const spamResponse = getFinalResponseText(SPAM)\r", " const expected = {\r", @@ -4621,7 +4815,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `votingResults_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"See voting results\"\r", + " \"title\": BUTTON_RESULTS\r", " }\r", " }\r", " ]\r", @@ -4675,7 +4869,10 @@ "pm.test(\"SATISFACTION_SURVEY sent to user1\", function () {\r", " const [, messageId, , voteRequestId] = pm.variables.get(\"spamVoteRequestPath_CHECKER3\").split(\"/\")\r", " const instanceId = pm.variables.get(\"spamInstanceId\")\r", - " const SATISFACTION_SURVEY = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY\");\r", + " const SATISFACTION_SURVEY = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY.en\");\r", + " const NPS_MENU_BUTTON = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.NPS_MENU_BUTTON.en\");\r", + " const MENU_DESCRIPTION_NPS_LIKELY = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_NPS_LIKELY.en\");\r", + " const MENU_DESCRIPTION_NPS_UNLIKELY = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_NPS_UNLIKELY.en\");\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", @@ -4691,14 +4888,14 @@ " \"text\": SATISFACTION_SURVEY\r", " },\r", " \"action\": {\r", - " \"button\": \"Tap to respond\",\r", + " \"button\": NPS_MENU_BUTTON,\r", " \"sections\": [\r", " {\r", " \"rows\": [\r", " {\r", " \"id\": `satisfactionSurvey_10_messages/${messageId}/instances/${instanceId}`,\r", " \"title\": \"10\",\r", - " \"description\": \"Extremely likely 🤩\"\r", + " \"description\": MENU_DESCRIPTION_NPS_LIKELY\r", " },\r", " {\r", " \"id\": `satisfactionSurvey_9_messages/${messageId}/instances/${instanceId}`,\r", @@ -4735,7 +4932,7 @@ " {\r", " \"id\": `satisfactionSurvey_1_messages/${messageId}/instances/${instanceId}`,\r", " \"title\": \"1\",\r", - " \"description\": \"Not at all likely 😥\"\r", + " \"description\": MENU_DESCRIPTION_NPS_UNLIKELY\r", " }\r", " ]\r", " }\r", @@ -4815,15 +5012,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -4838,7 +5035,7 @@ "exec": [ "pm.test(\"ALREADY_REPLIED sent to user 1\", function () {\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const SATISFACTION_SURVEY_THANKS = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY_THANKS\");\r", + " const SATISFACTION_SURVEY_THANKS = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY_THANKS.en\");\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -4915,14 +5112,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages/{{spamMessageId}}/instances/{{spamInstanceId}}", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages/{{spamMessageId}}/instances/{{spamInstanceId}}", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -4984,15 +5181,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -5007,7 +5204,7 @@ "exec": [ "pm.test(\"ALREADY_REPLIED sent to user 1\", function () {\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const ALREADY_REPLIED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.ALREADY_REPLIED\");\r", + " const ALREADY_REPLIED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.ALREADY_REPLIED.en\");\r", " const wamid = pm.variables.get(\"whatsapp_id_11\")\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", @@ -5111,15 +5308,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -5141,7 +5338,7 @@ " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", " \"body\": {\r", " \"text\": {\r", - " \"body\": \"66.67% of our CheckMates thought this was *spam*. 33.33% thought this was *legitimate*.\",\r", + " \"body\": \"66.67% of our CheckMates felt this was *spam🚧*. 33.33% felt this was *legitimate✅*.\",\r", " \"preview_url\": false\r", " },\r", " \"to\": USER_1_NUMBER,\r", @@ -5152,6 +5349,7 @@ " },\r", " \"method\": \"POST\"\r", " }\r", + " console.log(JSON.stringify(expected,null,2))\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData).to.eql(expected);\r", "});" @@ -5243,15 +5441,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -5268,7 +5466,7 @@ " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const wamid = pm.variables.get(\"whatsapp_id_19\")\r", - " const MESSAGE_NOT_YET_ASSESSED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MESSAGE_NOT_YET_ASSESSED\");\r", + " const MESSAGE_NOT_YET_ASSESSED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MESSAGE_NOT_YET_ASSESSED.en\");\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -5689,15 +5887,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -5884,15 +6082,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -6046,14 +6244,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages/{{infoMessageId}}/instances", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages/{{infoMessageId}}/instances", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -6113,15 +6311,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -6142,7 +6340,8 @@ " const wamid = pm.variables.get(\"whatsapp_id_19\")\r", " const [, messageId, , voteRequestId] = pm.variables.get(\"infoVoteRequestPath_CHECKER1\").split(\"/\")\r", " const instanceId = pm.variables.get(\"infoInstanceId\")\r", - " const INTERIM_PROMPT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_PROMPT\");\r", + " const INTERIM_PROMPT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_PROMPT.en\");\r", + " const BUTTON_GET_INTERIM = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_GET_INTERIM.en\")\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -6162,7 +6361,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get interim update\"\r", + " \"title\": BUTTON_GET_INTERIM\r", " }\r", " }\r", " ]\r", @@ -6254,15 +6453,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -6281,11 +6480,13 @@ " const [, messageId, , voteRequestId] = pm.variables.get(\"infoVoteRequestPath_CHECKER1\").split(\"/\")\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const INTERIM_TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE\");\r", - " const INTERIM_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK\")\r", + " const INTERIM_TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE.en\");\r", + " const INTERIM_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK.en\");\r", + " const BUTTON_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_USEFUL.en\");\r", + " const BUTTON_NOT_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_NOT_USEFUL.en\")\r", " const instanceId = pm.variables.get(\"infoInstanceId\")\r", " const wamid = pm.variables.get(\"whatsapp_id_19\")\r", - " const interimResponse = INTERIM_TEMPLATE.replace(\"{{%voted}}\", \"33.33\").replace(\"{{prelim_assessment}}\",\"is untrue❌\").replace(\"{{info_placeholder}}\",\", with an average score of 1.00 on a scale of 0-5 (5 = completely true)\").replace(\"{{get_feedback}}\",INTERIM_FEEDBACK)\r", + " const interimResponse = INTERIM_TEMPLATE.replace(\"{{%voted}}\", \"33.33\").replace(\"{{prelim_assessment}}\",\"untrue❌\").replace(\"{{info_placeholder}}\",\", with an average score of 1.00 on a scale of 0-5 (5 = completely true)\").replace(\"{{get_feedback}}\",INTERIM_FEEDBACK)\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -6305,14 +6506,14 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `feedbackInterim_messages/${messageId}/instances/${instanceId}_yes`,\r", - " \"title\": \"Yes, it's useful\"\r", + " \"title\": BUTTON_USEFUL\r", " }\r", " },\r", " {\r", " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `feedbackInterim_messages/${messageId}/instances/${instanceId}_no`,\r", - " \"title\": \"No, it's not\"\r", + " \"title\": BUTTON_NOT_USEFUL\r", " }\r", " }\r", " ]\r", @@ -6386,14 +6587,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages/{{infoMessageId}}/instances/{{infoInstanceId}}", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages/{{infoMessageId}}/instances/{{infoInstanceId}}", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -6439,15 +6640,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -6634,15 +6835,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -6774,16 +6975,21 @@ "pm.test(\"UNTRUE final reply sent to checker 1\", function () {\r", " const [, messageId, , voteRequestId] = pm.variables.get(\"infoVoteRequestPath_CHECKER3\").split(\"/\")\r", " const instanceId = pm.variables.get(\"infoInstanceId\")\r", - " const UNTRUE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.UNTRUE\");\r", - " const THANKS_DELAYED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED\");\r", - " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE\");\r", - " const METHODOLOGY_HUMAN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN\");\r", - " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO\");\r", - " const VOTE_RESULTS_SUFFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.VOTE_RESULTS_SUFFIX\");\r", + " const UNTRUE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.UNTRUE.en\");\r", + " const THANKS_DELAYED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED.en\");\r", + " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE.en\");\r", + " const METHODOLOGY_HUMAN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN.en\");\r", + " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO.en\");\r", + " const VOTE_RESULTS_SUFFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.VOTE_RESULTS_SUFFIX.en\");\r", + " const BUTTON_RESULTS = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RESULTS.en\")\r", + " const BUTTON_DECLINE_REPORT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_DECLINE_REPORT.en\")\r", + " const BUTTON_RATIONALISATION = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RATIONALISATION.en\")\r", " const wamid = pm.variables.get(\"whatsapp_id_19\")\r", " const isMachineCategorised = false\r", " const instanceCount = 1\r", " const isImmediate = false\r", + " const isImage = false\r", + " const IMAGE_CAVEAT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.IMAGE_CAVEAT.en\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " function getFinalResponseText(responseText) {\r", " return responseText\r", @@ -6804,6 +7010,7 @@ " : METHODOLOGY_HUMAN\r", " )\r", " .replace(\"{{results}}\", isImmediate ? \"\" : VOTE_RESULTS_SUFFIX)\r", + " .replace(\"{{image_caveat}}\", isImage ? IMAGE_CAVEAT : \"\")\r", " }\r", " const response = getFinalResponseText(UNTRUE)\r", " const expected = {\r", @@ -6825,7 +7032,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `votingResults_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"See voting results\"\r", + " \"title\": BUTTON_RESULTS\r", " }\r", " }\r", " ]\r", @@ -6902,15 +7109,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -7097,15 +7304,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -7280,15 +7487,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -7304,13 +7511,16 @@ "pm.test(\"STATS_TEMPLATE sent to user 1\", function () {\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const wamid = pm.variables.get(\"whatsapp_id_19\")\r", + " const STATS_TEMPLATE_1 = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.STATS_TEMPLATE_1.en\")\r", + " const PLACEHOLDER_MISLEADING = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_MISLEADING.en\")\r", + " const expectedBody = STATS_TEMPLATE_1.replace(\"{{top}}\", \"100.00\").replace(\"{{category}}\",PLACEHOLDER_MISLEADING).replace(\"{{info_placeholder}}\",\", with an average score of 2.33 on a scale of 0-5 (5 = completely true)\")\r", " //we not using the template for this, its hardcoded.\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", " \"body\": {\r", " \"text\": {\r", - " \"body\": \"100.00% of our CheckMates collectively thought this was *misleading*, with an average score of 2.33 on a scale of 0-5 (5 = completely true).\",\r", + " \"body\": expectedBody,\r", " \"preview_url\": false\r", " },\r", " \"to\": USER_1_NUMBER,\r", @@ -7411,15 +7621,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -7436,7 +7646,7 @@ " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const wamid = pm.variables.get(\"whatsapp_id_23\")\r", - " const MESSAGE_NOT_YET_ASSESSED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MESSAGE_NOT_YET_ASSESSED\");\r", + " const MESSAGE_NOT_YET_ASSESSED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MESSAGE_NOT_YET_ASSESSED.en\");\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -7857,15 +8067,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -8047,15 +8257,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -8251,15 +8461,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -8433,15 +8643,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -8486,14 +8696,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages/{{unsureMessageId}}/instances", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages/{{unsureMessageId}}/instances", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -8520,7 +8730,8 @@ " const wamid = pm.variables.get(\"whatsapp_id_23\")\r", " const [, messageId, , voteRequestId] = pm.variables.get(\"unsureVoteRequestPath_CHECKER1\").split(\"/\")\r", " const instanceId = pm.variables.get(\"unsureInstanceId\")\r", - " const INTERIM_PROMPT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_PROMPT\");\r", + " const INTERIM_PROMPT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_PROMPT.en\");\r", + " const BUTTON_GET_INTERIM = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_GET_INTERIM.en\")\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -8540,7 +8751,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get interim update\"\r", + " \"title\": BUTTON_GET_INTERIM\r", " }\r", " }\r", " ]\r", @@ -8632,15 +8843,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -8660,7 +8871,8 @@ " const [, messageId, , voteRequestId] = pm.variables.get(\"unsureVoteRequestPath_CHECKER1\").split(\"/\")\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const INTERIM_TEMPLATE_UNSURE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE_UNSURE\");\r", + " const INTERIM_TEMPLATE_UNSURE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE_UNSURE.en\");\r", + " const BUTTON_ANOTHER_UPDATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ANOTHER_UPDATE.en\")\r", " const instanceId = pm.variables.get(\"unsureInstanceId\")\r", " const interimResponse = INTERIM_TEMPLATE_UNSURE.replace(\"{{%voted}}\", \"33.33\")\r", " const expected = {\r", @@ -8682,7 +8894,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get another update\"\r", + " \"title\": BUTTON_ANOTHER_UPDATE\r", " }\r", " }\r", " ]\r", @@ -8756,14 +8968,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages/{{unsureMessageId}}/instances/{{unsureInstanceId}}", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages/{{unsureMessageId}}/instances/{{unsureInstanceId}}", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -8818,15 +9030,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -8996,15 +9208,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -9024,10 +9236,12 @@ " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const wamid = pm.variables.get(\"whatsapp_id_23\")\r", - " const INTERIM_TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE\");\r", - " const INTERIM_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK\")\r", + " const INTERIM_TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE.en\");\r", + " const INTERIM_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK.en\")\r", + " const BUTTON_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_USEFUL.en\");\r", + " const BUTTON_NOT_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_NOT_USEFUL.en\")\r", " const instanceId = pm.variables.get(\"unsureInstanceId\")\r", - " const interimResponse = INTERIM_TEMPLATE.replace(\"{{%voted}}\", \"33.33\").replace(\"{{prelim_assessment}}\",\"is legitimate✅\").replace(\"{{info_placeholder}}\",\"\").replace(\"{{get_feedback}}\",INTERIM_FEEDBACK)\r", + " const interimResponse = INTERIM_TEMPLATE.replace(\"{{%voted}}\", \"33.33\").replace(\"{{prelim_assessment}}\",\"legitimate✅\").replace(\"{{info_placeholder}}\",\"\").replace(\"{{get_feedback}}\",INTERIM_FEEDBACK)\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -9047,14 +9261,14 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `feedbackInterim_messages/${messageId}/instances/${instanceId}_yes`,\r", - " \"title\": \"Yes, it's useful\"\r", + " \"title\": BUTTON_USEFUL\r", " }\r", " },\r", " {\r", " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `feedbackInterim_messages/${messageId}/instances/${instanceId}_no`,\r", - " \"title\": \"No, it's not\"\r", + " \"title\": BUTTON_NOT_USEFUL\r", " }\r", " }\r", " ]\r", @@ -9066,6 +9280,7 @@ " },\r", " \"method\": \"POST\"\r", " }\r", + " console.log(JSON.stringify(expected,null,2))\r", " var jsonData = pm.response.json();\r", " \r", " pm.expect(jsonData).to.eql(expected);\r", @@ -9128,14 +9343,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages/{{unsureMessageId}}/instances/{{unsureInstanceId}}", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages/{{unsureMessageId}}/instances/{{unsureInstanceId}}", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -9196,15 +9411,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -9224,7 +9439,8 @@ " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const wamid = pm.variables.get(\"whatsapp_id_23\")\r", - " const INTERIM_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_USEFUL\");\r", + " const INTERIM_USEFUL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_USEFUL.en\");\r", + " const BUTTON_ANOTHER_UPDATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ANOTHER_UPDATE.en\")\r", " const instanceId = pm.variables.get(\"unsureInstanceId\")\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", @@ -9245,7 +9461,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get another update\"\r", + " \"title\": BUTTON_ANOTHER_UPDATE\r", " }\r", " }\r", " ]\r", @@ -9318,14 +9534,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages/{{unsureMessageId}}/instances/{{unsureInstanceId}}", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages/{{unsureMessageId}}/instances/{{unsureInstanceId}}", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -9371,15 +9587,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -9561,15 +9777,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -9763,15 +9979,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -9941,15 +10157,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -9969,9 +10185,11 @@ " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const wamid = pm.variables.get(\"whatsapp_id_23\")\r", - " const INTERIM_TEMPLATE_UNSURE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE_UNSURE\");\r", + " const INTERIM_TEMPLATE_UNSURE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE_UNSURE.en\");\r", + " const BUTTON_ANOTHER_UPDATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ANOTHER_UPDATE.en\");\r", " const instanceId = pm.variables.get(\"unsureInstanceId\")\r", " const interimResponse = INTERIM_TEMPLATE_UNSURE.replace(\"{{%voted}}\", \"66.67\")\r", + "\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", @@ -9991,7 +10209,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `sendInterim_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"Get another update\"\r", + " \"title\": BUTTON_ANOTHER_UPDATE\r", " }\r", " }\r", " ]\r", @@ -10070,15 +10288,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -10260,15 +10478,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -10464,15 +10682,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -10604,16 +10822,21 @@ "pm.test(\"UNSURE final reply sent to user 1\", function () {\r", " const [, messageId, , voteRequestId] = pm.variables.get(\"unsureVoteRequestPath_CHECKER3\").split(\"/\")\r", " const instanceId = pm.variables.get(\"unsureInstanceId\")\r", - " const UNSURE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.UNSURE\");\r", - " const THANKS_DELAYED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED\");\r", - " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE\");\r", - " const METHODOLOGY_HUMAN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN\");\r", - " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO\");\r", - " const VOTE_RESULTS_SUFFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.VOTE_RESULTS_SUFFIX\");\r", + " const UNSURE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.UNSURE.en\");\r", + " const THANKS_DELAYED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED.en\");\r", + " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE.en\");\r", + " const METHODOLOGY_HUMAN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN.en\");\r", + " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO.en\");\r", + " const VOTE_RESULTS_SUFFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.VOTE_RESULTS_SUFFIX.en\");\r", + " const BUTTON_RESULTS = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RESULTS.en\")\r", + " const BUTTON_DECLINE_REPORT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_DECLINE_REPORT.en\")\r", + " const BUTTON_RATIONALISATION = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RATIONALISATION.en\")\r", " const wamid = pm.variables.get(\"whatsapp_id_23\")\r", " const isMachineCategorised = false\r", " const instanceCount = 1\r", " const isImmediate = false\r", + " const isImage = false\r", + " const IMAGE_CAVEAT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.IMAGE_CAVEAT.en\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " function getFinalResponseText(responseText) {\r", " return responseText\r", @@ -10634,6 +10857,7 @@ " : METHODOLOGY_HUMAN\r", " )\r", " .replace(\"{{results}}\", isImmediate ? \"\" : VOTE_RESULTS_SUFFIX)\r", + " .replace(\"{{image_caveat}}\", isImage ? IMAGE_CAVEAT : \"\")\r", " }\r", " const response = getFinalResponseText(UNSURE)\r", " const expected = {\r", @@ -10655,7 +10879,7 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": `votingResults_messages/${messageId}/instances/${instanceId}`,\r", - " \"title\": \"See voting results\"\r", + " \"title\": BUTTON_RESULTS\r", " }\r", " }\r", " ]\r", @@ -10752,15 +10976,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -10782,7 +11006,7 @@ " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", " \"body\": {\r", " \"text\": {\r", - " \"body\": \"33.33% of our CheckMates thought this was *spam*. 33.33% collectively thought this was *misleading*, with an average score of 3.00 on a scale of 0-5 (5 = completely true).\",\r", + " \"body\": \"33.33% of our CheckMates felt this was *spam🚧*. 33.33% felt this was *misleading⚠️*, with an average score of 3.00 on a scale of 0-5 (5 = completely true).\",\r", " \"preview_url\": false\r", " },\r", " \"to\": USER_1_NUMBER,\r", @@ -10880,15 +11104,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -10902,67 +11126,90 @@ "script": { "exec": [ "pm.test(\"Your test name\", function () {\r", - " const MENU = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU\");\r", - " const PREFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_PREFIX\");\r", - " const MENU_TEXT = MENU.replace(\"{{prefix}}\",PREFIX)\r", - " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", - " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", - " const expected = {\r", - " \"hostname\": \"resultserver\",\r", - " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", - " \"body\": {\r", - " \"messaging_product\": \"whatsapp\",\r", - " \"recipient_type\": \"individual\",\r", - " \"to\": USER_1_NUMBER,\r", - " \"type\": \"interactive\",\r", - " \"interactive\": {\r", - " \"type\": \"list\",\r", - " \"body\": {\r", - " \"text\": MENU_TEXT\r", - " },\r", - " \"action\": {\r", - " \"button\": \"View Menu\",\r", - " \"sections\": [\r", - " {\r", - " \"rows\": [\r", - " {\r", - " \"id\": \"menu_check\",\r", - " \"title\": \"Check/Report\",\r", - " \"description\": \"Send in messages, images, or screenshots for checking!\"\r", - " },\r", - " {\r", - " \"id\": \"menu_referral\",\r", - " \"title\": \"Get Referral Link\",\r", - " \"description\": \"Get referral link to forward to others\"\r", - " },\r", - " {\r", - " \"id\": \"menu_help\",\r", - " \"title\": \"Get Help\",\r", - " \"description\": \"Find out how to use CheckMate to check or report dubious messages\"\r", - " },\r", - " {\r", - " \"id\": \"menu_about\",\r", - " \"title\": \"About CheckMate\",\r", - " \"description\": \"Learn more about CheckMate and the team behind it\"\r", - " },\r", - " {\r", - " \"id\": \"menu_feedback\",\r", - " \"title\": \"Send Feedback\",\r", - " \"description\": \"Send us feedback on anything to do with CheckMate\"\r", - " },\r", - " {\r", - " \"id\": \"menu_contact\",\r", - " \"title\": \"Get Contact\",\r", - " \"description\": \"Get CheckMate's contact to add to your contact list\"\r", - " }\r", - " ]\r", - " }\r", - " ]\r", + " const MENU = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU.en\");\r", + " const PREFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_PREFIX.en\");\r", + " const MENU_TEXT = MENU.replace(\"{{prefix}}\",PREFIX);\r", + " const MENU_BUTTON = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_BUTTON.en\");\r", + " const MENU_TITLE_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CHECK.en\");\r", + " const MENU_DESCRIPTION_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CHECK.en\");\r", + " const MENU_TITLE_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_REFERRAL.en\");\r", + " const MENU_DESCRIPTION_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_REFERRAL.en\");\r", + " const MENU_TITLE_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_ABOUT.en\");\r", + " const MENU_DESCRIPTION_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_ABOUT.en\");\r", + " const MENU_TITLE_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_HELP.en\");\r", + " const MENU_DESCRIPTION_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_HELP.en\");\r", + " const MENU_TITLE_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_FEEDBACK.en\");\r", + " const MENU_DESCRIPTION_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_FEEDBACK.en\");\r", + " const MENU_TITLE_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_LANGUAGE.en\")\r", + " const MENU_DESCRIPTION_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_LANGUAGE.en\")\r", + " const MENU_TITLE_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CONTACT.en\");\r", + " const MENU_DESCRIPTION_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CONTACT.en\");\r", + " const MENU_TITLE_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_DISPUTE.en\")\r", + " const MENU_DESCRIPTION_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_DISPUTE.en\")\r", + " \r", + " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", + " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", + " const expected = {\r", + " \"hostname\": \"resultserver\",\r", + " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", + " \"body\": {\r", + " \"messaging_product\": \"whatsapp\",\r", + " \"recipient_type\": \"individual\",\r", + " \"to\": USER_1_NUMBER,\r", + " \"type\": \"interactive\",\r", + " \"interactive\": {\r", + " \"type\": \"list\",\r", + " \"body\": {\r", + " \"text\": MENU_TEXT\r", + " },\r", + " \"action\": {\r", + " \"button\": MENU_BUTTON,\r", + " \"sections\": [\r", + " {\r", + " \"rows\": [\r", + " {\r", + " \"id\": \"menu_check\",\r", + " \"title\": MENU_TITLE_CHECK,\r", + " \"description\": MENU_DESCRIPTION_CHECK\r", + " },\r", + " {\r", + " \"id\": \"menu_referral\",\r", + " \"title\": MENU_TITLE_REFERRAL,\r", + " \"description\": MENU_DESCRIPTION_REFERRAL\r", + " },\r", + " {\r", + " \"id\": \"menu_help\",\r", + " \"title\": MENU_TITLE_HELP,\r", + " \"description\": MENU_DESCRIPTION_HELP\r", + " },\r", + " {\r", + " \"id\": \"menu_about\",\r", + " \"title\": MENU_TITLE_ABOUT,\r", + " \"description\": MENU_DESCRIPTION_ABOUT\r", + " },\r", + " {\r", + " \"id\": \"menu_feedback\",\r", + " \"title\": MENU_TITLE_FEEDBACK,\r", + " \"description\": MENU_DESCRIPTION_FEEDBACK\r", + " },\r", + " {\r", + " \"id\": \"menu_language\",\r", + " \"title\": MENU_TITLE_LANGUAGE,\r", + " \"description\": MENU_DESCRIPTION_LANGUAGE\r", + " },\r", + " {\r", + " \"id\": \"menu_contact\",\r", + " \"title\": MENU_TITLE_CONTACT,\r", + " \"description\": MENU_DESCRIPTION_CONTACT\r", + " }\r", + " ]\r", + " }\r", + " ]\r", + " }\r", " }\r", - " }\r", - " },\r", - " \"method\": \"POST\"\r", - "}\r", + " },\r", + " \"method\": \"POST\"\r", + " }\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData).to.eql(expected);\r", "});" @@ -11043,15 +11290,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -11065,7 +11312,7 @@ "script": { "exec": [ "pm.test(\"Your test name\", function () {\r", - " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.PROCEED_TO_SEND\");\r", + " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.PROCEED_TO_SEND.en\");\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", @@ -11161,15 +11408,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -11183,7 +11430,7 @@ "script": { "exec": [ "pm.test(\"Your test name\", function () {\r", - " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.HOW_TO\");\r", + " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.HOW_TO.en\");\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", @@ -11279,15 +11526,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -11301,7 +11548,7 @@ "script": { "exec": [ "pm.test(\"Your test name\", function () {\r", - " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.LEARN_MORE\");\r", + " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.LEARN_MORE.en\");\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", @@ -11397,15 +11644,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -11419,7 +11666,7 @@ "script": { "exec": [ "pm.test(\"Your test name\", function () {\r", - " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.FEEDBACK\");\r", + " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.FEEDBACK.en\");\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", @@ -11468,7 +11715,7 @@ "response": [] }, { - "name": "Make Menu Selection (\"Get Contact\")", + "name": "Make Menu Selection (\"Select Language\")", "event": [ { "listen": "test", @@ -11486,7 +11733,7 @@ "script": { "exec": [ "// 1. Retrieve the current messageCounter and increment it.\r", - "let messageCounter = 35\r", + "let messageCounter = 34\r", "\r", "const whatsappId = \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFA1==\";\r", "\r", @@ -11507,7 +11754,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"15550933685\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n {\r\n \"profile\": {\r\n \"name\": \"{{USER_1_NAME}}\"\r\n },\r\n \"wa_id\": \"{{USER_1_NUMBER}}\"\r\n }\r\n ],\r\n \"messages\": [\r\n {\r\n \"context\": {\r\n \"from\": \"15550933685\",\r\n \"id\": \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==\"\r\n },\r\n \"from\": \"{{USER_1_NUMBER}}\",\r\n \"id\": \"{{whatsapp_id_35}}\",\r\n \"timestamp\": {{$timestamp}},\r\n \"type\": \"interactive\",\r\n \"interactive\": {\r\n \"type\": \"list_reply\",\r\n \"list_reply\": {\r\n \"id\": \"menu_contact\",\r\n \"title\": \"Get Contact\",\r\n \"description\": \"Get CheckMates contact to add to your contact list\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}", + "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"15550933685\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n {\r\n \"profile\": {\r\n \"name\": \"{{USER_1_NAME}}\"\r\n },\r\n \"wa_id\": \"{{USER_1_NUMBER}}\"\r\n }\r\n ],\r\n \"messages\": [\r\n {\r\n \"context\": {\r\n \"from\": \"15550933685\",\r\n \"id\": \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==\"\r\n },\r\n \"from\": \"{{USER_1_NUMBER}}\",\r\n \"id\": \"{{whatsapp_id_34}}\",\r\n \"timestamp\": {{$timestamp}},\r\n \"type\": \"interactive\",\r\n \"interactive\": {\r\n \"type\": \"list_reply\",\r\n \"list_reply\": {\r\n \"id\": \"menu_language\",\r\n \"title\": \"{{__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_LANGUAGE.en}}\",\r\n \"description\": \"{{__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_LANGUAGE.en}}}\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}", "options": { "raw": { "language": "json" @@ -11515,29 +11762,34 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, "response": [] }, { - "name": "Get last message (contact type)", + "name": "Get last message (SELECT LANGUAGE)", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Your test name\", function () {\r", - " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", + "pm.test(\"Select language\", function () {\r", + " const NEW_USER_PREFIX_EN = \"\"\r", + " const NEW_USER_PREFIX_CN = \"\"\r", + " const LANGUAGE_SELECTION = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.LANGUAGE_SELECTION.en\")\r", + " const BUTTON_ENGLISH = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ENGLISH.en\")\r", + " const BUTTON_CHINESE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_CHINESE.en\")\r", + " const BODY_TEXT = LANGUAGE_SELECTION.replace(\"{{new_user_en}}\",NEW_USER_PREFIX_EN).replace(\"{{new_user_cn}}\",NEW_USER_PREFIX_CN)\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", " \"hostname\": \"resultserver\",\r", @@ -11546,8 +11798,324 @@ " \"messaging_product\": \"whatsapp\",\r", " \"recipient_type\": \"individual\",\r", " \"to\": USER_1_NUMBER,\r", - " \"type\": \"contacts\",\r", - " \"contacts\": [\r", + " \"type\": \"interactive\",\r", + " \"interactive\": {\r", + " \"type\": \"button\",\r", + " \"body\": {\r", + " \"text\": BODY_TEXT\r", + " },\r", + " \"action\": {\r", + " \"buttons\": [\r", + " {\r", + " \"type\": \"reply\",\r", + " \"reply\": {\r", + " \"id\": \"languageSelection_en\",\r", + " \"title\": BUTTON_ENGLISH\r", + " }\r", + " },\r", + " {\r", + " \"type\": \"reply\",\r", + " \"reply\": {\r", + " \"id\": \"languageSelection_cn\",\r", + " \"title\": BUTTON_CHINESE\r", + " }\r", + " }\r", + " ]\r", + " }\r", + " },\r", + " },\r", + " \"method\": \"POST\"\r", + " }\r", + "\r", + " var jsonData = pm.response.json();\r", + "\r", + " pm.expect(jsonData).to.eql(expected);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(() => {}, 3000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{RESULT_SERVER_URL}}/testresultdata", + "host": [ + "{{RESULT_SERVER_URL}}" + ], + "path": [ + "testresultdata" + ] + } + }, + "response": [] + }, + { + "name": "Press English Button", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"6580431949\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n {\r\n \"profile\": {\r\n \"name\": \"{{USER_1_NAME}}\"\r\n },\r\n \"wa_id\": \"{{USER_1_NUMBER}}\"\r\n }\r\n ],\r\n \"messages\": [\r\n {\r\n \"context\": {\r\n \"from\": \"6580431949\",\r\n \"id\": \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==\"\r\n },\r\n \"from\": \"{{USER_1_NUMBER}}\",\r\n \"id\": \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==\",\r\n \"timestamp\": {{$timestamp}},\r\n \"type\": \"interactive\",\r\n \"interactive\": {\r\n \"type\": \"button_reply\",\r\n \"button_reply\": {\r\n \"id\": \"languageSelection_en\",\r\n \"title\": \"{{__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ENGLISH.en}}\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", + "host": [ + "{{FUNCTIONS_URL}}" + ], + "path": [ + "{{PROJECT_ID}}", + "asia-southeast1", + "webhookHandlerV2", + "{{WEBHOOK_PATH}}" + ] + } + }, + "response": [] + }, + { + "name": "Get last message (USER_MENU)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Your test name\", function () {\r", + " const MENU = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU.en\");\r", + " const PREFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_PREFIX.en\");\r", + " const MENU_TEXT = MENU.replace(\"{{prefix}}\",PREFIX);\r", + " const MENU_BUTTON = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_BUTTON.en\");\r", + " const MENU_TITLE_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CHECK.en\");\r", + " const MENU_DESCRIPTION_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CHECK.en\");\r", + " const MENU_TITLE_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_REFERRAL.en\");\r", + " const MENU_DESCRIPTION_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_REFERRAL.en\");\r", + " const MENU_TITLE_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_ABOUT.en\");\r", + " const MENU_DESCRIPTION_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_ABOUT.en\");\r", + " const MENU_TITLE_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_HELP.en\");\r", + " const MENU_DESCRIPTION_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_HELP.en\");\r", + " const MENU_TITLE_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_FEEDBACK.en\");\r", + " const MENU_DESCRIPTION_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_FEEDBACK.en\");\r", + " const MENU_TITLE_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_LANGUAGE.en\")\r", + " const MENU_DESCRIPTION_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_LANGUAGE.en\")\r", + " const MENU_TITLE_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CONTACT.en\");\r", + " const MENU_DESCRIPTION_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CONTACT.en\");\r", + " const MENU_TITLE_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_DISPUTE.en\")\r", + " const MENU_DESCRIPTION_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_DISPUTE.en\")\r", + " \r", + " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", + " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", + " const expected = {\r", + " \"hostname\": \"resultserver\",\r", + " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", + " \"body\": {\r", + " \"messaging_product\": \"whatsapp\",\r", + " \"recipient_type\": \"individual\",\r", + " \"to\": USER_1_NUMBER,\r", + " \"type\": \"interactive\",\r", + " \"interactive\": {\r", + " \"type\": \"list\",\r", + " \"body\": {\r", + " \"text\": MENU_TEXT\r", + " },\r", + " \"action\": {\r", + " \"button\": MENU_BUTTON,\r", + " \"sections\": [\r", + " {\r", + " \"rows\": [\r", + " {\r", + " \"id\": \"menu_check\",\r", + " \"title\": MENU_TITLE_CHECK,\r", + " \"description\": MENU_DESCRIPTION_CHECK\r", + " },\r", + " {\r", + " \"id\": \"menu_referral\",\r", + " \"title\": MENU_TITLE_REFERRAL,\r", + " \"description\": MENU_DESCRIPTION_REFERRAL\r", + " },\r", + " {\r", + " \"id\": \"menu_help\",\r", + " \"title\": MENU_TITLE_HELP,\r", + " \"description\": MENU_DESCRIPTION_HELP\r", + " },\r", + " {\r", + " \"id\": \"menu_about\",\r", + " \"title\": MENU_TITLE_ABOUT,\r", + " \"description\": MENU_DESCRIPTION_ABOUT\r", + " },\r", + " {\r", + " \"id\": \"menu_feedback\",\r", + " \"title\": MENU_TITLE_FEEDBACK,\r", + " \"description\": MENU_DESCRIPTION_FEEDBACK\r", + " },\r", + " {\r", + " \"id\": \"menu_language\",\r", + " \"title\": MENU_TITLE_LANGUAGE,\r", + " \"description\": MENU_DESCRIPTION_LANGUAGE\r", + " },\r", + " {\r", + " \"id\": \"menu_contact\",\r", + " \"title\": MENU_TITLE_CONTACT,\r", + " \"description\": MENU_DESCRIPTION_CONTACT\r", + " }\r", + " ]\r", + " }\r", + " ]\r", + " }\r", + " }\r", + " },\r", + " \"method\": \"POST\"\r", + " }\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData).to.eql(expected);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(() => {}, 3000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{RESULT_SERVER_URL}}/testresultdata", + "host": [ + "{{RESULT_SERVER_URL}}" + ], + "path": [ + "testresultdata" + ] + } + }, + "response": [] + }, + { + "name": "Make Menu Selection (\"Get Contact\")", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "// 1. Retrieve the current messageCounter and increment it.\r", + "let messageCounter = 35\r", + "\r", + "const whatsappId = \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFA1==\";\r", + "\r", + "// 3. Replace the last n characters (excluding the == at the end) of whatsappId with the new messageCounter\r", + "let n = messageCounter.toString().length;\r", + "let basePart = whatsappId.substring(0, whatsappId.length - n - 2);\r", + "let newId = basePart + messageCounter + \"==\";\r", + "\r", + "pm.collectionVariables.set(`whatsapp_id_${messageCounter}`, newId)\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"15550933685\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n {\r\n \"profile\": {\r\n \"name\": \"{{USER_1_NAME}}\"\r\n },\r\n \"wa_id\": \"{{USER_1_NUMBER}}\"\r\n }\r\n ],\r\n \"messages\": [\r\n {\r\n \"context\": {\r\n \"from\": \"15550933685\",\r\n \"id\": \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==\"\r\n },\r\n \"from\": \"{{USER_1_NUMBER}}\",\r\n \"id\": \"{{whatsapp_id_35}}\",\r\n \"timestamp\": {{$timestamp}},\r\n \"type\": \"interactive\",\r\n \"interactive\": {\r\n \"type\": \"list_reply\",\r\n \"list_reply\": {\r\n \"id\": \"menu_contact\",\r\n \"title\": \"Get Contact\",\r\n \"description\": \"Get CheckMates contact to add to your contact list\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", + "host": [ + "{{FUNCTIONS_URL}}" + ], + "path": [ + "{{PROJECT_ID}}", + "asia-southeast1", + "webhookHandlerV2", + "{{WEBHOOK_PATH}}" + ] + } + }, + "response": [] + }, + { + "name": "Get last message (contact type)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Your test name\", function () {\r", + " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", + " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", + " const expected = {\r", + " \"hostname\": \"resultserver\",\r", + " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", + " \"body\": {\r", + " \"messaging_product\": \"whatsapp\",\r", + " \"recipient_type\": \"individual\",\r", + " \"to\": USER_1_NUMBER,\r", + " \"type\": \"contacts\",\r", + " \"contacts\": [\r", " {\r", " \"name\": {\r", " \"formatted_name\": \"CheckMate\",\r", @@ -11608,7 +12176,7 @@ "script": { "exec": [ "pm.test(\"Your test name\", function () {\r", - " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.CONTACT\");\r", + " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.CONTACT.en\");\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", @@ -11695,15 +12263,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -11717,7 +12285,7 @@ "script": { "exec": [ "pm.test(\"Your test name\", function () {\r", - " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL\");\r", + " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL.en\");\r", " const link = pm.variables.get(\"referralLink_USER1\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const referralMessage = BODY_TEXT.replace(\"{{link}}\", link)\r", @@ -11819,15 +12387,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -11841,14 +12409,17 @@ "script": { "exec": [ "pm.test(\"scam immediate autocategorised no matched response\", function () {\r", - " const TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SCAM\");\r", - " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE\")\r", - " const THANKS_DELAYED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED\")\r", - " const METHODOLOGY_HUMAN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN\")\r", - " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO\")\r", - " const VOTE_RESULTS_SUFFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.VOTE_RESULTS_SUFFIX\")\r", + " const TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SCAM.en\");\r", + " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE.en\")\r", + " const THANKS_DELAYED = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED.en\")\r", + " const METHODOLOGY_HUMAN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN.en\")\r", + " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO.en\")\r", + " const VOTE_RESULTS_SUFFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.VOTE_RESULTS_SUFFIX.en\")\r", + " const BUTTON_RESULTS = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RESULTS.en\")\r", + " const BUTTON_DECLINE_REPORT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_DECLINE_REPORT.en\")\r", + " const BUTTON_RATIONALISATION = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RATIONALISATION.en\")\r", " const wamid = pm.variables.get(\"whatsapp_id_37\")\r", - " const BODY_TEXT = TEMPLATE.replace(\"{{thanks}}\",THANKS_IMMEDIATE).replace(\"{{methodology}}\",METHODOLOGY_AUTO).replace(\"{{matched}}\",\"\").replace(\"{{results}}\",\"\")\r", + " const BODY_TEXT = TEMPLATE.replace(\"{{thanks}}\",THANKS_IMMEDIATE).replace(\"{{methodology}}\",METHODOLOGY_AUTO).replace(\"{{matched}}\",\"\").replace(\"{{results}}\",\"\").replace(\"{{image_caveat}}\",\"\")\r", " const USER_1_NAME = pm.variables.get(\"USER_1_NAME\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", @@ -11870,14 +12441,14 @@ " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": \"ID\",\r", - " \"title\": \"How'd we tell?\"\r", + " \"title\": BUTTON_RATIONALISATION\r", " }\r", " },\r", " {\r", " \"type\": \"reply\",\r", " \"reply\": {\r", " \"id\": \"ID\",\r", - " \"title\": \"Don't report this\"\r", + " \"title\": BUTTON_DECLINE_REPORT\r", " }\r", " }\r", " ]\r", @@ -11988,15 +12559,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -12010,10 +12581,13 @@ "script": { "exec": [ "pm.test(\"spam immediate autocategorised no matched response\", function () {\r", - " const TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SPAM\");\r", - " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE\")\r", - " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO\")\r", - " const BODY_TEXT = TEMPLATE.replace(\"{{thanks}}\",THANKS_IMMEDIATE).replace(\"{{methodology}}\",METHODOLOGY_AUTO).replace(\"{{matched}}\",\"\")\r", + " const TEMPLATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.SPAM.en\");\r", + " const THANKS_IMMEDIATE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE.en\")\r", + " const METHODOLOGY_AUTO = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO.en\")\r", + " const BUTTON_RESULTS = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RESULTS.en\")\r", + " const BUTTON_DECLINE_REPORT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_DECLINE_REPORT.en\")\r", + " const BUTTON_RATIONALISATION = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RATIONALISATION.en\")\r", + " const BODY_TEXT = TEMPLATE.replace(\"{{thanks}}\",THANKS_IMMEDIATE).replace(\"{{methodology}}\",METHODOLOGY_AUTO).replace(\"{{matched}}\",\"\").replace(\"{{image_caveat}}\",\"\")\r", " const wamid = pm.variables.get(\"whatsapp_id_38\")\r", " const USER_1_NUMBER = pm.variables.get(\"USER_1_NUMBER\")\r", " const expected = {\r", @@ -12083,6 +12657,7 @@ " const actions = Object.values(initialJourney).map((obj) => obj.stringValue)\r", " const expected = [\r", " \"text_machine_irrelevant_length\",\r", + " \"languageSelection_en\",\r", " \"text_machine_irrelevant_length\",\r", " \"menu_dispute\",\r", " \"text_machine_unsure\",\r", @@ -12108,6 +12683,8 @@ " \"menu_help\",\r", " \"menu_about\",\r", " \"menu_feedback\",\r", + " \"menu_language\",\r", + " \"languageSelection_en\",\r", " \"menu_contact\",\r", " \"menu_referral\",\r", " \"text_machine_scam\",\r", @@ -12130,14 +12707,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/users/{{USER_1_NUMBER}}", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/users/{{USER_1_NUMBER}}", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -12193,7 +12770,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"15550933685\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n { \"profile\": { \"name\": \"{{USER_2_NAME}}\" }, \"wa_id\": \"{{USER_2_NUMBER}}\" }\r\n ],\r\n \"messages\": [\r\n {\r\n \"from\": \"{{USER_2_NUMBER}}\",\r\n \"id\": \"{{whatsapp_id_39}}\",\r\n \"timestamp\": {{$timestamp}},\r\n \"text\": { \"body\": \"{{__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_PREPOPULATED_PREFIX}} {{referralId_USER1}}\" },\r\n \"type\": \"text\"\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}\r\n", + "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"15550933685\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n { \"profile\": { \"name\": \"{{USER_2_NAME}}\" }, \"wa_id\": \"{{USER_2_NUMBER}}\" }\r\n ],\r\n \"messages\": [\r\n {\r\n \"from\": \"{{USER_2_NUMBER}}\",\r\n \"id\": \"{{whatsapp_id_39}}\",\r\n \"timestamp\": {{$timestamp}},\r\n \"text\": { \"body\": \"{{__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_PREPOPULATED_PREFIX.en}} {{referralId_USER1}}\" },\r\n \"type\": \"text\"\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}\r\n", "options": { "raw": { "language": "json" @@ -12201,88 +12778,247 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, "response": [] }, { - "name": "Get last message (NEW_USER_MENU)", + "name": "Get last message (SELECT LANGUAGE)", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Your test name\", function () {\r", - " const MENU = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU\");\r", - " const PREFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_MENU_PREFIX\");\r", - " const MENU_TEXT = MENU.replace(\"{{prefix}}\",PREFIX)\r", + "pm.test(\"Select language\", function () {\r", + " const NEW_USER_PREFIX_EN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_PREFIX_EN.en\")\r", + " const NEW_USER_PREFIX_CN = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_PREFIX_CN.en\")\r", + " const LANGUAGE_SELECTION = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.LANGUAGE_SELECTION.en\")\r", + " const BUTTON_ENGLISH = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ENGLISH.en\")\r", + " const BUTTON_CHINESE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_CHINESE.en\")\r", + " const BODY_TEXT = LANGUAGE_SELECTION.replace(\"{{new_user_en}}\",NEW_USER_PREFIX_EN).replace(\"{{new_user_cn}}\",NEW_USER_PREFIX_CN)\r", " const USER_2_NUMBER = pm.variables.get(\"USER_2_NUMBER\")\r", " const expected = {\r", - " \"hostname\": \"resultserver\",\r", - " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", - " \"body\": {\r", - " \"messaging_product\": \"whatsapp\",\r", - " \"recipient_type\": \"individual\",\r", - " \"to\": USER_2_NUMBER,\r", - " \"type\": \"interactive\",\r", - " \"interactive\": {\r", - " \"type\": \"list\",\r", - " \"body\": {\r", - " \"text\": MENU_TEXT\r", - " },\r", - " \"action\": {\r", - " \"button\": \"View Menu\",\r", - " \"sections\": [\r", - " {\r", - " \"rows\": [\r", - " {\r", - " \"id\": \"menu_check\",\r", - " \"title\": \"Check/Report\",\r", - " \"description\": \"Send in messages, images, or screenshots for checking!\"\r", - " },\r", - " {\r", - " \"id\": \"menu_referral\",\r", - " \"title\": \"Get Referral Link\",\r", - " \"description\": \"Get referral link to forward to others\"\r", - " },\r", - " {\r", - " \"id\": \"menu_help\",\r", - " \"title\": \"Get Help\",\r", - " \"description\": \"Find out how to use CheckMate to check or report dubious messages\"\r", - " },\r", - " {\r", - " \"id\": \"menu_about\",\r", - " \"title\": \"About CheckMate\",\r", - " \"description\": \"Learn more about CheckMate and the team behind it\"\r", - " },\r", - " {\r", - " \"id\": \"menu_feedback\",\r", - " \"title\": \"Send Feedback\",\r", - " \"description\": \"Send us feedback on anything to do with CheckMate\"\r", - " },\r", - " {\r", - " \"id\": \"menu_contact\",\r", - " \"title\": \"Get Contact\",\r", - " \"description\": \"Get CheckMate's contact to add to your contact list\"\r", + " \"hostname\": \"resultserver\",\r", + " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", + " \"body\": {\r", + " \"messaging_product\": \"whatsapp\",\r", + " \"recipient_type\": \"individual\",\r", + " \"to\": USER_2_NUMBER,\r", + " \"type\": \"interactive\",\r", + " \"interactive\": {\r", + " \"type\": \"button\",\r", + " \"body\": {\r", + " \"text\": BODY_TEXT\r", + " },\r", + " \"action\": {\r", + " \"buttons\": [\r", + " {\r", + " \"type\": \"reply\",\r", + " \"reply\": {\r", + " \"id\": \"languageSelection_en\",\r", + " \"title\": BUTTON_ENGLISH\r", + " }\r", + " },\r", + " {\r", + " \"type\": \"reply\",\r", + " \"reply\": {\r", + " \"id\": \"languageSelection_cn\",\r", + " \"title\": BUTTON_CHINESE\r", " }\r", - " ]\r", - " }\r", - " ]\r", + " }\r", + " ]\r", + " }\r", + " },\r", + " },\r", + " \"method\": \"POST\"\r", + " }\r", + "\r", + " var jsonData = pm.response.json();\r", + "\r", + " pm.expect(jsonData).to.eql(expected);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "setTimeout(() => {}, 3000);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{RESULT_SERVER_URL}}/testresultdata", + "host": [ + "{{RESULT_SERVER_URL}}" + ], + "path": [ + "testresultdata" + ] + } + }, + "response": [] + }, + { + "name": "Press English Button", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"6580431949\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n {\r\n \"profile\": {\r\n \"name\": \"{{USER_2_NAME}}\"\r\n },\r\n \"wa_id\": \"{{USER_2_NUMBER}}\"\r\n }\r\n ],\r\n \"messages\": [\r\n {\r\n \"context\": {\r\n \"from\": \"6580431949\",\r\n \"id\": \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==\"\r\n },\r\n \"from\": \"{{USER_2_NUMBER}}\",\r\n \"id\": \"wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==\",\r\n \"timestamp\": {{$timestamp}},\r\n \"type\": \"interactive\",\r\n \"interactive\": {\r\n \"type\": \"button_reply\",\r\n \"button_reply\": {\r\n \"id\": \"languageSelection_en\",\r\n \"title\": \"{{__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ENGLISH.en}}\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", + "host": [ + "{{FUNCTIONS_URL}}" + ], + "path": [ + "{{PROJECT_ID}}", + "asia-southeast1", + "webhookHandlerV2", + "{{WEBHOOK_PATH}}" + ] + } + }, + "response": [] + }, + { + "name": "Get last message (NEW_USER_MENU)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Your test name\", function () {\r", + " const MENU = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU.en\");\r", + " const PREFIX = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_PREFIX.en\");\r", + " const MENU_TEXT = MENU.replace(\"{{prefix}}\",PREFIX);\r", + " const MENU_BUTTON = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_BUTTON.en\");\r", + " const MENU_TITLE_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CHECK.en\");\r", + " const MENU_DESCRIPTION_CHECK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CHECK.en\");\r", + " const MENU_TITLE_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_REFERRAL.en\");\r", + " const MENU_DESCRIPTION_REFERRAL = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_REFERRAL.en\");\r", + " const MENU_TITLE_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_ABOUT.en\");\r", + " const MENU_DESCRIPTION_ABOUT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_ABOUT.en\");\r", + " const MENU_TITLE_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_HELP.en\");\r", + " const MENU_DESCRIPTION_HELP = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_HELP.en\");\r", + " const MENU_TITLE_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_FEEDBACK.en\");\r", + " const MENU_DESCRIPTION_FEEDBACK = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_FEEDBACK.en\");\r", + " const MENU_TITLE_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_LANGUAGE.en\")\r", + " const MENU_DESCRIPTION_LANGUAGE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_LANGUAGE.en\")\r", + " const MENU_TITLE_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CONTACT.en\");\r", + " const MENU_DESCRIPTION_CONTACT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CONTACT.en\");\r", + " const MENU_TITLE_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_DISPUTE.en\")\r", + " const MENU_DESCRIPTION_DISPUTE = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_DISPUTE.en\")\r", + " \r", + " const USER_2_NAME = pm.variables.get(\"USER_2_NAME\")\r", + " const USER_2_NUMBER = pm.variables.get(\"USER_2_NUMBER\")\r", + " const expected = {\r", + " \"hostname\": \"resultserver\",\r", + " \"path\": \"/v15.0/WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID/messages\",\r", + " \"body\": {\r", + " \"messaging_product\": \"whatsapp\",\r", + " \"recipient_type\": \"individual\",\r", + " \"to\": USER_2_NUMBER,\r", + " \"type\": \"interactive\",\r", + " \"interactive\": {\r", + " \"type\": \"list\",\r", + " \"body\": {\r", + " \"text\": MENU_TEXT\r", + " },\r", + " \"action\": {\r", + " \"button\": MENU_BUTTON,\r", + " \"sections\": [\r", + " {\r", + " \"rows\": [\r", + " {\r", + " \"id\": \"menu_check\",\r", + " \"title\": MENU_TITLE_CHECK,\r", + " \"description\": MENU_DESCRIPTION_CHECK\r", + " },\r", + " {\r", + " \"id\": \"menu_referral\",\r", + " \"title\": MENU_TITLE_REFERRAL,\r", + " \"description\": MENU_DESCRIPTION_REFERRAL\r", + " },\r", + " {\r", + " \"id\": \"menu_help\",\r", + " \"title\": MENU_TITLE_HELP,\r", + " \"description\": MENU_DESCRIPTION_HELP\r", + " },\r", + " {\r", + " \"id\": \"menu_about\",\r", + " \"title\": MENU_TITLE_ABOUT,\r", + " \"description\": MENU_DESCRIPTION_ABOUT\r", + " },\r", + " {\r", + " \"id\": \"menu_feedback\",\r", + " \"title\": MENU_TITLE_FEEDBACK,\r", + " \"description\": MENU_DESCRIPTION_FEEDBACK\r", + " },\r", + " {\r", + " \"id\": \"menu_language\",\r", + " \"title\": MENU_TITLE_LANGUAGE,\r", + " \"description\": MENU_DESCRIPTION_LANGUAGE\r", + " },\r", + " {\r", + " \"id\": \"menu_contact\",\r", + " \"title\": MENU_TITLE_CONTACT,\r", + " \"description\": MENU_DESCRIPTION_CONTACT\r", + " }\r", + " ]\r", + " }\r", + " ]\r", + " }\r", " }\r", - " }\r", - " },\r", - " \"method\": \"POST\"\r", - "}\r", + " },\r", + " \"method\": \"POST\"\r", + " }\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData).to.eql(expected);\r", "});" @@ -12343,14 +13079,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/users/{{USER_1_NUMBER}}", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/users/{{USER_1_NUMBER}}", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -12401,7 +13137,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"15550933685\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n { \"profile\": { \"name\": \"{{USER_2_NAME}}\" }, \"wa_id\": \"{{USER_2_NUMBER}}\" }\r\n ],\r\n \"messages\": [\r\n {\r\n \"from\": \"{{USER_2_NUMBER}}\",\r\n \"id\": \"{{whatsapp_id_40}}\",\r\n \"timestamp\": {{$timestamp}},\r\n \"text\": { \"body\": \"{{__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_PREPOPULATED_PREFIX}} {{referralId_USER1}}\" },\r\n \"type\": \"text\"\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}\r\n", + "raw": "{\r\n \"object\": \"whatsapp_business_account\",\r\n \"entry\": [\r\n {\r\n \"id\": \"WHATSAPP_TEST_USER_WABA_ID\",\r\n \"changes\": [\r\n {\r\n \"value\": {\r\n \"messaging_product\": \"whatsapp\",\r\n \"metadata\": {\r\n \"display_phone_number\": \"15550933685\",\r\n \"phone_number_id\": \"WHATSAPP_TEST_USER_BOT_PHONE_NUMBER_ID\"\r\n },\r\n \"contacts\": [\r\n { \"profile\": { \"name\": \"{{USER_2_NAME}}\" }, \"wa_id\": \"{{USER_2_NUMBER}}\" }\r\n ],\r\n \"messages\": [\r\n {\r\n \"from\": \"{{USER_2_NUMBER}}\",\r\n \"id\": \"{{whatsapp_id_40}}\",\r\n \"timestamp\": {{$timestamp}},\r\n \"text\": { \"body\": \"{{__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_PREPOPULATED_PREFIX.en}} {{referralId_USER1}}\" },\r\n \"type\": \"text\"\r\n }\r\n ]\r\n },\r\n \"field\": \"messages\"\r\n }\r\n ]\r\n }\r\n ]\r\n}\r\n", "options": { "raw": { "language": "json" @@ -12409,15 +13145,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -12431,7 +13167,7 @@ "script": { "exec": [ "pm.test(\"REFERRAL_INVALID response received\", function () {\r", - " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_INVALID\");\r", + " const BODY_TEXT = pm.variables.get(\"__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_INVALID.en\");\r", " const USER_2_NUMBER = pm.variables.get(\"USER_2_NUMBER\")\r", " const wamid = pm.variables.get(\"whatsapp_id_40\")\r", " const expected = {\r", @@ -12513,14 +13249,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -12556,14 +13292,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages/{{infoMessageId}}/instances", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages/{{infoMessageId}}/instances", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -12612,15 +13348,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -12663,14 +13399,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -12706,14 +13442,14 @@ } ], "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents/messages", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents/messages", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents", @@ -12773,15 +13509,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -12824,15 +13560,15 @@ } }, "url": { - "raw": "{{FUNCTIONS_URL}}/checkmate-373101/asia-southeast1/webhookHandlerV2/whatsapp", + "raw": "{{FUNCTIONS_URL}}/{{PROJECT_ID}}/asia-southeast1/webhookHandlerV2/{{WEBHOOK_PATH}}", "host": [ "{{FUNCTIONS_URL}}" ], "path": [ - "checkmate-373101", + "{{PROJECT_ID}}", "asia-southeast1", "webhookHandlerV2", - "whatsapp" + "{{WEBHOOK_PATH}}" ] } }, @@ -12883,14 +13619,14 @@ } }, "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents:runQuery", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents:runQuery", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents:runQuery" @@ -12943,14 +13679,14 @@ } }, "url": { - "raw": "{{FIRESTORE_URL}}/v1/projects/checkmate-373101/databases/(default)/documents:runQuery", + "raw": "{{FIRESTORE_URL}}/v1/projects/{{PROJECT_ID}}/databases/(default)/documents:runQuery", "host": [ "{{FIRESTORE_URL}}" ], "path": [ "v1", "projects", - "checkmate-373101", + "{{PROJECT_ID}}", "databases", "(default)", "documents:runQuery" diff --git a/integration-tests/env.json b/integration-tests/env.json index 715dbdf6..091aa869 100644 --- a/integration-tests/env.json +++ b/integration-tests/env.json @@ -13,6 +13,16 @@ "value": "wamid.HBgKNjU5Njg4MDMyMBUCABIYIEY4MDAwNTlEODQyMDZDMkNDOEU1NEVEQjc1MTNCMjlFAA==", "enabled": true }, + { + "key": "PROJECT_ID", + "value": "checkmate-uat", + "enabled": true + }, + { + "key": "WEBHOOK_PATH", + "value": "whatsapp", + "enabled": true + }, { "key": "FIRESTORE_URL", "value": "http://localhost:18080", @@ -74,309 +84,964 @@ "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU", - "enabled": true, - "value": "{{prefix}}\n\nIf you know what to do, please go ahead! Else, select \"View Menu\" below to see what CheckMate can do! 👈\n\nDo note that CheckMate *is designed to check dubious messages you send in. It cannot converse freely with you*.\n\nAnytime you need a refresher on what CheckMate can do, type \"menu\" to get here again! 😊" + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.ONBOARDING_1", + "value": "Welcome to our community of CheckMates! 👋🏻 We're grateful to have you on board to combat misinformation and scams. 🙇‍♀️🙇🏻 We'd love to get to know you better - could you *reply to this message* and share your name with us? (Reply to this message by swiping right)!", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_MENU_PREFIX", - "enabled": true, - "value": "Hello and welcome to CheckMate! We noticed it's your first time here. We're glad you've joined us to battle scams and misinformation😊." + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.ONBOARDING_2", + "value": "Thank you and welcome, {{name}}! We're thrilled to have you on board as we work together to combat misinformation and scams.😊 By using the CheckMate bot, you are accepting our privacy policy which can be found here: https://bit.ly/checkmate-privacy", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.IRRELEVANT_MENU_PREFIX", - "enabled": true, - "value": "Thanks for waiting!🙏🏻 Our CheckMates didn't find anything to assess in this message.😕" + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.ONBOARDING_3", + "value": "To ensure you're equipped with the necessary skills to identify misinformation and scams, let's start with a quick quiz. 📝 Simply follow the link (https://bit.ly/checkmates-quiz) to take the quiz. Once you've completed it, come back to this chat and click on \"I've done the quiz!\" to notify me. Let's get started! 🤖", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.IRRELEVANT_AUTO_MENU_PREFIX", - "enabled": true, - "value": "Hmm...There doesn't seem to be anything to assess in this message.😕" + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.ONBOARDING_4", + "value": "Awesome! Now that you know how to identify misinformation and scams, you are ready to help us combat them! 🙌🏻 If you haven't already, do join this WhatsApp group (https://bit.ly/checkmates-groupchat) that brings together all the other CheckMates and the core product team for updates and feedback. If you're looking for resources, you can visit our wiki page (https://bit.ly/checkmates-wiki). Thanks again for joining our community of CheckMates. Enjoy! 👋🏻🤖", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_PREFIX", - "enabled": true, - "value": "Hi! Thanks for using CheckMate. 🙏🏻" + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.FACTCHECK_PROMPT", + "value": "Please assess the veracity of the claim(s) in this message on a scale from 0 to 5, where 0 means the claim(s) are entirely false, and 5 means the claim(s) are entirely true.", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.PROCEED_TO_SEND", - "enabled": true, - "value": "Nice! Just send/forward us the message. We'll help you check and/or report it! ✅✅\n\nIf you like, you can also send in screenshots 📷 or other images 🖼️! This can help to capture the sender's number, or a full conversation, which could help our CheckMates' assessment.\n\nOne last thing: by continuing to use CheckMate, you're agreeing to our privacy policy, which can be found at https://checkmate.sg/privacy-policy. In short, we only collect the messages sent to us and your number to facilitate a response!" + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.OUTSTANDING_REMINDER", + "value": "You have *{{num_outstanding}} remaining messages* to assess. Would you like to be sent the next one in line?", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.HOW_TO", - "enabled": true, - "value": "Check out https://youtube.com/shorts/gFeO_qFOchs?feature=share to see how CheckMate works!\n\nDone? You're now ready to use CheckMate! Let's do our part in the fight against scams and misinformation! 💪" + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.HOLD_FOR_L2_CATEGORISATION", + "value": "Got it👍! Please hold for another selection.", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.LEARN_MORE", - "enabled": true, - "value": "To learn more about CheckMate, you can visit our website at https://checkmate.sg" + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.L2_OTHERS_ASSESSEMENT_PROMPT", + "value": "Which of these subcategories best describes this message?", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.FEEDBACK", - "enabled": true, - "value": "You can submit feedback at https://bit.ly/checkmate-feedback. Rest assured, we'll read it ASAP!" + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.L1_ASSESSMENT_PROMPT", + "value": "Which of these categories best describes this message?", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.DISPUTE", - "enabled": true, - "value": "Thanks for letting us know! Our CheckMates will review the assessment of this message." + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.RESPONSE_RECORDED", + "value": "Got it! Your response has been recorded. Thank you for playing your part in the fight against scams and misinformation, one message at a time! 💪", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.CONTACT", - "enabled": true, - "value": "Here's our contact! Do add us to your contact list so you can find us in future. 😊" + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.NO_OUTSTANDING", + "value": "Great, you have no further messages to assess. Keep it up!💪", + "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.MESSAGE_NOT_YET_ASSESSED", - "value": "Hello! 👋 Thanks for sending this in! Our *CheckMates🕵🏻 will review this* and *provide the results soon*.", + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.VOTE_NO", + "value": "No problem! If you wish to come back and assess the message, you may do so by clicking the 'yes' button. See you soon!😊", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.SCAM", - "value": "{{thanks}}{{matched}}{{methodology}}*a scam*!🚫\n\nWe recommend you do not engage further⛔️⛔️\n\nCheckMate will report suspicious messages to ScamShield (https://scamshield.org.sg) on your behalf.\n\nTo avoid reporting this message, select \"Don't report this\" below.", + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.HOLD_FOR_NEXT_POLL", + "value": "Got it👍! Please hold for another poll to vote on how true the message is.", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.ILLICIT", - "value": "{{thanks}}{{matched}}{{methodology}}*suspicious*!🚨\n\nWe recommend you do not engage further⛔️⛔️\n\nCheckMate will report suspicious messages to ScamShield (https://scamshield.org.sg) on your behalf.\n\nTo avoid reporting this message, select \"Don't report this\" below.", + "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.NOT_A_REPLY", + "value": "Sorry, did you forget to reply to a message? You need to swipe right on the message to reply to it.", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.SPAM", - "value": "{{thanks}}{{matched}}{{methodology}}spam!🚧 \n\nIt's likely harmless, but you should always make sure 🧐\n\nThank you for keeping Singapore safe!", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.UNTRUE.en", + "value": "{{thanks}}{{matched}}{{methodology}}*untrue*.❌{{image_caveat}}\n\nPlease do not spread it further⛔️⛔️\n\nThank you for keeping Singapore informed!", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.LEGITIMATE", - "value": "{{thanks}}{{matched}}{{methodology}}*from a legitimate source*.✅\n\nThank you for keeping Singapore safe!", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.UNTRUE.cn", + "value": "{thanks}}{{matched}}{{methodology}}不属实。❌{{image_caveat}}\n\n请不要转发⛔️⛔️\n\n感谢您对新加坡网络安全的支持和贡献!\n", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.UNSURE", - "value": "{{thanks}}\n\nUnfortunately, our CheckMates are *unsure about this message*🤷🏻‍♂️🤷🏻‍♀️. Sorry, we're human too! 😞\n\nIf you haven't done so, you could send in the message with more context, e.g. sending in a screenshot containing the sender's number.\n\nThank you for keeping Singapore safe!", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MISLEADING.en", + "value": "{{thanks}}{{matched}}{{methodology}}*presented in a misleading or unbalanced way*, even though some elements within could be true!⚠️{{image_caveat}}\n\nPlease take it with a pinch of salt and think twice before spreading it further🚧🚧.\n\nThank you for keeping Singapore informed!", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.UNTRUE", - "value": "{{thanks}}{{matched}}{{methodology}}*untrue*.❌\n \nPlease do not spread it further⛔️⛔️\n\nThank you for keeping Singapore informed!", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MISLEADING.cn", + "value": "{{thanks}}{{matched}}{{methodology}}虽然包含一些真实的信息,但它存在误导性或缺乏公正性。⚠️{{image_caveat}}\n\n在分享之前,请三思🚧🚧。\n\n感谢您对新加坡网络安全的支持和贡献!", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.MISLEADING", - "value": "{{thanks}}{{matched}}{{methodology}}*presented in a misleading or unbalanced way*, even though some elements within could be true!⚠️\n\nPlease take it with a pinch of salt and think twice before spreading it further🚧🚧.\n\nThank you for keeping Singapore informed!", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.ACCURATE.en", + "value": "{{thanks}}{{matched}}{{methodology}}*accurate*.✅{{image_caveat}}\n\nThank you for keeping Singapore informed!", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.ACCURATE", - "value": "{{thanks}}{{matched}}{{methodology}}*accurate*.✅\n\nThank you for keeping Singapore informed!", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.ACCURATE.cn", + "value": "{{thanks}}{{matched}}{{methodology}}是准确的。✅{{image_caveat}}\n\n感谢您对新加坡网络安全的支持和贡献!", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE", - "value": "Thanks for sending this in! ", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.ERROR.en", + "value": "Oops, we encountered an error assessing this message.\n\nYou can try sending the message in again, or report the error via our form at https://bit.ly/checkmate-feedback. Sorry about that! 😔", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED", - "value": "Thanks for waiting! ", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.ERROR.cn", + "value": "抱歉,查友在评估您提供的短信时发生问题。\n\n欢迎您稍后重试,或者通过这份表格向我们反馈:https://bit.ly/checkmate-feedback。对此造成的不便,我们非常抱歉!😔", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN", - "value": "Our CheckMates have reviewed this message and think it's ", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MESSAGE_NOT_YET_ASSESSED.en", + "value": "Hello! 👋 Thanks for sending this in! Our *CheckMates🕵🏻 will review this* and *provide the results soon*.", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO", - "value": "Based on pattern matching, our auto-classifier is confident that this message is ", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MESSAGE_NOT_YET_ASSESSED.cn", + "value": "你好!👋 感谢您使用查友!我们的查哥查妹🕵🏻会尽快评估这条短信并回复。", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.MATCHED", - "value": "In fact, other users have sent this message in {{numberInstances}} times. ", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SCAM.en", + "value": "{{thanks}}{{matched}}{{methodology}}*a scam*!🚫{{image_caveat}}\n\nWe recommend you do not engage further⛔️⛔️\n\nCheckMate will report suspicious messages to ScamShield (https://scamshield.org.sg) on your behalf.\n\nTo avoid reporting this message, select \"Don't report this\" below.", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.ONBOARDING_1", - "value": "Welcome to our community of CheckMates! 👋🏻 We're grateful to have you on board to combat misinformation and scams. 🙇‍♀️🙇🏻 We'd love to get to know you better - could you *reply to this message* and share your name with us? (Reply to this message by swiping right)!", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SCAM.cn", + "value": "{{thanks}}{{matched}}{{methodology}}是诈骗信息! 🚫{{image_caveat}}\n\n建议您停止交流⛔️⛔️\n\n查友会代表您向ScamShield (https://scamshield.org.sg) 举报这条可疑的短信。\n\n如果您不想举报此短信,请选择\"不举报\"。", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.ONBOARDING_2", - "value": "Thank you and welcome, {{name}}! We're thrilled to have you on board as we work together to combat misinformation and scams.😊 By using the CheckMate bot, you are accepting our privacy policy which can be found here: https://bit.ly/checkmate-privacy", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.ILLICIT.en", + "value": "{{thanks}}{{matched}}{{methodology}}*suspicious*!🚨{{image_caveat}}\n\nWe recommend you do not engage further⛔️⛔️\n\nCheckMate will report suspicious messages to ScamShield (https://scamshield.org.sg) on your behalf.\n\nTo avoid reporting this message, select \"Don't report this\" below.", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.ONBOARDING_3", - "value": "To ensure you're equipped with the necessary skills to identify misinformation and scams, let's start with a quick quiz. 📝 Simply follow the link (https://bit.ly/checkmates-quiz) to take the quiz. Once you've completed it, come back to this chat and click on \"I've done the quiz!\" to notify me. Let's get started! 🤖", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.ILLICIT.cn", + "value": "{{thanks}}{{matched}}{{methodology}}很可疑!🚨{{image_caveat}}\n\n建议您停止交流⛔️⛔️\n\n查友会代表您向ScamShield (https://scamshield.org.sg) 举报这条可疑的短信。\n\n如果您不想举报此短信,请选择\"不举报\"。", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.ONBOARDING_4", - "value": "Awesome! Now that you know how to identify misinformation and scams, you are ready to help us combat them! 🙌🏻 If you haven't already, do join this WhatsApp group (https://bit.ly/checkmates-groupchat) that brings together all the other CheckMates and the core product team for updates and feedback. If you're looking for resources, you can visit our wiki page (https://bit.ly/checkmates-wiki). Thanks again for joining our community of CheckMates. Enjoy! 👋🏻🤖", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SPAM.en", + "value": "{{thanks}}{{matched}}{{methodology}}spam!🚧{{image_caveat}}\n\nIt's likely harmless, but you should always make sure 🧐\n\nThank you for keeping Singapore safe!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.FACTCHECK_PROMPT", - "value": "Please assess the veracity of the claim(s) in this message on a scale from 0 to 5, where 0 means the claim(s) are entirely false, and 5 means the claim(s) are entirely true.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SPAM.cn", + "value": "{{thanks}}{{matched}}{{methodology}}是垃圾信息!🚧{{image_caveat}}\n\n虽然它看似无害,但仍然请您保持警惕 🧐\n\n感谢您对新加坡网络安全的支持和贡献!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.OUTSTANDING_REMINDER", - "value": "You have *{{num_outstanding}} remaining messages* to assess. Would you like to be sent the next one in line?", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.LEGITIMATE.en", + "value": "{{thanks}}{{matched}}{{methodology}}*from a legitimate source*.✅{{image_caveat}}\n\nThank you for keeping Singapore safe!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.HOLD_FOR_L2_CATEGORISATION", - "value": "Got it👍! Please hold for another selection.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.LEGITIMATE.cn", + "value": "{{thanks}}{{matched}}{{methodology}}的来源是可靠的。✅{{image_caveat}}\n\n感谢您对新加坡网络安全的支持和贡献!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.L2_OTHERS_ASSESSEMENT_PROMPT", - "value": "Which of these subcategories best describes this message?", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.UNSURE.en", + "value": "{{thanks}}\n\nUnfortunately, our CheckMates are *unsure about this message*🤷🏻‍♂️🤷🏻‍♀️. Sorry, we're human too!😞\n\nIf you haven't done so, you could send in the message with more context, e.g. sending in a screenshot containing the sender's number.\n\nThank you for keeping Singapore safe!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.L1_ASSESSMENT_PROMPT", - "value": "Which of these categories best describes this message?", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.UNSURE.cn", + "value": "{{thanks}}\n\n抱歉,我们的查哥查妹对这条短信无法得出结论🤷🏻‍♂️🤷🏻‍♀️。对不起,我们尽力了!😞\n\n如果您能提供更多信息,例如发信人电话号码或截图,将有助于我们更好地评估。\n\n感谢您对新加坡网络安全的支持和贡献!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.RESPONSE_RECORDED", - "value": "Got it! Your response has been recorded. Thank you for playing your part in the fight against scams and misinformation, one message at a time! 💪", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE.en", + "value": "Thanks for sending this in!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.NO_OUTSTANDING", - "value": "Great, you have no further messages to assess. Keep it up!💪", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.THANKS_IMMEDIATE.cn", + "value": "感谢您提交这条短信!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.VOTE_NO", - "value": "No problem! If you wish to come back and assess the message, you may do so by clicking the 'yes' button. See you soon!😊", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED.en", + "value": "Thanks for waiting!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.HOLD_FOR_NEXT_POLL", - "value": "Got it👍! Please hold for another poll to vote on how true the message is.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.THANKS_DELAYED.cn", + "value": "感谢您的耐心等待!", "enabled": true }, { - "key": "__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.NOT_A_REPLY", - "value": "Sorry, did you forget to reply to a message? You need to swipe right on the message to reply to it.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN.en", + "value": "Our CheckMates have reviewed this message and think it's", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_HUMAN.cn", + "value": "经过查哥查妹的评估,我们认为这条短信", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO.en", + "value": "Based on pattern matching, our auto-classifier is confident that this message is ", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.METHODOLOGY_AUTO.cn", + "value": "根据我们的AI技术,我们认为这条短信", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MATCHED.en", + "value": "In fact, other users have sent this message in {{numberInstances}} times. ", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.ERROR", - "value": "Oops, we encountered an error assessing this message.\n \nYou can try sending the message in again, or report the error via our form at https://bit.ly/checkmate-feedback. Sorry about that! 😔", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MATCHED.cn", + "value": "其实查友已收到{{numberInstances}}条同样的短信。", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.UNSUPPORTED_TYPE", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.UNSUPPORTED_TYPE.en", "value": "Sorry, CheckMate currently doesn't support this type of message.", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.SCAMSHIELD_EXPLAINER", - "value": "ScamShield is an anti-scam product developed by the National Crime Prevention Council and Open Government Products. You can learn more at https://scamshield.org.sg.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.UNSUPPORTED_TYPE.cn", + "value": "对不起,查友目前不支持这类短信。", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.STATS_TEMPLATE", - "value": "{{top}}% of our CheckMates identified this as *{{category1}}**{{info_placeholder}}*. *{{second}}*% felt this was *{{category2}}*.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE.en", + "value": "At this time, {{%voted}}% of our CheckMates have assessed and voted on this message. The majority think that this is {{prelim_assessment}}{{info_placeholder}}. \n\nNOTE: This is a *preliminary result*. We aim to provide you with a more credible final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.{{get_feedback}}", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE", - "value": "At this time, {{%voted}}% of our CheckMates have assessed and voted on this message. The majority think is that this {{prelim_assessment}}{{info_placeholder}}. \n\nNOTE: This is a *preliminary result*. We aim to provide you with a more credible final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.{{get_feedback}}", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE.cn", + "value": "目前,{{%voted}}%的查哥查妹已经对这条短信进行投票评估。大多数人认为这条短信{{prelim_assessment}}{{info_placeholder}}。\n\n注意:这只是初步结果。我们将在更多的查哥查妹投票后,或在您提交短信的24小时内,为您提供最终的结果。{{get_feedback}}", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE_UNSURE", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE_UNSURE.en", "value": "At this time, {{%voted}}% of our CheckMates have assessed and voted on this message. Unfortunately, our CheckMates either have not reached any clear consensus, or are still unsure how to assess the message at this time.\n\nIf you haven't done so, you could send in the message with more context, e.g. sending in a screenshot containing the sender's number.", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_PROMPT", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_TEMPLATE_UNSURE.cn", + "value": "目前,{%voted}}%的查哥查妹已经对这条短信进行投票评估。不幸的是,他们无法达成一致,或缺乏足够的信息进行评估。\n\n如果您能提供更多信息,例如发信人电话号码或截图,将有助于我们更好地评估。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK.en", + "value": "\n\nThanks for trusting CheckMate! 👋🏼 If this interim update was useful to you, we'd appreciate it if you'd let us know by tapping on “Yes, it's useful” below. Otherwise, tap on “No, it's not” to continue waiting for the final result. Either way, you can continue to request more updates as more votes come in.", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK.cn", + "value": "感谢您对查友的信任!👋🏼 如果这个初步结果对您有帮助,请点击“有帮助”。否则,请点击“没帮助”以继续等待最终结果。您可以在最终结果发布之前随时要求最新的初步结果。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_PROMPT.en", "value": "Thanks for waiting! We are currently still pending the assessment from some of our network of trusted CheckMate volunteers and will only be able to provide a credible final result once enough votes have come in. \n\nYou may press the button below *to get an interim update of the preliminary result*. However, do note that there may be discrepancies between the preliminary and the final result, and *the preliminary result should be interpreted with caution*. We appreciate your patience and hope to deliver the final result to you soon! 💪🏼", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.ALREADY_REPLIED", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_PROMPT.cn", + "value": "感谢您的耐心等待!查哥查妹正在对您提交的短信进行投票评估。我们将在足够多的查哥查妹票后,为您提供最终结果。\n\n在最终结果发布之前,您可以点击获取初步结果。请注意,初步结果和最终结果之间可能存在差异,应谨慎解读初步结果。我们感谢您的耐心,并希望尽快为您提供最终结果!💪🏼", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_USEFUL.en", + "value": "Thanks for your valuable feedback! We will provide you with the final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.\n\nIn the meantime, if you'd like another update after more votes come in, just tap the button below to request one.", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_USEFUL.cn", + "value": "感谢您的反馈!我们将在更多的查哥查妹投票后,或在您提交短信的24小时内,为您提供最终的结果。\n\n请点击下方按钮再次获取最新的初步结果。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_NOT_USEFUL.en", + "value": "Sorry to hear that, but thanks anyway for your valuable feedback! We will provide you with the final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.\n\nIf you'd like still another update after more votes come in, just tap the button below to request one.", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_NOT_USEFUL.cn", + "value": "感谢您的反馈!我们将在更多的查哥查妹投票后,或在您提交短信的24小时内,尽快为您提供最终的结果。\n\n请点击下方按钮再次获取最新的初步结果。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.ALREADY_REPLIED.en", "value": "CheckMate has already provided a final response to this message.", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.SCAMSHIELD_ON_DECLINE", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.ALREADY_REPLIED.cn", + "value": "查友已经对这条短信做出最终回应。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SCAMSHIELD_ON_DECLINE.en", "value": "No worries! We will not send your message to ScamShield. Thank you for sharing this message with us, and for keeping Singapore safe!", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_FEEDBACK", - "value": "\n\nThanks for trusting CheckMate! 👋🏼 If this interim update was useful to you, we'd appreciate it if you'd let us know by tapping on “Yes, it's useful” below. Otherwise, tap on “No, it's not” to continue waiting for the final result. Either way, you can continue to request more updates as more votes come in.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SCAMSHIELD_ON_DECLINE.cn", + "value": "我们不会将您的短信发送给ScamShield。感谢您与我们分享这条短信,也感谢您对新加坡网络安全的支持和贡献。", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_USEFUL", - "value": "Thanks for your valuable feedback! We will provide you with the final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.\n\nIn the meantime, if you'd like another update after more votes come in, just tap the button below to request one.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_BUTTON.en", + "value": "Menu", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.INTERIM_NOT_USEFUL", - "value": "Sorry to hear that, but thanks anyway for your valuable feedback! We will provide you with the final result as soon as more of our CheckMates have voted, or when 24 hours has lapsed since you sent in your message.\n\nIf you'd like still another update after more votes come in, just tap the button below to request one.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_BUTTON.cn", + "value": "菜单", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY", - "value": "Thanks so much for using CheckMate🙏. We're improving the product from time to time, and your feedback is valuable to us.\n\nOn a scale from 1-10, how likely are you to recommend us to a friend, colleague or family member?", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.IRRELEVANT_MENU_PREFIX.en", + "value": "Thanks for waiting!🙏🏻 Our CheckMates didn't find anything to assess in this message.😕", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY_THANKS", - "value": "Thanks for your feedback!", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.IRRELEVANT_MENU_PREFIX.cn", + "value": "感谢您的耐心等待!🙏🏻 我们的查哥查妹没有在这条短信中找到可以评估的内容。😕", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.IRRELEVANT_AUTO_MENU_PREFIX.en", + "value": "Hmm...There doesn't seem to be anything to assess in this message.😕", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.IRRELEVANT_AUTO_MENU_PREFIX.cn", + "value": "嗯...这条短信似乎没有可以评估的内容。😕", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_PREFIX.en", + "value": "Hi! Thanks for using CheckMate. 🙏🏻", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_PREFIX.cn", + "value": "您好!感谢您使用查友。🙏🏻", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PROCEED_TO_SEND.en", + "value": "Nice! Just send/forward us the message. We'll help you check and/or report it! ✅✅\n\nIf you like, you can also send in screenshots 📷 or other images 🖼️! This can help to capture the sender's number, or a full conversation, which could help our CheckMates' assessment.\n\nOne last thing: by continuing to use CheckMate, you're agreeing to our privacy policy, which can be found at https://checkmate.sg/privacy-policy. In short, we only collect the messages sent to us and your number to facilitate a response!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PROCEED_TO_SEND.cn", + "value": "好的!您只需将短信发送给查友,我们会对其进行评估!✅✅\n\n除了文字信息,您也可以发送截图📷或其他图片🖼️!这有助于查哥查妹通过发信人号码或完整的对话内容做出判断。\n\n最后,使用查友即表示您已同意我们的隐私政策。您可在 https://checkmate.sg/privacy-policy 查看我们的隐私政策。基本上,我们只收集您发送的消息以及您的手机号码,以便回复您!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.HOW_TO.en", + "value": "Check out https://youtube.com/shorts/gFeO_qFOchs?feature=share to see how CheckMate works!\n\nDone? You're now ready to use CheckMate! Let's do our part in the fight against scams and misinformation! 💪", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.HOW_TO.cn", + "value": "了解查友是如何运行的:https://youtube.com/shorts/gFeO_qFOchs?feature=share\n\n准备好了吗?您可以开始使用查友了!让我们一起为反击诈骗和虚假信息做出贡献!💪", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.LEARN_MORE.en", + "value": "To learn more about CheckMate, you can visit our website at https://checkmate.sg", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.LEARN_MORE.cn", + "value": "若想了解有关查友的更多信息,您可以访问我们的网站 https://checkmate.sg", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.FEEDBACK.en", + "value": "You can submit feedback at https://bit.ly/checkmate-feedback. Rest assured, we'll read it ASAP!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.FEEDBACK.cn", + "value": "您可以在 https://bit.ly/checkmate-feedback 提供反馈。我们会尽快查看!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.DISPUTE.en", + "value": "Thanks for letting us know! Our CheckMates will review the assessment of this message.", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.DISPUTE.cn", + "value": "感谢您的反馈!我们的查哥查妹将会重新评估这条短信。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.CONTACT.en", + "value": "Here's our contact! Do add us to your contact list so you can find us in future. 😊", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.CONTACT.cn", + "value": "这是我们的联系方式!请将我们添加到您的联系人列表中,以便您以后能找到我们。😊", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL.en", "value": "Have you started checking and reporting suspicious messages using CheckMate yet? Sign up by clicking this link and sending in the pre-loaded message!! {{link}}", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_INVALID", - "value": "Sorry, referrals are only credited upon your first interaction with CheckMate.", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL.cn", + "value": "您是否已经开始使用查友?点击此链接进行注册!{{link}}", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_PREPOPULATED_PREFIX", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_PREPOPULATED_PREFIX.en", "value": "Welcome to CheckMate! Send in this entire message (including the code) to get started, and credit your friend with your referral. Code:", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.GENERIC_PREPOPULATED_PREFIX", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_PREPOPULATED_PREFIX.cn", + "value": "欢迎使用查友!请发送这条短信(包括推荐人代码)以开始使用。代码:", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.GENERIC_PREPOPULATED_PREFIX.en", "value": "Welcome to Checkmate! Send in this entire message (including the code) to get started. Code:", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.GENERIC_ERROR", - "value": "Sorry, an error occured. 😔 We'll be looking into this! Meanwhile, you can try out other functions of the bot. Apologies!", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.GENERIC_PREPOPULATED_PREFIX.cn", + "value": "欢迎使用查友!请发送这条短信(包括代码)以开始使用。代码:", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_INVALID.en", + "value": "Sorry, referrals are only credited upon your first interaction with CheckMate.", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.HOWD_WE_TELL", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.REFERRAL_INVALID.cn", + "value": "对不起,推荐人代码仅在您首次与查友互动时才有效。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.GENERIC_ERROR.en", + "value": "Sorry, an error occurred. 😔 We'll be looking into this! Meanwhile, you can try out other functions of the bot. Apologies!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.GENERIC_ERROR.cn", + "value": "抱歉,查友出现了错误。😔 我们会尽快解决这个问题!您可以尝试使用查友的其他功能。我们再次为此道歉!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY.en", + "value": "Thanks so much for using CheckMate🙏. We're improving the product from time to time, and your feedback is valuable to us.\n\nOn a scale from 1-10, how likely are you to recommend us to a friend, colleague or family member?", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY.cn", + "value": "非常感谢您使用查友🙏。您的反馈对于不断改进查友非常重要。\n\n请问在1-10之间,您愿意向朋友、同事或家人推荐查友吗?", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY_THANKS.en", + "value": "Thanks for your feedback!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.SATISFACTION_SURVEY_THANKS.cn", + "value": "感谢您的反馈!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.HOWD_WE_TELL.en", "value": "*This is an experimental feature powered by generative AI*. Do let us know if it was useful below!\n \n{{rationalisation}}", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.RATIONALISATION_USEFUL", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.HOWD_WE_TELL.cn", + "value": "这是一项由AI技术提供的实验性功能。请在下方告诉我们它是否对您有所帮助!\n\n{{rationalisation}}", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.RATIONALISATION_USEFUL.en", "value": "Thanks for your valuable feedback!", "enabled": true }, { - "key": "__CONSTANTS__.USER_BOT_RESPONSES.RATIONALISATION_NOT_USEFUL", + "key": "__CONSTANTS__.USER_BOT_RESPONSES.RATIONALISATION_USEFUL.cn", + "value": "感谢您的反馈!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.RATIONALISATION_NOT_USEFUL.en", "value": "Sorry to hear that, but thanks anyway for your valuable feedback!", "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.RATIONALISATION_NOT_USEFUL.cn", + "value": "很遗憾此功能对您来说不是很有用。 查友已将您的反馈传递给我们的产品团队,以便进一步增强此功能。感谢您的反馈!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.IMAGE_CAVEAT.en", + "value": "This assessment refers to any claims made within the captions. If there are no claims/captions, it refers to the image itself.", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.IMAGE_CAVEAT.cn", + "value": "我们的评估基于图片标题中的内容。如果您提交的短信里没有文字标题,我们对图片本身的内容进行了评估。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.STATS_TEMPLATE_1.en", + "value": "{{top}}% of our CheckMates felt this was *{{category}}*{{info_placeholder}}.", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.STATS_TEMPLATE_1.cn", + "value": "{{top}}%的查哥查妹认为这条短信{{category}}{{info_placeholder}}。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INFO_PLACEHOLDER.en", + "value": ", with an average score of {{score}} on a scale of 0-5 (5 = completely true)", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.INFO_PLACEHOLDER.cn", + "value": "在0 - 5的评分内,平均投票分数为{{score}}(5 = 完全正确)", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CHECK.en", + "value": "Check/Report", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CHECK.cn", + "value": "查询/举报", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CHECK.en", + "value": "Send in messages, images, or screenshots for checking!", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CHECK.cn", + "value": "提交文字内容、图片或截图进行评估", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_REFERRAL.en", + "value": "Get Referral Link", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_REFERRAL.cn", + "value": "获取推荐链接", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_REFERRAL.en", + "value": "Get referral link to forward to others", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_REFERRAL.cn", + "value": "获取加入查友的推荐链接以转发给好友", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_HELP.en", + "value": "Get Help", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_HELP.cn", + "value": "使用说明", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_HELP.en", + "value": "Find out how to use CheckMate to check or report dubious messages", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_HELP.cn", + "value": "了解如何使用查友来查询或举报可疑短信", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_ABOUT.en", + "value": "About CheckMate", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_ABOUT.cn", + "value": "关于查友", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_ABOUT.en", + "value": "Learn more about CheckMate and the team behind it", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_ABOUT.cn", + "value": "了解查友及幕后团队", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_FEEDBACK.en", + "value": "Send Feedback", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_FEEDBACK.cn", + "value": "反馈", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_FEEDBACK.en", + "value": "Send us feedback on anything to do with CheckMate", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_FEEDBACK.cn", + "value": "给予有关查友的反馈", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CONTACT.en", + "value": "Get Contact", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_CONTACT.cn", + "value": "获取联系方式", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CONTACT.en", + "value": "Get CheckMate's contact to add to your contact list", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_CONTACT.cn", + "value": "获取查友的联系方式并添加查友到您的通讯列表", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_DISPUTE.en", + "value": "Dispute Assessment", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_DISPUTE.cn", + "value": "提出异议", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_DISPUTE.en", + "value": "Dispute CheckMate's assesment of this message", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_DISPUTE.cn", + "value": "对查友的评估提出异议", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_NPS_LIKELY.en", + "value": "Extremely likely 🤩", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_NPS_LIKELY.cn", + "value": "一定会🤩", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_NPS_UNLIKELY.en", + "value": "Not at all likely 😥", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_NPS_UNLIKELY.cn", + "value": "不会😥", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.NPS_MENU_BUTTON.en", + "value": "Respond", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.NPS_MENU_BUTTON.cn", + "value": "回应", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_USEFUL.en", + "value": "Yes, it's useful", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_USEFUL.cn", + "value": "有帮助", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_NOT_USEFUL.en", + "value": "No, it's not", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_NOT_USEFUL.cn", + "value": "没帮助", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ANOTHER_UPDATE.en", + "value": "Get another update", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ANOTHER_UPDATE.cn", + "value": "获取初步结果更新", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_GET_INTERIM.en", + "value": "Get interim update", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_GET_INTERIM.cn", + "value": "获取初步结果", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RESULTS.en", + "value": "See voting results", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RESULTS.cn", + "value": "查看投票结果", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_DECLINE_REPORT.en", + "value": "Don't report this", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_DECLINE_REPORT.cn", + "value": "不举报", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RATIONALISATION.en", + "value": "How'd we tell?", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_RATIONALISATION.cn", + "value": "我们是如何判断的?", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_SCAM.en", + "value": "a scam🚫", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_SCAM.cn", + "value": "是诈骗信息🚫", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_SUSPICIOUS.en", + "value": "illicit🚨", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_SUSPICIOUS.cn", + "value": "包含非法内容🚨", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_UNTRUE.en", + "value": "untrue❌", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_UNTRUE.cn", + "value": "不真实❌", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_MISLEADING.en", + "value": "misleading⚠️", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_MISLEADING.cn", + "value": "具有误导性⚠️", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_ACCURATE.en", + "value": "accurate✅", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_ACCURATE.cn", + "value": "是准确的✅", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_SPAM.en", + "value": "spam🚧", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_SPAM.cn", + "value": "是垃圾信息🚧", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_LEGITIMATE.en", + "value": "legitimate✅", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_LEGITIMATE.cn", + "value": "来自可靠的来源✅", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_IRRELEVANT.en", + "value": "message doesn't contain a meaningful claim to assess.😕", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_IRRELEVANT.cn", + "value": "没有可以评估的内容😕", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_UNSURE.en", + "value": "too difficult to assess", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.PLACEHOLDER_UNSURE.cn", + "value": "很难做评估", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU.en", + "value": "{{prefix}}\n\nIf you know what to do, please go ahead! Else, select \"Menu\" below to see what CheckMate can do! 👈\n\nDo note that CheckMate *is designed to check dubious messages you send in. It cannot converse freely with you*.\n\nAnytime you need a refresher on what CheckMate can do, type \"menu\" to get here again! 😊", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU.cn", + "value": "{{prefix}}\n\n请点击“菜单\"查看查友的功能!👈\n\n请注意,查友仅能评估您发送的短信,它无法与您进行对话。\n\n您只需输入\"菜单\"即可随时返回这里,查看查友的功能!😊", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.STATS_TEMPLATE_2.en", + "value": " {{second}}% felt this was *{{category}}*{{info_placeholder}}.", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.STATS_TEMPLATE_2.cn", + "value": "另外{{second}}%的人认为这条短信{{category}}{{info_placeholder}}。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_PREFIX_EN.en", + "value": "Hello and welcome to CheckMate! We're glad you've joined us to battle scams and misinformation😊.", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_PREFIX_EN.cn", + "value": "Hello and welcome to CheckMate! We're glad you've joined us to battle scams and misinformation😊.", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_PREFIX_CN.en", + "value": "您好,欢迎来到查友!我们很高兴您加入我们,一起对抗诈骗和误导信息😊。\n", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.NEW_USER_PREFIX_CN.cn", + "value": "您好,欢迎使用查友!很高兴您加入我们,一起参与反击诈骗和虚假信息😊。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.LANGUAGE_SELECTION.en", + "value": "{{new_user_en}}\n\nPlease select your preferred language.\n\n{{new_user_cn}}请选择语言。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.LANGUAGE_SELECTION.cn", + "value": "{{new_user_en}}\n\nPlease select your preferred language.\n\n{{new_user_cn}}请选择语言。", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_LANGUAGE.en", + "value": "Language / 语言", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_TITLE_LANGUAGE.cn", + "value": "Language / 语言", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_LANGUAGE.en", + "value": "Select Language / 选择语言", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.MENU_DESCRIPTION_LANGUAGE.cn", + "value": "Select Language / 选择语言", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ENGLISH.en", + "value": "English", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_ENGLISH.cn", + "value": "English", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_CHINESE.en", + "value": "华语", + "enabled": true + }, + { + "key": "__CONSTANTS__.USER_BOT_RESPONSES.BUTTON_CHINESE.cn", + "value": "华语", + "enabled": true } ], "_postman_variable_scope": "environment", diff --git a/integration-tests/update-env.ts b/integration-tests/update-env.ts index a24158cd..383ad2f8 100644 --- a/integration-tests/update-env.ts +++ b/integration-tests/update-env.ts @@ -1,15 +1,18 @@ +//TODO: UPDATE THIS + import _ from "lodash" import fs from "fs" import env from "./env.json" -import * as constants from "../functions/src/definitions/common/constants" +import CHECKER_BOT_REPONSES from "../functions/src/definitions/common/parameters/checkerResponses.json" +import USER_BOT_RESPONSES from "../functions/src/definitions/common/parameters/userResponses.json" -const factCheckerKeys = Object.keys(constants.FACTCHECKER_BOT_RESPONSES).map( - (key) => { - return `__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.${key}` - } -) -const userKeys = Object.keys(constants.USER_BOT_RESPONSES).map((key) => { - return `__CONSTANTS__.USER_BOT_RESPONSES.${key}` +const factCheckerKeys = Object.keys(CHECKER_BOT_REPONSES).map((key) => { + return `__CONSTANTS__.FACTCHECKER_BOT_RESPONSES.${key}` +}) +const userKeys = Object.entries(USER_BOT_RESPONSES).flatMap(([key, value]) => { + return Object.keys(value).map( + (language) => `__CONSTANTS__.USER_BOT_RESPONSES.${key}.${language}` + ) }) //combine the two lists @@ -48,9 +51,13 @@ const envWithRemovedValues = env.values.filter((value) => { const envWithReplacedValues = envWithRemovedValues.map((value) => { if (value.key.startsWith("__CONSTANTS__.")) { - const key = value.key.replace("__CONSTANTS__.", "") - const newValue = _.get(constants, key) - value.value = newValue + const stringParts = value.key.split(".") + const key = stringParts.slice(2).join(".") + if (stringParts[1] === "FACTCHECKER_BOT_RESPONSES") { + value.value = _.get(CHECKER_BOT_REPONSES, key) + } else if (stringParts[1] === "USER_BOT_RESPONSES") { + value.value = _.get(USER_BOT_RESPONSES, key) + } return value } else { return value