npm install @bandwidth/messagingIn order to setup authentication in the API client, you need the following information.
| Parameter | Description |
|---|---|
| basicAuthUserName | The username to use with basic authentication |
| basicAuthPassword | The password to use with basic authentication |
API client can be initialized as following:
const BandwidthMessaging = require('@bandwidth/messaging');
// Configuration parameters and credentials
BandwidthMessaging.Configuration.basicAuthUserName = "apitoken"; // The username to use with basic authentication
BandwidthMessaging.Configuration.basicAuthPassword = "apisecret"; // The password to use with basic authenticationThe singleton instance of the APIController class can be accessed from the API Client.
var controller = BandwidthMessaging.APIController;createMessage
function createMessage(userId, body, callback)| Parameter | Tags | Description |
|---|---|---|
| userId | Required |
TODO: Add a parameter description |
| body | Optional |
TODO: Add a parameter description |
var userId = 'userId';
var body = new BandwidthMessaging.MessageRequest({"key":"value"});
controller.createMessage(userId, body, function(error, response, context) {
});| Error Code | Error Description |
|---|---|
| 400 | 400 Request is malformed or invalid |
| 401 | 401 The specified user does not have access to the account |
| 403 | 403 The user does not have access to this API |
| 404 | 404 Path not found |
| 415 | 415 The content-type of the request is incorrect |
| 429 | 429 The rate limit has been reached |
listMedia
function listMedia(userId, continuationToken, callback)| Parameter | Tags | Description |
|---|---|---|
| userId | Required |
TODO: Add a parameter description |
| continuationToken | Optional |
TODO: Add a parameter description |
var userId = 'userId';
var continuationToken = 'Continuation-Token';
controller.listMedia(userId, continuationToken, function(error, response, context) {
});| Error Code | Error Description |
|---|---|
| 400 | 400 Request is malformed or invalid |
| 401 | 401 The specified user does not have access to the account |
| 403 | 403 The user does not have access to this API |
| 404 | 404 Path not found |
| 415 | 415 The content-type of the request is incorrect |
| 429 | 429 The rate limit has been reached |
getMedia
function getMedia(userId, mediaId, callback)| Parameter | Tags | Description |
|---|---|---|
| userId | Required |
TODO: Add a parameter description |
| mediaId | Required |
TODO: Add a parameter description |
var userId = 'userId';
var mediaId = 'mediaId';
controller.getMedia(userId, mediaId, function(error, response, context) {
});| Error Code | Error Description |
|---|---|
| 400 | 400 Request is malformed or invalid |
| 401 | 401 The specified user does not have access to the account |
| 403 | 403 The user does not have access to this API |
| 404 | 404 Path not found |
| 415 | 415 The content-type of the request is incorrect |
| 429 | 429 The rate limit has been reached |
uploadMedia
function uploadMedia(userId, mediaId, contentLength, body, contentType, cacheControl, callback)| Parameter | Tags | Description |
|---|---|---|
| userId | Required |
TODO: Add a parameter description |
| mediaId | Required |
TODO: Add a parameter description |
| contentLength | Required |
TODO: Add a parameter description |
| body | Required |
TODO: Add a parameter description |
| contentType | Optional |
TODO: Add a parameter description |
| cacheControl | Optional |
TODO: Add a parameter description |
var userId = 'userId';
var mediaId = 'mediaId';
var contentLength = 217;
var body = 'body';
var contentType = 'Content-Type';
var cacheControl = 'Cache-Control';
controller.uploadMedia(userId, mediaId, contentLength, body, contentType, cacheControl, function(error, response, context) {
});| Error Code | Error Description |
|---|---|
| 400 | 400 Request is malformed or invalid |
| 401 | 401 The specified user does not have access to the account |
| 403 | 403 The user does not have access to this API |
| 404 | 404 Path not found |
| 415 | 415 The content-type of the request is incorrect |
| 429 | 429 The rate limit has been reached |
deleteMedia
function deleteMedia(userId, mediaId, callback)| Parameter | Tags | Description |
|---|---|---|
| userId | Required |
TODO: Add a parameter description |
| mediaId | Required |
TODO: Add a parameter description |
var userId = 'userId';
var mediaId = 'mediaId';
controller.deleteMedia(userId, mediaId, function(error, response, context) {
});| Error Code | Error Description |
|---|---|
| 400 | 400 Request is malformed or invalid |
| 401 | 401 The specified user does not have access to the account |
| 403 | 403 The user does not have access to this API |
| 404 | 404 Path not found |
| 415 | 415 The content-type of the request is incorrect |
| 429 | 429 The rate limit has been reached |

