From f5d8ca5b2ce83cd07c8c9b65308e0009809f8761 Mon Sep 17 00:00:00 2001 From: dhruv Date: Wed, 4 Sep 2024 14:10:11 -0400 Subject: [PATCH 1/7] feat(templates): add block-spam-calls template --- block-spam-calls/CHANGELOG.md | 8 ++ block-spam-calls/assets/index.html | 88 +++++++++++++++++++ .../functions/block-spam-calls.protected.js | 82 +++++++++++++++++ block-spam-calls/package.json | 7 ++ package.json | 5 +- templates.json | 7 +- 6 files changed, 194 insertions(+), 3 deletions(-) create mode 100644 block-spam-calls/CHANGELOG.md create mode 100644 block-spam-calls/assets/index.html create mode 100644 block-spam-calls/functions/block-spam-calls.protected.js create mode 100644 block-spam-calls/package.json diff --git a/block-spam-calls/CHANGELOG.md b/block-spam-calls/CHANGELOG.md new file mode 100644 index 00000000..3982d461 --- /dev/null +++ b/block-spam-calls/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +## [Unreleased] + +## [1.0.0] +### Added +- Initial release. + diff --git a/block-spam-calls/assets/index.html b/block-spam-calls/assets/index.html new file mode 100644 index 00000000..7c54b923 --- /dev/null +++ b/block-spam-calls/assets/index.html @@ -0,0 +1,88 @@ + + + + + + + Get started with your Twilio Functions! + + + + + + + +
+
+ + +
+
+
+
+

+ +
+

Welcome!

+

Your live application with Twilio is ready to use!

+
+

+
+

Get started with your application

+

+ Follow the set up steps located in the + Block Spam Calls functions template repo + to get started. + +

+ +

+ This app will return the + TwiML + required to reject or accept incoming Voice calls based on the phone numbers spam rating. +

+
+
+ +
+
+

Troubleshooting

+
    +
  • + Check the + + phone number configuration + + and make sure the Twilio phone number you want for your app has a Voice webhook + configured to point at the following URL +
    + + +
    +
  • +
