jambonz Node.js SDK

The jambonz Node.js SDK is one of the simplest and most powerful ways to build jambonz applications.

The video below provides a walk-through of how to create an application using the create-jambonz-app utility, and then gives examples of building various webhooks applications that include collecting speech or dtmf input as well as integration with Google Dialogflow and AWS Lex V2.

Up and running

As mentioned above, the create-jambonz-app will scaffold you an express-based app that provides a great starting point.

If you prefer to use a different http server, or you need to integrate the jambonz webhooks into an existing Node.js application, then you simply need to install @jambonz/node-client in your application.

npm install --save @jambonz/node-client

If your application just needs to respond to webhooks, you can include it like this:

const {WebhookResponse} = require('@jambonz/node-client');

If your application also needs to make REST API calls, you can include it like this:

const jambonz = require('@jambonz/node-client');
const {WebhookResponse} = jambonz;
const client = jambonz('your-account-sid', 'your-api-key', {baseUrl: 'https://jambonz.cloud'});

Note: if you are running a self-hosted system, replace https://jambonz.cloud in the above with the appropriate URL of your own jambonz system.

How to use it - Webhooks

Responding to webhooks is quite simple:

router.post('/', (req, res) => {
  const app = new WebhookResponse();
    .pause({length: 1.5})
      text 'hi there, and welcome to jambonz!'

The WebhookResponse instance offers methods corresponding to each of the jambonz verbs, so for the example above you can see the possible options for the pause verb here, and for the say verb here. After adding all of the verbs that you want to execute, in the order that you want them to happen, simply return the app object in the 200 OK to the HTTP request.

How to use it - REST API

To making a REST API call simply use the client object we showed how to create earlier:

await client.calls.update(req.body.call_sid, {mute_status: 'mute'});

Documentation for the REST API can be found here.