Node.js SDK

The Node.js SDK(s) are available via NPM & GitHub.

Links Description Github
@bandwidth/numbers Manage phone numbers and account settings
@bandwidth/voice Create outbound phone calls and manage call media (recordings/transcriptions)
@bandwidth/messaging Create outbound messages and manage message media (MMS)
@bandwidth/mfa Create Multifactor Auth calls or messages
@bandwidth/webrtc Create and manage WebRTC Sessions N/A
Code Examples NodeJS code examples

Release notes

Messaging

Version Notes
3.0.0 Updated to TypeScript and reduced model verbosity
2.0.0 Removed all messaging exceptions and normalized them under MessagingException

Voice API

Version Notes
1.2.0 Added Conferencing API endpoints
1.3.0 Added conference detail endpoints
1.4.0 Added conference management endpoints

Numbers

Version Notes
1.1.0 Added import tn functionality, added promise based Async functions
1.2.0 Added CSR lookup functionality
1.2.1 Fixed Subscription List functionality. Example code at: examples/subscription_list_and_delete
1.2.2 Readme Typo for RemoveImportedTnOrder

MFA

Version Notes
1.0.0 First release
1.1.0 Updated schema with digits and expirationTimeInMinutes
2.0.0 Removed from and digits from TwoFactorVerifyRequestSchema

WebRTC

Version Notes
0.1.0 Alpha release
0.2.0 Updated Permission schema
0.3.0 Updated server to fix URL encoding

Download & Install

npm install @bandwidth/messaging
npm install @bandwidth/voice

Create Phone Call

import { Client, ApiController } from '@bandwidth/voice';

const client = new Client({
    basicAuthPassword: 'password',
    basicAuthUserName: 'username'
});

const controller = new ApiController(client);

const accountId = '1111111';

const response = await controller.createCall(accountId, {
    applicationId: 'abc12345-6def-abc1-2345-6defabc12345',
    from: '+19999999999',
    to: '+18888888888',
    answerUrl: 'https://your-server.com/webhooks/answer',
    answerMethod: 'POST',
    callTimeout: 30
});

console.log(response);

Generate BXML

import { SpeakSentence, Response } from '@bandwidth/voice';

const speakSentence = new SpeakSentence({
    sentence: 'This is a spoken test.',
    locale: 'en_US'
    voice: 'susan',
    gender: 'female'
});

const response = new Response(speakSentence);

console.log(response.toBxml());

Send Text Message

import { Client, ApiController } from '@bandwidth/messaging';

const client = new Client({
    basicAuthPassword: 'password',
    basicAuthUserName: 'username'
});

const controller = new ApiController(client);

const accountId = '1111111';

const response = await controller.createMessage(accountId, {
    applicationId: 'abc12345-6def-abc1-2345-6defabc12345',
    to: ['+19999999999'],
    from: '+18888888888',
    text: 'The quick brown fox jumps over the lazy dog.'
});

console.log(response);

results matching ""

    No results matching ""