Business Communications is an API for creating, managing, and launching agents for Google's Verified SMS and Business Messages platforms.
Documentation
The documentation for the Business Commmunications API can be found here.
Quickstart
Before you begin
- Register with Business Messages.
- Once registered, follow the instructions to enable the APIs for your project.
Installing the client library
npm install businesscommunications
Using the client library
function initClientLibrary(serviceAccountFile) {
const {google} = require('googleapis');
const businesscommunications = require('businesscommunications');
const scopes = [
'https://www.googleapis.com/auth/businesscommunications',
];
const privatekey = require(serviceAccountFile);
let authClient = new google.auth.JWT(
privatekey.client_email,
null,
privatekey.private_key,
scopes,
);
let bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({}, google);
return new Promise(function(resolve, reject) {
authClient.authorize(function(err, tokens) {
if (err) {
console.log('Error initiatizing library.');
} else {
resolve({authClient: authClient, bcApi: bcApi});
}
});
});
}
const apiConnector = initClientLibrary('your-service-account-key-file-location');
apiConnector.then((apiObject) => {
const apiParams = {
auth: apiObject.authClient,
resource: {
displayName: 'Test Brand',
},
};
apiObject.bcApi.brands.create(apiParams, {}, (err, response) => {
if (err !== undefined && err !== null) {
console.log('Error creating brand: ' + err);
} else {
console.log(response.data);
}
});
});
Samples
See code examples to see example
usage for most API features. The samples' README.md
has instructions for running the samples.
Versioning
This library follows Semantic Versioning.
This library is considered to be General Availability (GA). This means it
is stable; the code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues and requests against GA libraries
are addressed with the highest priority.
Contributing
Contributions welcome! See the Contributing Guide.
License
Apache Version 2.0
See LICENSE