New Node SDK
Client Initialization
- Old
- New
const username = process.env.BW_USERNAME;
const password = process.env.BW_PASSWORD;
const client = new Client({
basicAuthPassword: password,
basicAuthUserName: username
});
const controller = new ApiController(client);
const username = process.env.BW_USERNAME;
const password = process.env.BW_PASSWORD;
const config = new Configuration({
username,
password
});
const callsApi = new CallsApi(config);
const conferencesApi = new ConferencesApi(config);
// etc... for the other included APIs
Messaging
Create Message
- Old
- New
const response = await controller.createMessage(BW_ACCOUNT_ID, {
applicationId: BW_MESSAGING_APPLICATION_ID,
to: [USER_NUMBER],
from: BW_NUMBER,
text: 'text'
});
const messageRequest = {
to: [USER_NUMBER],
from: BW_NUMBER,
text: 'text',
applicationId: BW_MESSAGING_APPLICATION_ID,
tag: 'tag',
priority: 'high';,
expiration: new Date(Date.now() + 60).toISOString()
};
const { status, data } = await messagesApi.createMessage(BW_ACCOUNT_ID, messageRequest);
List Messages
- Old
- New
const messageId = '1589228074636lm4k2je7j7jklbn2';
const response = await controller.getMessages(BW_ACCOUNT_ID, messageId);
const { status, data } = await messagesApi.listMessages(
BW_ACCOUNT_ID,
undefined,
BW_NUMBER,
undefined,
undefined,
'OUBOUND'
);
Media
List Media
- Old
- New
const response = await controller.listMedia(BW_ACCOUNT_ID);
const { status, data } = await mediaApi.listMedia(BW_ACCOUNT_ID);
Get Media
- Old
- New
const mediaId = 'media-id-123.pdf';
const response = await controller.getMedia(BW_ACCOUNT_ID, mediaId);
const chunks = [];
for await (let chunk of response.result) {
chunks.push(chunk);
}
fs.writeFileSync('file-to-write.pdf', chunks[0], 'binary');
const mediaFileName = 'nodejs_media_file';
const { status, data } = await mediaApi.getMedia(BW_ACCOUNT_ID, mediaFileName);
fs.writeFile('./tests/fixtures/test.jpeg', Buffer.from(data), (err) => {
if (err) throw err;
});
Upload Media
- Old
- New
const mediaId = 'abc123.pdf';
const contents = Buffer.alloc(8);
const contentType = 'application/octet-stream';
const cacheControl = 'no-cache';
const response = await controller.uploadMedia(
BW_ACCOUNT_ID,
mediaId,
contents,
contentType,
cacheControl
);
const mediaFileName = 'nodejs_media_file';
const mediaFileData = fs.readFileSync('./nodejs.jpeg');
const { status } = await mediaApi.uploadMedia(
BW_ACCOUNT_ID,
mediaFileName,
mediaFileData
);
Delete Media
- Old
- New
const mediaId = 'abc12345-6def-abc1-2345-6defabc123451.mp3';
const response = await controller.deleteMedia(BW_ACCOUNT_ID, mediaId);
const mediaFileName = 'nodejs_media_file';
const { status } = await mediaApi.deleteMedia(BW_ACCOUNT_ID, mediaFileName);
BXML
Imports
- Old
- New
import {
Response,
Bxml,
Gather,
Bridge,
StopGather,
Response
// etc...
} from '@bandwidth/voice';
import { Bxml } from 'bandwidth-sdk';
Bridge
- Old
- New
var bridge = new Bridge({
callId: 'c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d',
bridgeCompleteUrl: 'https://test.com',
bridgeCompleteMethod: 'GET',
bridgeTargetCompleteUrl: 'https://test2.com',
bridgeTargetCompleteMethod: 'POST',
username: 'user',
password: 'pass',
tag: 'custom tag',
bridgeCompleteFallbackUrl: 'https://test3.com',
bridgeCompleteFallbackMethod: 'GET',
bridgeTargetCompleteFallbackUrl: 'https://test4.com',
bridgeTargetCompleteFallbackMethod: 'POST',
fallbackUsername: 'fuser',
fallbackPassword: 'fpass'
});
var response = new Response(bridge);
response.toBxml();
const attributes = {
bridgeCompleteUrl: 'https://initial.com',
bridgeCompleteMethod: 'POST',
bridgeCompleteFallbackUrl: 'https://initial.com',
bridgeCompleteFallbackMethod: 'POST',
bridgeTargetCompleteUrl: 'https://initial.com',
bridgeTargetCompleteMethod: 'POST',
bridgeTargetCompleteFallbackUrl: 'https://initial.com',
bridgeTargetCompleteFallbackMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword',
fallbackUsername: 'initialFallbackUsername',
fallbackPassword: 'initialFallbackPassword',
tag: 'initialTag'
};
const bridge = new Bxml.Bridge(
'c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d',
attributes
);
const response = new Bxml.Response(bridge);
response.toBxml();
Conference
- Old
- New
var conference = new Conference({
hold: true,
mute: true,
tag: 'tag1',
username: 'username',
password: 'pswd',
callIdsToCoach: ['id1', 'id2'],
conferenceEventMethod: 'POST',
conferenceEventUrl: 'https://example.com',
name: 'my-conference'
});
var response = new Response(conference);
response.toBxml();
const attributes = {
mute: true,
hold: true,
callIdsToCoach: 'initial',
conferenceEventUrl: 'https://initial.com',
conferenceEventMethod: 'POST',
conferenceEventFallbackUrl: 'https://initial.com',
conferenceEventFallbackMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword',
fallbackUsername: 'initialFallbackUsername',
fallbackPassword: 'initialFallbackPassword',
tag: 'initialTag',
callbackTimeout: 5.1
};
const conference = new Bxml.Conference('conferenceName', attributes);
const response = new Bxml.Response(conference);
response.toBxml();
Forward
- Old
- New
var forward = new Forward({
to: '+18888888888',
from: '+19999999999',
callTimeout: 3,
diversionTreatment: 'none',
diversionReason: 'away',
uui: '342342ef34%3Bencoding%3Dhex'
});
var response = new Response(forward);
response.toBxml();
const attributes = {
to: '+19195551234',
from: '+19195554321',
callTimeout: 5,
diversionTreatment: 'propagate',
diversionReason: 'user-busy',
uui: '93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt'
};
const forward = new Bxml.Forward(attributes);
const response = new Bxml.Response(forward);
response.toBxml();
Gather
- Old
- New
var speakSentence = new SpeakSentence({
sentence: 'test',
voice: 'susan',
gender: 'female',
locale: 'en_US'
});
var gather = new Gather({
gatherUrl: 'https://test.com',
gatherMethod: 'GET',
username: 'user',
password: 'pass',
tag: 'tag',
terminatingDigits: '123',
maxDigits: 3,
interDigitTimeout: 4,
firstDigitTimeout: 5,
audioProducers: [speakSentence]
});
var response = new Response(gather);
response.toBxml();
const attributes = {
gatherUrl: 'https://initial.com',
gatherMethod: 'POST',
gatherFallbackUrl: 'https://initial.com',
gatherFallbackMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword',
fallbackUsername: 'initialFallbackUsername',
fallbackPassword: 'initialFallbackPassword',
tag: 'initialTag',
terminatingDigits: '5',
maxDigits: 5,
interDigitTimeout: 5,
firstDigitTimeout: 5,
repeatCount: 5
};
const playAudio = new Bxml.PlayAudio('https://audio.url/audio1.wav');
const speakSentence = new Bxml.SpeakSentence(
'<lang xml:lang="es-MX">Hola</lang>nodejs speak sentence <emphasis>SSML test</emphasis>'
);
let gather = new Gather(attributes, playAudio);
gather.addAudioVerbs(speakSentence);
const response = new Bxml.Response(gather);
response.toBxml();
Hangup
- Old
- New
var hangup = new Hangup();
var response = new Response(hangup);
response.toBxml();
const hangup = new Bxml.Hangup();
const response = new Bxml.Response(hangup);
response.toBxml();
Pause
- Old
- New
var pause = new Pause({
duration: 3
});
var response = new Response(pause);
response.toBxml();
const attributes = {
duration: 5
};
const pause = new Bxml.Pause(attributes);
const response = new Bxml.Response(pause);
response.toBxml();
Pause Recording
- Old
- New
var pauseRecording = new PauseRecording();
var response = new Response(pauseRecording);
response.toBxml();
const pauseRecording = new Bxml.PauseRecording();
const response = new Bxml.Response(pauseRecording);
response.toBxml();
Play Audio
- Old
- New
var playAudio = new PlayAudio({
url: 'https://test.com',
username: 'user',
password: 'pass'
});
var response = new Response(playAudio);
response.toBxml();
const attributes = {
username: 'initialUsername',
password: 'initialPassword'
};
const playAudio = new Bxml.PlayAudio(
'https://audio.url/audio1.wav',
attributes
);
const response = new Bxml.Response(playAudio);
response.toBxml();
Record
- Old
- New
var record = new Record({
recordCompleteUrl: 'https://url.com',
recordCompleteMethod: 'POST',
recordingAvailableUrl: 'https://url.com',
recordingAvailableMethod: 'POST',
username: 'user',
password: 'pass',
tag: 'tag',
terminatingDigits: '123',
maxDuration: 3,
detectLanguage: true,
fileFormat: 'wav',
recordCompleteFallbackUrl: 'https://test.com',
recordCompleteFallbackMethod: 'GET',
fallbackUsername: 'fuser',
fallbackPassword: 'fpass'
});
var response = new Response(record);
response.toBxml();
const attributes = {
recordCompleteUrl: 'https://initial.com',
recordCompleteMethod: 'POST',
recordCompleteFallbackUrl: 'https://initial.com',
recordCompleteFallbackMethod: 'POST',
recordingAvailableUrl: 'https://initial.com',
recordingAvailableMethod: 'POST',
transcribe: true,
transcriptionAvailableUrl: 'https://initial.com',
transcriptionAvailableMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword',
fallbackUsername: 'initialFallbackUsername',
fallbackPassword: 'initialFallbackPassword',
tag: 'initialTag',
terminatingDigits: '5',
maxDuration: 5,
silenceTimeout: 5,
fileFormat: 'wav'
};
const record = new Bxml.Record(attributes);
const response = new Bxml.Response(record);
response.toBxml();
Redirect
- Old
- New
var redirect = new Redirect({
username: 'user',
password: 'pass',
redirectUrl: 'https://test.com',
redirectMethod: 'GET',
tag: 'tag',
redirectFallbackUrl: 'https://test2.com',
redirectFallbackMethod: 'POST',
fallbackUsername: 'fuser',
fallbackPassword: 'fpass'
});
var response = new Response(redirect);
response.toBxml();
const attributes = {
redirectUrl: 'https://initial.com',
redirectMethod: 'POST',
redirectFallbackUrl: 'https://initial.com',
redirectFallbackMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword',
fallbackUsername: 'initialFallbackUsername',
fallbackPassword: 'initialFallbackPassword',
tag: 'initialTag'
};
const redirect = new Bxml.Redirect(attributes);
const response = new Bxml.Response(redirect);
response.toBxml();
Resume Recording
- Old
- New
var resumeRecording = new ResumeRecording();
var response = new Response(resumeRecording);
response.toBxml();
const resumeRecording = new Bxml.ResumeRecording();
const response = new Bxml.Response(resumeRecording);
response.toBxml();
Ring
- Old
- New
var ring = new Ring({
duration: 3,
answerCall: false
});
var response = new Response(ring);
response.toBxml();
const attributes = {
duration: 5.1,
answerCall: true
};
const ring = new Bxml.Ring(attributes);
const response = new Bxml.Response(ring);
response.toBxml();
Send DTMF
- Old
- New
var sendDtmf = new SendDtmf({
dtmf: '123'
});
var response = new Response(sendDtmf);
response.toBxml();
const attributes = {
toneDuration: 5,
toneInterval: 5
};
const sendDtmf = new Bxml.SendDtmf('1234', attributes);
const response = new Bxml.Response(sendDtmf);
response.toBxml();
Speak Sentence
- Old
- New
var speakSentence = new SpeakSentence({
sentence:
'Hello, you have reached the home of <lang xml:lang="es-MX">Antonio Mendoza</lang>.Please leave a message.'
});
var response = new Response(speakSentence);
response.toBxml();
const attributes = {
voice: 'julie',
gender: 'female',
locale: 'en_US'
};
const speakSentence = new Bxml.SpeakSentence(
'<lang xml:lang="es-MX">Hola</lang>nodejs speak sentence <emphasis>SSML test</emphasis>',
attributes
);
const response = new Bxml.Response(speakSentence);
response.toBxml();
Start Gather
- Old
- New
var startGather = new StartGather({
dtmfUrl: 'https://test.com',
dtmfMethod: 'POST',
username: 'user',
password: 'pass',
tag: 'custom tag'
});
var response = new Response(startGather);
response.toBxml();
const attributes = {
dtmfUrl: 'https://initial.com',
dtmfMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword',
tag: 'initialTag'
};
const startGather = new Bxml.StartGather(attributes);
const response = new Bxml.Response(startGather);
response.toBxml();
Start Recording
- Old
- New
var startRecording = new StartRecording({
recordingAvailableUrl: 'https://url.com',
recordingAvailableMethod: 'POST',
username: 'user',
password: 'pass',
tag: 'tag',
fileFormat: 'wav',
multiChannel: false
});
var response = new Response(startRecording);
response.toBxml();
const attributes = {
recordingAvailableUrl: 'https://initial.com',
recordingAvailableMethod: 'POST',
transcribe: true,
transcriptionAvailableUrl: 'https://initial.com',
transcriptionAvailableMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword',
tag: 'initialTag',
fileFormat: 'wav',
multiChannel: true
};
const startRecording = new Bxml.StartRecording(attributes);
const response = new Bxml.Response(startRecording);
response.toBxml();
Start Stream
- Old
- New
var startStream = new StartStream({
destination: 'https://url.com',
streamEventMethod: 'POST',
username: 'user',
password: 'pass',
name: 'test',
tracks: 'inbound',
streamEventUrl: 'https://url.com'
});
var response = new Response(startStream);
response.toBxml();
const attributes = {
name: 'initialName',
tracks: 'inbound',
destination: 'https://initial.com',
streamEventUrl: 'https://initial.com',
streamEventMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword'
};
const streamParam1 = new Bxml.StreamParam({
name: 'streamParamName1',
value: 'streamParamValue1'
});
const streamParam2 = new Bxml.StreamParam({
name: 'streamParamName2',
value: 'streamParamValue2'
});
let startStream = new StartStream(attributes, streamParam1);
startStream.addStreamParams(streamParam2);
const response = new Bxml.Response(startStream);
response.toBxml();
Start Transcription
- Old
- New
// Not possible in V6 of node-voice.
const attributes = {
name: 'initialName',
tracks: 'inbound',
transcriptionEventUrl: 'https://initial.com',
transcriptionEventMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword',
destination: 'https://initial.com',
stabilized: true
};
const customParam1 = new Bxml.CustomParam({
name: 'customParamName1',
value: 'customParamValue1'
});
const customParam2 = new Bxml.CustomParam({
name: 'customParamName2',
value: 'customParamValue2'
});
let startTranscription = new StartTranscription(attributes, customParam1);
startTranscription.addCustomParams(customParam2);
const response = new Bxml.Response(startTranscription);
response.toBxml();
Stop Gather
- Old
- New
var stopGather = new StopGather();
var response = new Response(stopGather);
response.toBxml();
const stopGather = new Bxml.StopGather();
const response = new Bxml.Response(stopGather);
response.toBxml();
Stop Recording
- Old
- New
var stopRecording = new StopRecording();
var response = new Response(stopRecording);
response.toBxml();
const stopRecording = new Bxml.StopRecording();
const response = new Bxml.Response(stopRecording);
response.toBxml();
Stop Stream
- Old
- New
var stopStream = new StopStream({
name: 'test'
});
var response = new Response(stopStream);
response.toBxml();
const attributes = {
name: 'initialName'
};
const stopStream = new Bxml.StopStream(attributes);
const response = new Bxml.Response(stopStream);
response.toBxml();
Stop Transcription
- Old
- New
// Not possible in V6 of node-voice.
const attributes = {
name: 'initialName'
};
const stopTranscription = new Bxml.StopTranscription(attributes);
const response = new Bxml.Response(stopTranscription);
response.toBxml();
Tag
- Old
- New
var tag = new Tag({
value: 'tag'
});
var response = new Response(tag);
response.toBxml();
const tag = new Bxml.Tag('testTag');
const response = new Bxml.Response(tag);
response.toBxml();
Transfer
- Old
- New
var number1 = new Transfer.PhoneNumber({
number: '+17777777777',
transferAnswerUrl: 'https://test.com',
transferAnswerMethod: 'GET',
username: 'user',
password: 'pass',
tag: 'tag',
transferAnswerFallbackUrl: 'https://test2.com',
transferAnswerFallbackMethod: 'GET',
fallbackUsername: 'fuser',
fallbackPassword: 'fpass'
});
var sipUri = new Transfer.SipUri({
sipUri: 'sip-uri',
uui: 'uui',
transferAnswerUrl: 'https://test3.com',
transferAnswerMethod: 'POST',
username: 'user2',
password: 'pass2',
tag: 'tag2',
transferAnswerFallbackUrl: 'https://test4.com',
transferAnswerFallbackMethod: 'POST',
fallbackUsername: 'fuser2',
fallbackPassword: 'fpass4'
});
var transfer = new Transfer({
transferCallerId: '+18888888888',
callTimeout: 3,
tag: 'tagTransfer',
transferCompleteUrl: 'https://testtransfer.com',
transferCompleteMethod: 'GET',
username: 'usertransfer',
password: 'passtransfer',
diversionTreatment: 'none',
diversionReason: 'away',
transferCompleteFallbackUrl: 'https://test.com',
transferCompleteFallbackMethod: 'POST',
fallbackUsername: 'fusern',
fallbackPassword: 'fpassw',
phoneNumbers: [number1],
sipUris: [sipUri]
});
var response = new Response(transfer);
response.toBxml();
const attributes = {
transferCallerId: '+19195551234',
callTimeout: 5,
transferCompleteUrl: 'https://initial.com',
transferCompleteMethod: 'POST',
transferCompleteFallbackUrl: 'https://initial.com',
transferCompleteFallbackMethod: 'POST',
username: 'initialUsername',
password: 'initialPassword',
fallbackUsername: 'initialFallbackUsername',
fallbackPassword: 'initialFallbackPassword',
tag: 'initialTag',
diversionTreatment: 'propagate',
diversionReason: 'user-busy'
};
const phoneNumber = new Bxml.PhoneNumber('+19195551234');
const sipUri = new Bxml.SipUri('sip:1-999-123-4567@voip-provider.example.net');
let transfer = new Transfer(attributes, phoneNumber);
transfer.addTransferRecipients(sipUri);
const response = new Bxml.Response(transfer);
response.toBxml();
Calls
Create Call
- Old
- New
const response = await controller.createCall(BW_ACCOUNT_ID, {
applicationId: BW_VOICE_APPLICATION_ID,
to: USER_NUMBER,
from: BW_NUMBER,
answerUrl: BASE_CALLBACK_URL,
answerMethod: 'POST',
callTimeout: 30
});
const amdConfig = {
mode: 'async',
detectionTimeout: 5.0,
silenceTimeout: 5.0,
speechThreshold: 5.0,
speechendThreshold: 5.0,
delayResult: true,
callbackUrl: BASE_CALLBACK_URL + '/machineDetection',
callbackMethod: CallbackMethodEnum.Post
};
const callBody = {
applicationId: BW_VOICE_APPLICATION_ID,
to: USER_NUMBER,
from: BW_NUMBER,
displayName: 'NodeJS SDK',
answerUrl: `${BASE_CALLBACK_URL}/callbacks/answer`,
answerMethod: CallbackMethodEnum.Post,
disconnectUrl: `${BASE_CALLBACK_URL}/callbacks/disconnect`,
disconnectMethod: CallbackMethodEnum.Get,
machineDetection: amdConfig,
callTimeout: 30.0,
callbackTimeout: 15.0
};
const { status, data } = await callsApi.createCall(BW_ACCOUNT_ID, callBody);
Get Calls
- Old
- New
// Not Possible with V6 of node-voice.
const { status, data } = await callsApi.listCalls(BW_ACCOUNT_ID);
Get Call Information
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const response = await controller.getCall(BW_ACCOUNT_ID, callId);
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const { status, data } = await callsApi.getCallState(BW_ACCOUNT_ID, callId);
Update Call
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const response = await controller.modifyCall(BW_ACCOUNT_ID, callId, {
state: 'active',
redirectUrl: 'http://www.myapp.com/new'
});
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const updateCallBody = {
state: CallStateEnum.Active,
redirectUrl: `${BASE_CALLBACK_URL}/bxml/pause`
};
const { status: updateStatus } = await callsApi.updateCall(
BW_ACCOUNT_ID,
callId,
updateCallBody
);
Replace Call BXML
- Old
- New
// Not Possible with V6 of node-voice.
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const updateBxml =
'<?xml version="1.0" encoding="UTF-8"?><Bxml><SpeakSentence locale="en_US" gender="female" voice="susan">This is a test bxml response</SpeakSentence><Pause duration="3"/></Bxml>';
const { status: updateStatus } = await callsApi.updateCallBxml(
BW_ACCOUNT_ID,
callId,
updateBxml
);
Conferences
List Conferences
- Old
- New
const response = await controller.getConferences(BW_ACCOUNT_ID);
const { status, data } = await conferencesApi.listConferences(BW_ACCOUNT_ID);
Get Conference Information
- Old
- New
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const response = await controller.getConference(BW_ACCOUNT_ID, conferenceId);
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const { status, data } = await conferencesApi.getConference(
BW_ACCOUNT_ID,
conferenceId
);
Update Conference
- Old
- New
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const response = await controller.modifyConference(
BW_ACCOUNT_ID,
conferenceId,
{
status: 'active',
redirectUrl: 'http://www.myapp.com/new'
}
);
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const updateConferenceBody = {
status: ConferenceStateEnum.Active,
redirectUrl: `${BASE_CALLBACK_URL}/bxml/pause`,
redirectMethod: RedirectMethodEnum.Post,
username: 'username',
password: 'password',
redirectFallback_url: `${BASE_CALLBACK_URL}/bxml/pause`,
redirectFallback_method: RedirectMethodEnum.Post,
fallbackUsername: 'username',
fallbackPassword: 'password'
};
const { status } = await conferencesApi.updateConference(
BW_ACCOUNT_ID,
conferenceId,
updateConferenceBody
);
Update Conference BXML
- Old
- New
// Not Possible with V6 of node-voice.
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const updateBxml =
'<?xml version="1.0" encoding="UTF-8"?><Bxml><StartRecording/><SpeakSentence locale="en_US" gender="female" voice="susan">This should be a conference recording.</SpeakSentence><StopRecording/></Bxml>';
const { status } = await conferencesApi.updateConferenceBxml(
BW_ACCOUNT_ID,
conferenceId,
updateBxml
);
Get Conference Member
- Old
- New
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const memberId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const response = await controller.getConferenceMember(
BW_ACCOUNT_ID,
conferenceId,
memberId
);
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const memberId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const { status, data } = await conferencesApi.getConferenceMember(
BW_ACCOUNT_ID,
conferenceId,
memberId
);
Update Conference Member
- Old
- New
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const memberId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const response = await controller.modifyConferenceMember(
BW_ACCOUNT_ID,
conferenceId,
memberId,
{
mute: true,
callIdsToCoach: [
'c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d',
'c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f'
]
}
);
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const memberId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const updateConferenceMember = { mute: false };
const { status } = await conferencesApi.updateConferenceMember(
BW_ACCOUNT_ID,
conferenceId,
memberId,
updateConferenceMember
);
List Conference Recordings
- Old
- New
const conferenceId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const response = await controller.getConferenceRecordings(
BW_ACCOUNT_ID,
conferenceId
);
const conferenceId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const { status, data } = await conferencesApi.listConferenceRecordings(
BW_ACCOUNT_ID,
conferenceId
);
Get Conference Recording Information
- Old
- New
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const response = await controller.getConferenceRecording(
BW_ACCOUNT_ID,
conferenceId,
recordingId
);
const conferenceId = 'conf-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const { status, data } = await conferencesApi.getConferenceRecording(
BW_ACCOUNT_ID,
conferenceId,
recordingId
);
Download Conference Recording
- Old
- New
const conferenceId = 'conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const response = await controller.getDownloadConferenceRecording(
BW_ACCOUNT_ID,
conferenceId,
recordingId
);
const conferenceId = 'conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const { status, data } = await conferencesApi.downloadConferenceRecording(
BW_ACCOUNT_ID,
conferenceId,
recordingId
);
Recordings
List Account Call Recordings
- Old
- New
const response = await controller.getQueryCallRecordings(BW_ACCOUNT_ID);
const { status, data } =
await recordingsApi.listAccountCallRecordings(BW_ACCOUNT_ID);
Update Recording
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const response = await controller.modifyCallRecordingState(
BW_ACCOUNT_ID,
callId,
{
state: 'PAUSED'
}
);
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const pauseRecording = { state: RecordingStateEnum.Paused };
const { status } = await recordingsApi.updateCallRecordingState(
BW_ACCOUNT_ID,
callId,
pauseRecording
);
List Call Recordings
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const response = await controller.getCallRecordings(
BW_ACCOUNT_ID,
callId,
recordingId
);
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const { status, data } = await recordingsApi.listCallRecordings(
BW_ACCOUNT_ID,
callId
);
Get Call Recording
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const response = await controller.getCallRecording(
BW_ACCOUNT_ID,
callId,
recordingId
);
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const { status, data } = await recordingsApi.getCallRecording(
BW_ACCOUNT_ID,
callId,
recordingId
);
Delete Recording
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const response = await controller.deleteRecording(
BW_ACCOUNT_ID,
callId,
recordingId
);
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const { status } = await recordingsApi.deleteRecording(
BW_ACCOUNT_ID,
callId,
recordingId
);
Download Recording
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const response = await controller.getDownloadCallRecording(
BW_ACCOUNT_ID,
callId,
recordingId
);
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const { status, data } = await recordingsApi.downloadCallRecording(
BW_ACCOUNT_ID,
callId,
recordingId
);
Delete Recording Media
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const response = await controller.deleteRecordingMedia(
BW_ACCOUNT_ID,
callId,
recordingId
);
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const { status } = await recordingsApi.deleteRecordingMedia(
BW_ACCOUNT_ID,
callId,
recordingId
);
Get Transcription
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const response = await controller.getCallTranscription(
BW_ACCOUNT_ID,
callId,
recordingId
);
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const { status, data } = await recordingsApi.getCallTranscription(
BW_ACCOUNT_ID,
callId,
recordingId
);
Create Transcription Request
- Old
- New
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const response = await controller.createTranscribeCallRecording(
BW_ACCOUNT_ID,
callId,
recordingId,
{
callbackUrl: 'https://www.myapp.com/transcription'
}
);
const callId = 'c-abc12345-6defabc1-2345-6def-abc1-23456defabc1';
const recordingId = 'r-abc12345-6def-abc1-2345-6defabc12345';
const transcribeRecording = {
callbackUrl: `${BASE_CALLBACK_URL}/transcriptions`,
tag: callId
};
const { status } = await recordingsApi.transcribeCallRecording(
BW_ACCOUNT_ID,
callId,
recordingId,
transcribeRecording
);