Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
93dc4e7
DEVEXP-606: Update Fax SDK (#147)
asein-sinch Oct 11, 2024
17b58b1
DEVEXP-607: Mailgun Authentication (#148)
asein-sinch Oct 14, 2024
b7c45c7
E2E: Add ICE to webhooks events (#149)
asein-sinch Oct 15, 2024
c880133
DEVEXP-755: Support ListMessage.media field (#155)
asein-sinch Mar 11, 2025
6e2af69
DEVEXP-752: [Conversation] OAS Synchro - week 11 (#156)
asein-sinch Mar 13, 2025
ca2e4cd
DEVEXP-752: [SMS] OAS Synchro - week 11 (#157)
asein-sinch Mar 14, 2025
a2c51c3
DEVEXP-752: [Voice] OAS Synchro - week 11 (#158)
asein-sinch Mar 16, 2025
0ae3293
DEVEXP-781: [Conversation] Define timestamp as a string (#160)
asein-sinch Mar 19, 2025
d71da0b
DEVEXP-870: Support 'sg' payment type (#161)
asein-sinch May 11, 2025
d67f8bd
Remove pre-processing of event body (#163)
asein-sinch May 12, 2025
91ec7ae
DEVEXP-862: (Voice) Sync OAS - Week 15 (#164)
asein-sinch May 19, 2025
353e402
DEVEXP-883: (Voice) Sync OAS - Week 18 (#165)
asein-sinch May 19, 2025
31ebbee
DEVEXP-863: Fix parseEvent() methods to accept string inputs (#166)
asein-sinch May 19, 2025
4b16c34
DEVEXP-703: Support webhooks headers validation for SMS (#167)
asein-sinch May 20, 2025
ff134ec
DEVEXP-902: (Numbers) Sync OAS - Week 20 (#168)
asein-sinch May 26, 2025
b29358d
DEVEXP-902: (Conversation) OAS sync - Week 20 (#169)
asein-sinch May 26, 2025
6f44446
DEVEXP-902: (EST) OAS sync - Week 20 (#170)
asein-sinch May 27, 2025
175b050
DEVEXP-907: (Fax) OAS sync - Week 21 (#171)
asein-sinch May 28, 2025
c358b06
Fix verification e2e tests (#172)
asein-sinch Jun 6, 2025
aab8941
DEVEXP-951: (Numbers) OAS sync - Week 23 (#173)
asein-sinch Jun 7, 2025
25e794b
DEVEXP-962_Numbers API snippets (#174)
asein-sinch Jun 26, 2025
e1f6ee2
Update snippet (#178)
asein-sinch Jul 1, 2025
8a4bd6b
DEVEXP-1035: Retrofit fix refresh token in next version (#177)
asein-sinch Jul 2, 2025
e0fdb4f
DEVEXP-898: Support connectStream action (closed beta) (#162)
asein-sinch Jul 2, 2025
1a348b5
DEVEXP-1005: (Fax + Numbers) OAS sync - Week 25 (#179)
asein-sinch Jul 3, 2025
c782661
PR #179 leftovers (#181)
asein-sinch Jul 3, 2025
fc96d14
DEVEXP-1032: (Conversation) OAS sync - Week 27 (#180)
asein-sinch Jul 3, 2025
cdbcdff
DEVEXP-985: Warning for default region breaking change (#182)
asein-sinch Jul 4, 2025
872c4ba
Verification: sync e2e steps (#185)
asein-sinch Aug 11, 2025
b77fda5
Bugfix: Raise error for not OK file buffer response (#186)
asein-sinch Aug 11, 2025
661dbf8
DEVEXP-1076: (Verification) OAS sync - Week 32 (#187)
asein-sinch Aug 12, 2025
3582b8c
Prepare release 1.3 (#188)
asein-sinch Aug 13, 2025
9efde85
Merge branch 'main' into v1.3-next
asein-sinch Aug 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
* @asein-sinch @JPPortier @krogers0607 @Dovchik
* @asein-sinch @JPPortier @matsk-sinch
2 changes: 1 addition & 1 deletion .github/scripts/validate-audit-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ awk 'NR > 1 {print ","} {print}' audit-report.txt >> audit-report.json
echo ']}' >> audit-report.json

# Filter JSON array to remove jest and lerna's transitive dependencies as these dependencies are not used at runtime
jq '.vulnerabilities |= map(select(.data.resolution.path | type == "string" and (startswith("lerna") or startswith("jest") or startswith("@types/jest") or startswith("babel-jest") or startswith("eslint") or startswith("@cucumber")) | not))' audit-report.json > audit-report-filtered.json
jq '.vulnerabilities |= map(select(.data.resolution.path | type == "string" and (startswith("lerna") or startswith("jest") or startswith("@types/jest") or startswith("babel-jest") or startswith("eslint") or startswith("@typescript-eslint") or startswith("@cucumber")) | not))' audit-report.json > audit-report-filtered.json

# Fail the build if filtered JSON array contains audit advisories
if [ "$(jq '.vulnerabilities[] | select(.type == "auditAdvisory") | .type' audit-report-filtered.json | wc -l)" -gt 0 ]; then
Expand Down
12 changes: 12 additions & 0 deletions docs/snippets/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The project ID where are defined the resources you want to use.
SINCH_PROJECT_ID=

# The API key ID and secret to authenticate your requests to the Sinch API.
SINCH_KEY_ID=
SINCH_KEY_SECRET=

# The virtual phone number you have rented from Sinch or planning to rent.
SINCH_PHONE_NUMBER=

# The service plan ID for your Sinch account to configure the SMS plan associated with your virtual phone number.
SINCH_SERVICE_PLAN_ID=
33 changes: 33 additions & 0 deletions docs/snippets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SDK snippets

This package contains code snippets for the SDK documentation. The snippets are used to demonstrate how to use the SDK to call the supported APIs.

Snippets can be used as a starting point to use Sinch products from your own application.

## Requirements

- Node.js 18 or later
- [Sinch account](https://dashboard.sinch.com)

### Snippets execution settings
When executing a snippet, you will need to provide some information about your Sinch account (credentials, Sinch virtual phone number, ...)

This setting can be placed directly in the snippet source, or you can use an [environment file](.env), in which case the settings will be shared and used automatically by every snippet.

```shell
# Copy the .env.example file to .env
cp .env.example .env
```

### Running snippets

To run a snippet, you can use the `npm run` command followed by the name of the snippet. For example:

```shell
# Run the snippets to get the details about a Sinch number you own
npm run numbers:get
#Run the snippets to list the available regions where to rent a Sinch number from
npm run numbers:regions:list
```

You can find all the available snippets in the `package.json` file under the `scripts` section.
23 changes: 23 additions & 0 deletions docs/snippets/numbers/active-numbers/get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const phoneNumberToGet = process.env.SINCH_PHONE_NUMBER || 'MY_SINCH_PHONE_NUMBER';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const rentedNumber = await sinch.numbers.get({
phoneNumber: phoneNumberToGet,
});

console.log(`Rented number:\n${JSON.stringify(rentedNumber, null, 2)}`);
})();
26 changes: 26 additions & 0 deletions docs/snippets/numbers/active-numbers/list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const requestData = {
regionCode: 'US',
type: 'LOCAL',
};

console.log('List of numbers printed one by one:');
// Use the iterator and fetch data from all the pages automatically
for await (const rentedNumber of sinch.numbers.list(requestData)) {
console.log(JSON.stringify(rentedNumber, null, 2));
}
})();
21 changes: 21 additions & 0 deletions docs/snippets/numbers/active-numbers/release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const phoneNumber = process.env.SINCH_PHONE_NUMBER || 'MY_SINCH_PHONE_NUMBER';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const releasedNumber = await sinch.numbers.release({ phoneNumber });

console.log(`Released number:\n${JSON.stringify(releasedNumber, null, 2)}`);
})();
27 changes: 27 additions & 0 deletions docs/snippets/numbers/active-numbers/update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const phoneNumberToUpdate = process.env.SINCH_PHONE_NUMBER || 'MY_SINCH_PHONE_NUMBER';
const updatedDisplayName = 'Updated name with Sinch Node.js SDK';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const updatedNumber = await sinch.numbers.update({
phoneNumber: phoneNumberToUpdate,
updateActiveNumberRequestBody: {
displayName: updatedDisplayName,
},
});

console.log(`Updated number:\n${JSON.stringify(updatedNumber, null, 2)}`);
})();
23 changes: 23 additions & 0 deletions docs/snippets/numbers/available-numbers/check-availability.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const phoneNumberToCheck = 'A_PHONE_NUMBER_TO_CHECK';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const response = await sinch.numbers.checkAvailability({
phoneNumber: phoneNumberToCheck,
});

console.log(`Response:\n${JSON.stringify(response, null, 2)}`);
})();
29 changes: 29 additions & 0 deletions docs/snippets/numbers/available-numbers/rent-any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const servicePlanIdToAssociateWithTheNumber = process.env.SINCH_SERVICE_PLAN_ID || 'MY_SERVICE_PLAN_ID';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const response = await sinch.numbers.rentAny({
rentAnyNumberRequestBody: {
regionCode: 'US',
type: 'LOCAL',
smsConfiguration: {
servicePlanId: servicePlanIdToAssociateWithTheNumber,
},
},
});

console.log(`Rented number:\n${JSON.stringify(response, null, 2)}`);
})();
29 changes: 29 additions & 0 deletions docs/snippets/numbers/available-numbers/rent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const phoneNumberToBeRented = 'AVAILABLE_PHONE_NUMBER_TO_BE_RENTED';
const servicePlanIdToAssociateWithTheNumber = process.env.SINCH_SERVICE_PLAN_ID || 'MY_SERVICE_PLAN_ID';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const response = await sinch.numbers.rent({
phoneNumber: phoneNumberToBeRented,
rentNumberRequestBody: {
smsConfiguration: {
servicePlanId: servicePlanIdToAssociateWithTheNumber,
},
},
});

console.log(`Rented number:\n${JSON.stringify(response, null, 2)}`);
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const response = await sinch.numbers.searchForAvailableNumbers({
regionCode: 'US',
type: 'LOCAL',
});

console.log(`Available numbers to rent:\n${JSON.stringify(response, null, 2)}`);
})();
19 changes: 19 additions & 0 deletions docs/snippets/numbers/available-regions/list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const response = await sinch.numbers.availableRegions.list({});

console.log(`Available regions:\n${JSON.stringify(response, null, 2)}`);
})();
19 changes: 19 additions & 0 deletions docs/snippets/numbers/callback-configuration/get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const response = await sinch.numbers.callbacks.get({});

console.log(`Callback configuration:\n${JSON.stringify(response, null, 2)}`);
})();
25 changes: 25 additions & 0 deletions docs/snippets/numbers/callback-configuration/update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Sinch Node.js Snippet
* See: https://github.com/sinch/sinch-sdk-node/docs/snippets
*/
import { SinchClient } from '@sinch/sdk-core';
import * as dotenv from 'dotenv';
dotenv.config();

(async () => {
const projectId = process.env.SINCH_PROJECT_ID || 'MY_PROJECT_ID';
const keyId = process.env.SINCH_KEY_ID || 'MY_KEY_ID';
const keySecret = process.env.SINCH_KEY_SECRET || 'MY_KEY_SECRET';

const newHmacSecret = 'NEW_HMAC_SECRET';

const sinch = new SinchClient({ projectId, keyId, keySecret });

const response = await sinch.numbers.callbacks.update({
updateCallbackConfigurationRequestBody: {
hmacSecret: newHmacSecret,
},
});

console.log(`Updated callback configuration:\n${JSON.stringify(response, null, 2)}`);
})();
25 changes: 25 additions & 0 deletions docs/snippets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@sinch/code-snippets",
"version": "0.0.0",
"description": "Code snippets related to the Sinch Node.js SDK usage",
"author": "Sinch",
"private": true,
"type": "module",
"dependencies": {
"@sinch/sdk-core": "^1.3.0"
},
"scripts": {
"build": "tsc --noEmit",
"numbers:get": "node numbers/active-numbers/get.js",
"numbers:list": "node numbers/active-numbers/list.js",
"numbers:release": "node numbers/active-numbers/release.js",
"numbers:update": "node numbers/active-numbers/update.js",
"numbers:check-availability": "node numbers/available-numbers/check-availability.js",
"numbers:search-for-available-numbers": "node numbers/available-numbers/search-for-available-numbers.js",
"numbers:rent": "node numbers/available-numbers/rent.js",
"numbers:rent-any": "node numbers/available-numbers/rent-any.js",
"numbers:regions:list": "node numbers/available-regions/list.js",
"numbers:callback-config:get": "node numbers/callback-configuration/get.js",
"numbers:callback-config:update": "node numbers/callback-configuration/update.js"
}
}
20 changes: 20 additions & 0 deletions docs/snippets/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"strict": true,
"target": "es2020",
"module": "es2020",
"moduleResolution": "node",
"pretty": true,
"baseUrl": ".",
"noEmit": true,
"skipLibCheck": true
},
"include": [
"**/*.js"
],
"exclude": [
"node_modules"
]
}
4 changes: 2 additions & 2 deletions examples/integrated-flows-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"verification:app": "yarn compile && node dist/verification/app.js"
},
"dependencies": {
"@sinch/sdk-core": "^1.2.0",
"@sinch/sdk-core": "^1.3.0",
"@types/node": "^20.8.7",
"dotenv": "^16.3.1",
"inquirer": "^9.2.14",
"inquirer": "^12.9.1",
"typescript": "^5.2.2"
},
"devDependencies": {
Expand Down
Loading
Loading