
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@sinch/voice
Advanced tools
This package contains the Sinch Voice SDK for Node.js for use with Sinch APIs. To use it, you will need a Sinch account. Please sign up or log in if you already have one.
We recommend to use this SDK as part of the @sinch/sdk-core
package in order to make the most out of all the Sinch products.
However, it's still possible to use this SDK standalone is you need to access the Voice API only.
npm install @sinch/voice
yarn add @sinch/voice
The Voice
API uses the Application Signed Request to authenticate against the server. You will need to provide the following credentials:
If you are using this SDK as part of the Sinch SDK (@sinch/sdk-core
) you can access it as the voice
property of the client that you would have instantiated.
import {
SinchClient,
ApplicationCredentials,
VoiceService,
Voice,
} from '@sinch/sdk-core';
const credentials: ApplicationCredentials = {
applicationKey: 'APPLICATION_ID',
applicationSecret: 'APPLICATION_SECRET',
};
// Access the 'voice' service registered on the Sinch Client
const sinch = new SinchClient(credentials);
const voiceService: VoiceService = sinch.voice;
// Build the request data
const requestData: Voice.TtsCalloutRequestData = {
ttsCalloutRequestBody: {
method: 'ttsCallout',
ttsCallout: {
destination: {
type: 'number',
endpoint: '+14045005000',
},
cli: '+14045001000',
locale: 'en-US',
text: 'Hello, this is a call from Sinch.',
},
},
};
// Use the 'voice' service registered on the Sinch client
const calloutResponse: Voice.GetCalloutResponseObj
= await voiceService.callouts.tts(requestData);
The SDK can be used standalone if you need to use only the Voice APIs.
import {
ApplicationCredentials
} from '@sinch/sdk-client';
import {
Voice,
VoiceService,
} from '@sinch/voice';
const credentials: ApplicationCredentials = {
applicationKey: 'APPLICATION_ID',
applicationSecret: 'APPLICATION_SECRET',
};
// Declare the 'voice' service in a standalone way
const voiceService = new VoiceService(credentials);
// Build the request data
const requestData: Voice.TtsCalloutRequestData = {
ttsCalloutRequestBody: {
method: 'ttsCallout',
ttsCallout: {
destination: {
type: 'number',
endpoint: '+14045005000',
},
cli: '+14045001000',
locale: 'en-US',
text: 'Hello, this is a call from Sinch.',
},
},
};
// Use the standalone declaration of the 'voice' service
const calloutResponse: Voice.GetCalloutResponseObj
= await voiceService.callouts.tts(requestData);
All the methods that interact with the Sinch APIs use Promises. You can use await
in an async
method to wait for the response, or you can resolve them yourself with then()
/ catch()
.
// Method 1: Wait for the Promise to complete (you need to be in an 'async' method)
let calloutResponse: Voice.GetCalloutResponseObj;
try {
calloutResponse = await voiceService.callouts.tts(requestData);
console.log(`callId = ${calloutResponse.callId}`);
} catch (error: any) {
console.error(`ERROR ${error.statusCode}: Impossible to make a TTS callout to the number ${requestData.ttsCalloutRequestBody.ttsCallout.destination.endpoint}`);
}
// Method 2: Resolve the promise
voiceService.callouts.tts(requestData)
.then(response => console.log(`callId = ${response.callId}`))
.catch(error => console.error(`ERROR ${error.statusCode}: Impossible to make a TTS call out to the number ${requestData.ttsCalloutRequestBody.ttsCallout.destination.endpoint}`));
Developer Experience team: devexp@sinch.com
FAQs
Sinch Voice API
We found that @sinch/voice demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.