+
+
+
+ + + diff --git a/block-spam-calls/functions/block-spam-calls.protected.js b/block-spam-calls/functions/block-spam-calls.protected.js new file mode 100644 index 00000000..3374addd --- /dev/null +++ b/block-spam-calls/functions/block-spam-calls.protected.js @@ -0,0 +1,82 @@ +/* + * Block Spam Calls + * + * Description: + * This application uses Twilio Add-ons from the Twilio Marketplace to block + * unwanted voice calls. The 2 Add-ons used in this application are Marchex + * Clean Call and Nomorobo Spam Score. The application provides the spam rating + * of every inbound call to a Twilio number via the three Add-ons. + * If the phone number is classified as spam by any of the two integrations, the + * call is rejected. If the number isn't categorized as spam, the call will go through. + * + * Contents: + * 1. Input Helpers + * 2. Main Handler + */ + +/* + * 1. Input Helpers + * These helper functions help read the results from the spam Add-ons + * in the incoming voice TwiML callback. + * + * Function will return true if the call is classified as spam. + * Otherwise, it will return false. + */ + +function blockedByMarchex(response) { + if (!response || response.status !== 'successful') { + return false; + } + + return response.result.result.recommendation === 'BLOCK'; +} + +function blockedByNomorobo(response) { + if (!response || response.status !== 'successful') { + return false; + } + + return response.result.score === 1; +} +/** + * 2. Main Handler + * + * This is the entry point to your Twilio Function, + * which will create a new Voice Response using Twiml based on + * the spam filters. If the call is flagged as spam by any of the + * spam filtering add-ons, the call will blocked by the Twiml + * verb. Else, the call will proceed and the Voice Response + * will respond to the caller with a greeting. + * + * The callback will be used to return from your function + * with the Twiml Voice Response you defined earlier. + * In the callback in non-error situations, the first + * parameter is null and the second parameter + * is the value you want to return. + */ +exports.handler = function (context, event, callback) { + const twiml = new Twilio.twiml.VoiceResponse(); + + let blockCalls = false; + + /* + * If the request body contains add-ons, check to see if any of + * the spam filtering add-ons have flagged the number. + */ + const addOns = 'AddOns' in event && JSON.parse(event.AddOns); + if (addOns && addOns.status === 'successful') { + const {results} = addOns; + + blockCalls = blockedByMarchex(results.marchex_cleancall) || + blockedByNomorobo(results.nomorobo_spamscore); + } + if (blockCalls) { + twiml.reject(); + } else { + // Add instructions here on what to do if call goes through + twiml.say('Welcome to the jungle.'); + twiml.hangup(); + } + + callback(null, twiml); +}; diff --git a/block-spam-calls/package.json b/block-spam-calls/package.json new file mode 100644 index 00000000..d3134903 --- /dev/null +++ b/block-spam-calls/package.json @@ -0,0 +1,7 @@ +{ + "name": "block-spam-calls", + "version": "1.0.0", + "private": true, + "dependencies": { + } +} diff --git a/package.json b/package.json index 9a03e5ea..d998dc80 100644 --- a/package.json +++ b/package.json @@ -142,6 +142,7 @@ "flex-dialpad", "verify-prefill", "reminder-message", - "passkeys-backend" + "passkeys-backend", + "block-spam-calls" ] -} +} \ No newline at end of file diff --git a/templates.json b/templates.json index 58d00ba1..fe561930 100644 --- a/templates.json +++ b/templates.json @@ -354,6 +354,11 @@ "id": "passkeys-backend", "name": "Backend for passkeys app", "description": "Connect applications with the passkeys service" + }, + { + "id": "block-spam-calls", + "name": "Block Spam Calls", + "description": "Uses Twilio Add-ons to block unwanted calls by checking the spam ratings of incoming phone numbers." } ] -} +} \ No newline at end of file From f3b2622342ed574081ab579110c7d32f54b9fdc1 Mon Sep 17 00:00:00 2001 From: dhruv Date: Wed, 4 Sep 2024 14:10:39 -0400 Subject: [PATCH 2/7] docs(block-spam-calls): add README.md guide --- block-spam-calls/README.md | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 block-spam-calls/README.md diff --git a/block-spam-calls/README.md b/block-spam-calls/README.md new file mode 100644 index 00000000..8fb017b1 --- /dev/null +++ b/block-spam-calls/README.md @@ -0,0 +1,53 @@ +# block-spam-calls + +Uses Twilio Add-ons to block unwanted calls by checking the spam ratings of incoming phone numbers. + +## Pre-requisites + +- A Twilio account - [sign up here](https://www.twilio.com/try-twilio) +- A Twilio phone number +- Spam filtering Add-ons (see below) + +### Install Add-Ons + +The following guide will help you to [install Add-ons](https://www.twilio.com/docs/add-ons/install). You can access the Add-ons in the Twilio console [here](https://www.twilio.com/console/add-ons). The Spam Filtering Add-ons that are used on this application are: +- [Marchex Clean Call](https://www.twilio.com/console/add-ons/XBac2c99d9c684a765ced0b18cf0e5e1c7) +- [Nomorobo Spam Score](https://www.twilio.com/console/add-ons/XB06d5274893cc9af4198667d2f7d74d09) + +Once you've selected the Add-on, just click on `Install` button. Then, you will see a pop-up window where you should read and agree the terms, then, click the button `Agree & Install`. For this application, you just need to handle the incoming voice calls, so make sure the `Incoming Voice Call` box for `Use In` is checked and click `Save`. + +### Function Parameters + +This template by default accepts no additional parameters. + +## Create a new project with the template + +1. Install the [serverless toolkit](https://www.twilio.com/docs/labs/serverless-toolkit/getting-started) +2. Install the [Twilio CLI](https://www.twilio.com/docs/twilio-cli/quickstart#install-twilio-cli) +3. Initiate a new project + +``` +twilio serverless:init sample --template=block-spam-calls && cd sample +``` + +4. Start the server with the [Twilio CLI](https://www.twilio.com/docs/twilio-cli/quickstart): + +``` +twilio serverless:start --ngrok +``` + +5. Set your incoming call webhook URL for the phone number you want to configure to `https://.ngrok.io/block-spam-calls` + +ℹ️ Check the developer console and terminal for any errors + + +## Deploying + +Deploy your functions and assets with either of the following commands. Note: you must run these commands from inside your project folder. [More details in the docs.](https://www.twilio.com/docs/labs/serverless-toolkit) + +With the [Twilio CLI](https://www.twilio.com/docs/twilio-cli/quickstart): + +``` +twilio serverless:deploy +``` +Make sure to update your incoming voice URL to your newly deployed Function URL. From f4421b563e1cfc47fb739c92c9e941b95735a071 Mon Sep 17 00:00:00 2001 From: dhruv Date: Wed, 4 Sep 2024 14:11:25 -0400 Subject: [PATCH 3/7] test(block-spam-calls): add jest tests --- .../tests/block-spam-calls.test.js | 116 ++++++++++++++++++ .../spam-filter-results/clean-marchex.json | 19 +++ .../spam-filter-results/clean-nomorobo.json | 18 +++ .../spam-filter-results/failed-nomorobo.json | 14 +++ .../spam-filter-results/spam-marchex.json | 19 +++ .../spam-filter-results/spam-nomorobo.json | 18 +++ 6 files changed, 204 insertions(+) create mode 100644 block-spam-calls/tests/block-spam-calls.test.js create mode 100644 block-spam-calls/tests/spam-filter-results/clean-marchex.json create mode 100644 block-spam-calls/tests/spam-filter-results/clean-nomorobo.json create mode 100644 block-spam-calls/tests/spam-filter-results/failed-nomorobo.json create mode 100644 block-spam-calls/tests/spam-filter-results/spam-marchex.json create mode 100644 block-spam-calls/tests/spam-filter-results/spam-nomorobo.json diff --git a/block-spam-calls/tests/block-spam-calls.test.js b/block-spam-calls/tests/block-spam-calls.test.js new file mode 100644 index 00000000..0038b69e --- /dev/null +++ b/block-spam-calls/tests/block-spam-calls.test.js @@ -0,0 +1,116 @@ +const helpers = require('../../test/test-helper'); +const blockSpamCalls = require('../functions/block-spam-calls.protected').handler; +const Twilio = require('twilio'); + +let context = {}; +let event = {}; + +beforeAll(() => { + helpers.setup(context); +}); + +afterEach(() => { + context = {}; + event = {}; +}); + +afterAll(() => { + helpers.teardown(); +}); + +test('returns a VoiceResponse', (done) => { + const callback = (_err, result) => { + expect(result).toBeInstanceOf(Twilio.twiml.VoiceResponse); + done(); + }; + + blockSpamCalls(context, event, callback); +}); + +describe('call flagged as spam and rejected', () => { + + const nomoroboSpamEvent = { + 'AddOns': JSON.stringify(require('./spam-filter-results/spam-nomorobo.json')) + }; + const marchexSpamEvent = { + 'AddOns': JSON.stringify(require('./spam-filter-results/spam-marchex.json')) + }; + + beforeAll(() => { + helpers.setup(context); + }); + + afterAll(() => { + helpers.teardown(); + }); + + test('flagged spam by nomorobo', (done) => { + const callback = (_err, result) => { + expect(result.toString()).toMatch(/Reject/); + done(); + }; + blockSpamCalls(context, nomoroboSpamEvent, callback); + }); + + test('flagged spam by marchex', (done) => { + const callback = (_err, result) => { + expect(result.toString()).toMatch(/Reject/); + done(); + }; + blockSpamCalls(context, marchexSpamEvent, callback); + }); +}); + +describe('call not flagged as spam', () => { + + const failedNomoroboEvent = { + 'AddOns': JSON.stringify(require('./spam-filter-results/failed-nomorobo.json')) + }; + const cleanNomoroboEvent = { + 'AddOns': JSON.stringify(require('./spam-filter-results/clean-nomorobo.json')) + }; + const cleanMarchexEvent = { + 'AddOns': JSON.stringify(require('./spam-filter-results/clean-marchex.json')) + }; + const noAddonsEvent = {}; + + beforeAll(() => { + helpers.setup(context); + }); + + afterAll(() => { + helpers.teardown(); + }); + + test('flagged clean by nomorobo', (done) => { + const callback = (_err, result) => { + expect(result.toString()).toMatch(/Welcome to the jungle./); + done(); + }; + blockSpamCalls(context, cleanNomoroboEvent, callback); + }); + + test('flagged clean by marchex', (done) => { + const callback = (_err, result) => { + expect(result.toString()).toMatch(/Welcome to the jungle./); + done(); + }; + blockSpamCalls(context, cleanMarchexEvent, callback); + }); + + test('failed nomorobo response (call goes through)', (done) => { + const callback = (_err, result) => { + expect(result.toString()).toMatch(/Welcome to the jungle./); + done(); + }; + blockSpamCalls(context, failedNomoroboEvent, callback); + }); + + test('No addons present (call goes through)', (done) => { + const callback = (_err, result) => { + expect(result.toString()).toMatch(/Welcome to the jungle./); + done(); + }; + blockSpamCalls(context, noAddonsEvent, callback); + }); +}); diff --git a/block-spam-calls/tests/spam-filter-results/clean-marchex.json b/block-spam-calls/tests/spam-filter-results/clean-marchex.json new file mode 100644 index 00000000..cf7bfcb9 --- /dev/null +++ b/block-spam-calls/tests/spam-filter-results/clean-marchex.json @@ -0,0 +1,19 @@ +{ + "status": "successful", + "message": null, + "code": null, + "results": { + "marchex_cleancall": { + "request_sid": "XRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "status": "successful", + "message": null, + "code": null, + "result": { + "result": { + "recommendation": "PASS", + "reason": "CleanCall" + } + } + } + } + } \ No newline at end of file diff --git a/block-spam-calls/tests/spam-filter-results/clean-nomorobo.json b/block-spam-calls/tests/spam-filter-results/clean-nomorobo.json new file mode 100644 index 00000000..3997109b --- /dev/null +++ b/block-spam-calls/tests/spam-filter-results/clean-nomorobo.json @@ -0,0 +1,18 @@ +{ + "status": "successful", + "message": null, + "code": null, + "results": { + "nomorobo_spamscore": { + "request_sid": "XRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "status": "successful", + "message": null, + "code": null, + "result": { + "status": "success", + "message": "success", + "score": 0 + } + } + } +} \ No newline at end of file diff --git a/block-spam-calls/tests/spam-filter-results/failed-nomorobo.json b/block-spam-calls/tests/spam-filter-results/failed-nomorobo.json new file mode 100644 index 00000000..b483dc6f --- /dev/null +++ b/block-spam-calls/tests/spam-filter-results/failed-nomorobo.json @@ -0,0 +1,14 @@ +{ + "status": "successful", + "message": null, + "code": null, + "results": { + "nomorobo_spamscore": { + "request_sid": "XRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "status": "failed", + "message": "Vendor could not complete request", + "code": 61002, + "result": { } + } + } +} diff --git a/block-spam-calls/tests/spam-filter-results/spam-marchex.json b/block-spam-calls/tests/spam-filter-results/spam-marchex.json new file mode 100644 index 00000000..a44f35c0 --- /dev/null +++ b/block-spam-calls/tests/spam-filter-results/spam-marchex.json @@ -0,0 +1,19 @@ +{ + "status": "successful", + "message": null, + "code": null, + "results": { + "marchex_cleancall": { + "request_sid": "XRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "status": "successful", + "message": null, + "code": null, + "result": { + "result": { + "recommendation": "BLOCK", + "reason": "Testing" + } + } + } + } +} \ No newline at end of file diff --git a/block-spam-calls/tests/spam-filter-results/spam-nomorobo.json b/block-spam-calls/tests/spam-filter-results/spam-nomorobo.json new file mode 100644 index 00000000..2d6868d9 --- /dev/null +++ b/block-spam-calls/tests/spam-filter-results/spam-nomorobo.json @@ -0,0 +1,18 @@ +{ + "status": "successful", + "message": null, + "code": null, + "results": { + "nomorobo_spamscore": { + "request_sid": "XRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "status": "successful", + "message": null, + "code": null, + "result": { + "status": "success", + "message": "success", + "score": 1 + } + } + } +} \ No newline at end of file From be75a93b4195aa75fbcefc557cf5bd1b6ce06d7d Mon Sep 17 00:00:00 2001 From: dhruv Date: Wed, 4 Sep 2024 14:18:39 -0400 Subject: [PATCH 4/7] format(block-spam-calls): run prettier --- .../functions/block-spam-calls.protected.js | 19 ++++++++++--------- .../tests/block-spam-calls.test.js | 19 +++++++++++-------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/block-spam-calls/functions/block-spam-calls.protected.js b/block-spam-calls/functions/block-spam-calls.protected.js index 3374addd..ece7f720 100644 --- a/block-spam-calls/functions/block-spam-calls.protected.js +++ b/block-spam-calls/functions/block-spam-calls.protected.js @@ -16,9 +16,9 @@ /* * 1. Input Helpers - * These helper functions help read the results from the spam Add-ons + * These helper functions help read the results from the spam Add-ons * in the incoming voice TwiML callback. - * + * * Function will return true if the call is classified as spam. * Otherwise, it will return false. */ @@ -40,10 +40,10 @@ function blockedByNomorobo(response) { } /** * 2. Main Handler - * + * * This is the entry point to your Twilio Function, * which will create a new Voice Response using Twiml based on - * the spam filters. If the call is flagged as spam by any of the + * the spam filters. If the call is flagged as spam by any of the * spam filtering add-ons, the call will blocked by the Twiml * verb. Else, the call will proceed and the Voice Response * will respond to the caller with a greeting. @@ -62,14 +62,15 @@ exports.handler = function (context, event, callback) { /* * If the request body contains add-ons, check to see if any of * the spam filtering add-ons have flagged the number. - */ + */ const addOns = 'AddOns' in event && JSON.parse(event.AddOns); if (addOns && addOns.status === 'successful') { - const {results} = addOns; - - blockCalls = blockedByMarchex(results.marchex_cleancall) || - blockedByNomorobo(results.nomorobo_spamscore); + const { results } = addOns; + blockCalls = + blockedByMarchex(results.marchex_cleancall) || + blockedByNomorobo(results.nomorobo_spamscore); } + if (blockCalls) { twiml.reject(); } else { diff --git a/block-spam-calls/tests/block-spam-calls.test.js b/block-spam-calls/tests/block-spam-calls.test.js index 0038b69e..6e0898ab 100644 --- a/block-spam-calls/tests/block-spam-calls.test.js +++ b/block-spam-calls/tests/block-spam-calls.test.js @@ -1,5 +1,6 @@ const helpers = require('../../test/test-helper'); -const blockSpamCalls = require('../functions/block-spam-calls.protected').handler; +const blockSpamCalls = + require('../functions/block-spam-calls.protected').handler; const Twilio = require('twilio'); let context = {}; @@ -28,12 +29,11 @@ test('returns a VoiceResponse', (done) => { }); describe('call flagged as spam and rejected', () => { - const nomoroboSpamEvent = { - 'AddOns': JSON.stringify(require('./spam-filter-results/spam-nomorobo.json')) + AddOns: JSON.stringify(require('./spam-filter-results/spam-nomorobo.json')), }; const marchexSpamEvent = { - 'AddOns': JSON.stringify(require('./spam-filter-results/spam-marchex.json')) + AddOns: JSON.stringify(require('./spam-filter-results/spam-marchex.json')), }; beforeAll(() => { @@ -62,15 +62,18 @@ describe('call flagged as spam and rejected', () => { }); describe('call not flagged as spam', () => { - const failedNomoroboEvent = { - 'AddOns': JSON.stringify(require('./spam-filter-results/failed-nomorobo.json')) + AddOns: JSON.stringify( + require('./spam-filter-results/failed-nomorobo.json') + ), }; const cleanNomoroboEvent = { - 'AddOns': JSON.stringify(require('./spam-filter-results/clean-nomorobo.json')) + AddOns: JSON.stringify( + require('./spam-filter-results/clean-nomorobo.json') + ), }; const cleanMarchexEvent = { - 'AddOns': JSON.stringify(require('./spam-filter-results/clean-marchex.json')) + AddOns: JSON.stringify(require('./spam-filter-results/clean-marchex.json')), }; const noAddonsEvent = {}; From 9fb5a2f5eab6bcd8fa1681b73cec042717c979ec Mon Sep 17 00:00:00 2001 From: Dhruv Patel Date: Wed, 4 Sep 2024 14:51:52 -0400 Subject: [PATCH 5/7] chore(block-spam-calls): add .env file --- block-spam-calls/.env | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 block-spam-calls/.env diff --git a/block-spam-calls/.env b/block-spam-calls/.env new file mode 100644 index 00000000..2c294ce3 --- /dev/null +++ b/block-spam-calls/.env @@ -0,0 +1,3 @@ +# description: The path to the webhook +# configurable: false +TWILIO_VOICE_WEBHOOK_URL=/block-spam-calls From 2d5a0dc42239fd0666eb7d341d51489191d61d08 Mon Sep 17 00:00:00 2001 From: dhruv Date: Wed, 4 Sep 2024 14:57:27 -0400 Subject: [PATCH 6/7] style(block-spam-calls): rerun prettier --- block-spam-calls/CHANGELOG.md | 3 +- block-spam-calls/README.md | 3 +- block-spam-calls/assets/index.html | 221 +++++++++++------- block-spam-calls/package.json | 3 +- .../spam-filter-results/clean-marchex.json | 28 +-- .../spam-filter-results/clean-nomorobo.json | 2 +- .../spam-filter-results/failed-nomorobo.json | 2 +- .../spam-filter-results/spam-marchex.json | 2 +- .../spam-filter-results/spam-nomorobo.json | 2 +- 9 files changed, 160 insertions(+), 106 deletions(-) diff --git a/block-spam-calls/CHANGELOG.md b/block-spam-calls/CHANGELOG.md index 3982d461..144828c2 100644 --- a/block-spam-calls/CHANGELOG.md +++ b/block-spam-calls/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ## [1.0.0] + ### Added -- Initial release. +- Initial release. diff --git a/block-spam-calls/README.md b/block-spam-calls/README.md index 8fb017b1..77ad395e 100644 --- a/block-spam-calls/README.md +++ b/block-spam-calls/README.md @@ -11,6 +11,7 @@ Uses Twilio Add-ons to block unwanted calls by checking the spam ratings of inco ### Install Add-Ons The following guide will help you to [install Add-ons](https://www.twilio.com/docs/add-ons/install). You can access the Add-ons in the Twilio console [here](https://www.twilio.com/console/add-ons). The Spam Filtering Add-ons that are used on this application are: + - [Marchex Clean Call](https://www.twilio.com/console/add-ons/XBac2c99d9c684a765ced0b18cf0e5e1c7) - [Nomorobo Spam Score](https://www.twilio.com/console/add-ons/XB06d5274893cc9af4198667d2f7d74d09) @@ -40,7 +41,6 @@ twilio serverless:start --ngrok ℹ️ Check the developer console and terminal for any errors - ## Deploying Deploy your functions and assets with either of the following commands. Note: you must run these commands from inside your project folder. [More details in the docs.](https://www.twilio.com/docs/labs/serverless-toolkit) @@ -50,4 +50,5 @@ With the [Twilio CLI](https://www.twilio.com/docs/twilio-cli/quickstart): ``` twilio serverless:deploy ``` + Make sure to update your incoming voice URL to your newly deployed Function URL. diff --git a/block-spam-calls/assets/index.html b/block-spam-calls/assets/index.html index 7c54b923..0de5e91d 100644 --- a/block-spam-calls/assets/index.html +++ b/block-spam-calls/assets/index.html @@ -1,88 +1,141 @@ - + - - - - - Get started with your Twilio Functions! + + + + + Get started with your Twilio Functions! - - - - - - -
-
- - -
+ + + + + + +
+
+ -
-
-

- -
-

Welcome!

-

Your live application with Twilio is ready to use!

-
-

-
-

Get started with your application

-

- Follow the set up steps located in the - Block Spam Calls functions template repo - to get started. - -

- -

- This app will return the - TwiML - required to reject or accept incoming Voice calls based on the phone numbers spam rating. -

-
-
- -
-
-

Troubleshooting

-
    -
  • - Check the - - phone number configuration - - and make sure the Twilio phone number you want for your app has a Voice webhook - configured to point at the following URL -
    - - -
    -
  • -
-
-
-
-
- We can't wait to see what you build. -
- + +
+
+
+
+

+ +
+

Welcome!

+

Your live application with Twilio is ready to use!

+
+

+
+

Get started with your application

+

+ Follow the set up steps located in the + Block Spam Calls functions template repo + to get started. +

+ +

+ This app will return the + TwiML + required to reject or accept incoming Voice calls based on the phone + numbers spam rating. +

+
+
+ +
+
+

Troubleshooting

+
    +
  • + Check the + + phone number configuration + + and make sure the Twilio phone number you want for your app has a + Voice webhook configured to point at the following URL +
    + + +
    +
  • +
+
+
+
+
+ We can't wait to see what you build. +
+ diff --git a/block-spam-calls/package.json b/block-spam-calls/package.json index d3134903..333fc1ca 100644 --- a/block-spam-calls/package.json +++ b/block-spam-calls/package.json @@ -2,6 +2,5 @@ "name": "block-spam-calls", "version": "1.0.0", "private": true, - "dependencies": { - } + "dependencies": {} } diff --git a/block-spam-calls/tests/spam-filter-results/clean-marchex.json b/block-spam-calls/tests/spam-filter-results/clean-marchex.json index cf7bfcb9..b7067841 100644 --- a/block-spam-calls/tests/spam-filter-results/clean-marchex.json +++ b/block-spam-calls/tests/spam-filter-results/clean-marchex.json @@ -1,19 +1,19 @@ { - "status": "successful", - "message": null, - "code": null, - "results": { - "marchex_cleancall": { - "request_sid": "XRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "status": "successful", - "message": null, - "code": null, + "status": "successful", + "message": null, + "code": null, + "results": { + "marchex_cleancall": { + "request_sid": "XRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "status": "successful", + "message": null, + "code": null, + "result": { "result": { - "result": { - "recommendation": "PASS", - "reason": "CleanCall" - } + "recommendation": "PASS", + "reason": "CleanCall" } } } - } \ No newline at end of file + } +} diff --git a/block-spam-calls/tests/spam-filter-results/clean-nomorobo.json b/block-spam-calls/tests/spam-filter-results/clean-nomorobo.json index 3997109b..dc55ddc2 100644 --- a/block-spam-calls/tests/spam-filter-results/clean-nomorobo.json +++ b/block-spam-calls/tests/spam-filter-results/clean-nomorobo.json @@ -15,4 +15,4 @@ } } } -} \ No newline at end of file +} diff --git a/block-spam-calls/tests/spam-filter-results/failed-nomorobo.json b/block-spam-calls/tests/spam-filter-results/failed-nomorobo.json index b483dc6f..7b888be7 100644 --- a/block-spam-calls/tests/spam-filter-results/failed-nomorobo.json +++ b/block-spam-calls/tests/spam-filter-results/failed-nomorobo.json @@ -8,7 +8,7 @@ "status": "failed", "message": "Vendor could not complete request", "code": 61002, - "result": { } + "result": {} } } } diff --git a/block-spam-calls/tests/spam-filter-results/spam-marchex.json b/block-spam-calls/tests/spam-filter-results/spam-marchex.json index a44f35c0..64a3176f 100644 --- a/block-spam-calls/tests/spam-filter-results/spam-marchex.json +++ b/block-spam-calls/tests/spam-filter-results/spam-marchex.json @@ -16,4 +16,4 @@ } } } -} \ No newline at end of file +} diff --git a/block-spam-calls/tests/spam-filter-results/spam-nomorobo.json b/block-spam-calls/tests/spam-filter-results/spam-nomorobo.json index 2d6868d9..7f7ab168 100644 --- a/block-spam-calls/tests/spam-filter-results/spam-nomorobo.json +++ b/block-spam-calls/tests/spam-filter-results/spam-nomorobo.json @@ -15,4 +15,4 @@ } } } -} \ No newline at end of file +} From 5826c7295636f12e291a5bc511656fdafacbaee0 Mon Sep 17 00:00:00 2001 From: dhruv Date: Wed, 4 Sep 2024 15:00:53 -0400 Subject: [PATCH 7/7] style(block-spam-calls): run prettier for package.json and templates.json --- package.json | 2 +- templates.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 86826b50..0e07a451 100644 --- a/package.json +++ b/package.json @@ -146,4 +146,4 @@ "block-spam-calls", "ai-assistants-samples" ] -} \ No newline at end of file +} diff --git a/templates.json b/templates.json index cb8b1185..8d7d8a40 100644 --- a/templates.json +++ b/templates.json @@ -366,4 +366,4 @@ "description": "Functions to connect AI Assistants to various Channels and Tools" } ] -} \ No newline at end of file +}