Handling Voice Calls

Learn how to build scalable Voice applications using the Elarian customer engagement framework.

Calling

const customer = new client.Customer({
    number: 'YOUR-CUSTOMERS-PHONE-NUMBER',
    provider: 'cellular'
});
const resp = await customer.sendMessage(
  {
    number: 'YOUR-VOICE-NUMBER',
    channel: 'voice'
  },
  {
    body: {
        voice: [{
            say: {
                text: 'Hello There!',
                voice: 'male'
            }
        }]
    }
  }
);

Receiving

client.on('voiceCall', async (notification, customer, appData, callback) => {
  console.log(event);

  const actions = [{
    say: {
      text: 'Hello world!',
      voice: 'male'
    },
  }];

  callback(actions, appData);
});