diff --git a/README.md b/README.md index 7b8b1f7b..565668d3 100644 --- a/README.md +++ b/README.md @@ -4,37 +4,98 @@ Vonage -This is the Node.JS SDK for [Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage account. Sign up [for free at vonage.com][signup]. +This is the Node.JS Server SDK for [Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage account. Sign up [for free at vonage.com][signup]. For full API documentation refer to [developer.vonage.com](https://developer.vonage.com/). +* [Installation](#installation) +* [Constructor](#constructor) +* [Promises](#promises) +* [Testing](#testing) +* [Examples](#examples) +* [References](#references) + + +## Installation + +### With NPM + +```bash +npm install @vonage/server-sdk +``` + +### With Yarn + +```bash +yarn add @vonage/server-sdk +``` + +## Constructor + +```js +const { Vonage } = require('@vonage/server-sdk'); + +const vonage = new Vonage(credentials, options); +``` + +Where `credentials` is any option from [`@vonage/auth`](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/auth/README.md#options), and `options` is any option from [`@vonage/server-client`](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/server-client/README.md#options) + +## Promises + +Most methods that interact with the Vonage API uses Promises. You can either resolve these yourself, or use `await` to wait for a response. + +```js +const resp = await vonage.sms.send({ + to: '15552220000', + from: '15559992222', + text: 'This is a test', +}); +``` + +## Testing + +Run: + +```bash +npm run test +``` + +Or to continually watch and run tests as you change the code: + +```bash +npm run test-watch +``` + +## Examples + +See the [Vonage Node Quickstarts repo](https://github.com/Vonage/vonage-node-code-snippets). + + ## References -This is a [monorepo](https://en.wikipedia.org/wiki/Monorepo). You can find more information for each package below: +You can find more information for each product below: -* [Accounts](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/accounts/README.md) +* [Accounts][applications] * [Applications](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/applications/README.md) * [Audit](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/audit/README.md) -* [Auth](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/auth/README.md) -* [JWT](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/jwt/README.md) +* [Auth][auth] +* [JWT][jwt] * [Messages](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/messages/README.md) * [Number Insights](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/number-insights/README.md) * [Numbers](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/numbers/README.md) * [Pricing](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/pricing/README.md) -* [Redact](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/redact/README.md) * [Server Client](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/server-client/README.md) * [Server SDK](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/server-sdk/README.md) -* [SMS](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/sms/README.md) +* [SMS][sms] +* [Sub Accounts](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/subaccounts/README.md) * [Verify](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/verify/README.md) * [Verify V2](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/verify2/README.md) * [Vetch](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/vetch/README.md) * [Video](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/video/README.md) -* [Voice](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/voice/README.md) +* [Voice][voice] ## Supported APIs -Only API's marked as General Availability will be available through the [Server SDK](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/server-sdk/README.md) package. All other supported packages will have to be installed and configured outside that package. - The following is a list of Vonage APIs and whether the Node Server SDK provides support for them: | API | API Release Status | Supported? | @@ -51,6 +112,7 @@ The following is a list of Vonage APIs and whether the Node Server SDK provides | Number Insight API | General Availability | ✅ | | Number Management API | General Availability | ✅ | | Pricing API | General Availability | ✅ | +| Proactive Connect API | Beta | ✅ | | Redact API | Developer Preview | ✅ | | Reports API | Beta | ❌ | | SMS API | General Availability | ✅ | @@ -59,5 +121,31 @@ The following is a list of Vonage APIs and whether the Node Server SDK provides | Verify v2 API | General Availability | ✅ | | Voice API | General Availability | ✅ | +### V2 Migrations + +While most of the V2 functions have been ported into their own package, some of the functions have not been ported or were removed. Below is a list of those changes: + +| V2 Function | Status | Note | +|-----------------------------|:---------------:|:------------------------------------------------------:| +| `vonage.conversion` | _REMOVED_ | | +| `vonage.conversation` | Not Implemented | This was only released as a beta package | +| `vonage.app` | _REMOVED_ | Moved to [Applications][applications] | +| `vonage.files` | Not ported | Has not been ported to V3 at this time | +| `vonage.message` | Moved | Moved to [SMS][sms] | +| `vonage.generateJwt` | Moved | Was moved to [JWT][jwt] | +| `vonage.generateSignature` | Not Ported | Has not been ported to V3 at this time | +| `vonage.calls` | Moved | Was moved to [Voice][voice] | +| `vonage.credentials` | Updated | Options can be found in [Server Client][server-client] | +| `vonage.options` | Updated | Options can be found in [Server Client][server-client] | +| `vonage.options.httpClient` | _Removed_ | | +| `vonage.options.userAgent` | Not Ported | Has not been ported to V3 at this time | + +For more information, check out each packages migration guide. + +[applications]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/applications/README.md +[auth]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/auth/README.md +[sms]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/sms/README.md +[jwt]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/jwt/README.md +[voice]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/voice/README.md [signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=node-server-sdk [license]: LICENSE.txt diff --git a/packages/accounts/README.md b/packages/accounts/README.md index 74a5e9d9..ba07a96e 100644 --- a/packages/accounts/README.md +++ b/packages/accounts/README.md @@ -8,6 +8,8 @@ This is the Vonage Account SDK for Node.js for use with [Vonage APIs](https://ww For full API documentation refer to [developer.vonage.com](https://developer.vonage.com/). +If you are updating from V2 to V3, please check the migration guide found [here](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/accounts/v2_TO_v3_MIGRATION_GUIDE.md) + * [Installation](#installation) * [Usage](#usage) * [Promises](#promises) @@ -96,5 +98,7 @@ Run: npm run test ``` + + [signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=node-server-sdk [license]: ../../LICENSE.txt diff --git a/packages/applications/README.md b/packages/applications/README.md index b7784d48..aaa90b53 100644 --- a/packages/applications/README.md +++ b/packages/applications/README.md @@ -8,6 +8,8 @@ This is the Vonage Applications SDK for Node.js for use with [Vonage APIs](https For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). +If you are updating from V2 to V3, please check the migration guide found [here](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/applications/v2_TO_v3_MIGRATION_GUIDE.md) + * [Installation](#installation) * [Usage](#usage) * [Promises](#promises) diff --git a/packages/messages/README.md b/packages/messages/README.md index 8216f29f..114a9a0a 100644 --- a/packages/messages/README.md +++ b/packages/messages/README.md @@ -8,6 +8,8 @@ This is the Vonage Messages SDK for Node.js for use with [Vonage APIs](https://w For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). +If you are updating from V2 to V3, please check the migration guide found [here](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/messages/v2_TO_v3_MIGRATION_GUIDE.md) + * [Installation](#installation) * [Usage](#usage) * [Promises](#promises) diff --git a/packages/messages/v2_TO_v3_MIGRATION_GUIDE.md b/packages/messages/v2_TO_v3_MIGRATION_GUIDE.md index 93e2b511..16ba34f2 100644 --- a/packages/messages/v2_TO_v3_MIGRATION_GUIDE.md +++ b/packages/messages/v2_TO_v3_MIGRATION_GUIDE.md @@ -73,7 +73,7 @@ There are no differences to the methods used for sending messages from 2.x to If you used the classes that were made available for different messages types in 2.x, you will want to update the require statements to use: - `@vonage/messages/dist/classes/` + `@vonage/messages` instead of the older: diff --git a/packages/number-insights/README.md b/packages/number-insights/README.md index 2d777ae9..c4a438dc 100644 --- a/packages/number-insights/README.md +++ b/packages/number-insights/README.md @@ -8,6 +8,8 @@ This is the Vonage Number Insights SDK for Node.js for use with [Vonage APIs](ht For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). +If you are updating from V2 to V3, please check the migration guide found [here](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/number-insights/v2_TO_v3_MIGRATION_GUIDE.md) + * [Installation](#installation) * [Usage](#usage) * [Promises](#promises) diff --git a/packages/numbers/README.md b/packages/numbers/README.md index 40bea18a..85b7136f 100644 --- a/packages/numbers/README.md +++ b/packages/numbers/README.md @@ -8,6 +8,8 @@ This is the Vonage Number SDK for Node.js for use with [Vonage APIs](https://www For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). +If you are updating from V2 to V3, please check the migration guide found [here](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/numbers/v2_TO_v3_MIGRATION_GUIDE.md) + * [Installation](#installation) * [Usage](#usage) * [Promises](#promises) diff --git a/packages/pricing/README.md b/packages/pricing/README.md index 92afbd55..9f7d9009 100644 --- a/packages/pricing/README.md +++ b/packages/pricing/README.md @@ -9,6 +9,8 @@ This is the Vonage Pricing SDK for Node.js for use with [Vonage APIs](https://ww For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). +If you are updating from V2 to V3, please check the migration guide found [here](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/pricing/v2_TO_v3_MIGRATION_GUIDE.md) + * [Installation](#installation) * [Usage](#usage) * [Promises](#promises) diff --git a/packages/server-sdk/README.md b/packages/server-sdk/README.md index d2189ba9..565668d3 100644 --- a/packages/server-sdk/README.md +++ b/packages/server-sdk/README.md @@ -70,28 +70,29 @@ npm run test-watch See the [Vonage Node Quickstarts repo](https://github.com/Vonage/vonage-node-code-snippets). + ## References You can find more information for each product below: -* [Accounts](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/accounts/README.md) +* [Accounts][applications] * [Applications](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/applications/README.md) * [Audit](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/audit/README.md) -* [Auth](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/auth/README.md) -* [JWT](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/jwt/README.md) +* [Auth][auth] +* [JWT][jwt] * [Messages](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/messages/README.md) * [Number Insights](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/number-insights/README.md) * [Numbers](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/numbers/README.md) * [Pricing](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/pricing/README.md) * [Server Client](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/server-client/README.md) * [Server SDK](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/server-sdk/README.md) -* [SMS](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/sms/README.md) +* [SMS][sms] * [Sub Accounts](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/subaccounts/README.md) * [Verify](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/verify/README.md) * [Verify V2](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/verify2/README.md) * [Vetch](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/vetch/README.md) * [Video](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/video/README.md) -* [Voice](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/voice/README.md) +* [Voice][voice] ## Supported APIs @@ -120,5 +121,31 @@ The following is a list of Vonage APIs and whether the Node Server SDK provides | Verify v2 API | General Availability | ✅ | | Voice API | General Availability | ✅ | +### V2 Migrations + +While most of the V2 functions have been ported into their own package, some of the functions have not been ported or were removed. Below is a list of those changes: + +| V2 Function | Status | Note | +|-----------------------------|:---------------:|:------------------------------------------------------:| +| `vonage.conversion` | _REMOVED_ | | +| `vonage.conversation` | Not Implemented | This was only released as a beta package | +| `vonage.app` | _REMOVED_ | Moved to [Applications][applications] | +| `vonage.files` | Not ported | Has not been ported to V3 at this time | +| `vonage.message` | Moved | Moved to [SMS][sms] | +| `vonage.generateJwt` | Moved | Was moved to [JWT][jwt] | +| `vonage.generateSignature` | Not Ported | Has not been ported to V3 at this time | +| `vonage.calls` | Moved | Was moved to [Voice][voice] | +| `vonage.credentials` | Updated | Options can be found in [Server Client][server-client] | +| `vonage.options` | Updated | Options can be found in [Server Client][server-client] | +| `vonage.options.httpClient` | _Removed_ | | +| `vonage.options.userAgent` | Not Ported | Has not been ported to V3 at this time | + +For more information, check out each packages migration guide. + +[applications]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/applications/README.md +[auth]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/auth/README.md +[sms]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/sms/README.md +[jwt]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/jwt/README.md +[voice]: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/voice/README.md [signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=node-server-sdk [license]: LICENSE.txt diff --git a/packages/sms/README.md b/packages/sms/README.md index 3918470b..36b576eb 100644 --- a/packages/sms/README.md +++ b/packages/sms/README.md @@ -8,6 +8,8 @@ This is the Vonage SMS SDK for Node.js for use with [Vonage APIs](https://www.vo For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). +If you are updating from V2 to V3, please check the migration guide found [here](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/sms/v2_TO_v3_MIGRATION_GUIDE.md) + * [Installation](#installation) * [Usage](#usage) * [Promises](#promises) diff --git a/packages/sms/v2_TO_v3_MIGRATION_GUIDE.md b/packages/sms/v2_TO_v3_MIGRATION_GUIDE.md index 6ab1916e..f47812fc 100644 --- a/packages/sms/v2_TO_v3_MIGRATION_GUIDE.md +++ b/packages/sms/v2_TO_v3_MIGRATION_GUIDE.md @@ -13,6 +13,7 @@ $ npm install @vonage/sms ## Setup ### With the Vonage Server SDK + If you are using the main Vonage Node Server SDK, you will need to configure it using a Vonage API Key and Secret. The setup is the same for any other key/secret-based application. The SMS client will then be available as `vonage.sms`. ```js @@ -33,6 +34,7 @@ vonage.sms.send({ ``` ### Standalone + This module is also capable of working as a standalone module. The only difference is that you create a `SMS` object and pass the credentials there. ```js diff --git a/packages/verify/README.md b/packages/verify/README.md index 2128eae6..9e59b46a 100644 --- a/packages/verify/README.md +++ b/packages/verify/README.md @@ -10,6 +10,8 @@ Note: This package is only compatible with verify V1. For full API documentation refer to [developer.vonage.com](https://developer.vonage.com/). +If you are updating from V2 to V3, please check the migration guide found [here](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/verify/v2_TO_v3_MIGRATION_GUIDE.md) + - [Installation](#installation) - [Usage](#usage) - [Promises](#promises) diff --git a/packages/voice/README.md b/packages/voice/README.md index 32501c2b..18acd4c3 100644 --- a/packages/voice/README.md +++ b/packages/voice/README.md @@ -10,6 +10,8 @@ This is the Vonage Voice SDK for Node.js for use with [Vonage APIs](https://www. For full API documentation refer to [developer.vonage.com](https://developer.vonage.com/). +If you are updating from V2 to V3, please check the migration guide found [here](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/voice/v2_TO_v3_MIGRATION_GUIDE.md) + * [Installation](#installation) * [Usage](#usage) * [Promises](#promises)