We are using the outbound voice API. We have successfully set up an application and are able to create an outbound call using a test NCCO: https://developer.nexmo.com/ncco/tts.json We are using the NodeJS SDK. However, we are not able to understand why the NCCOs must be accessed through URLs, instead of being supplied as a JSON object directly. Moreover, we are using the voice API to verify user accounts at our services. Once a user registers to our services, we give them the option to choose between a SMS or a phonecall to verify their accounts. Evidently, each user will receive a distinct code in their SMS/call (e.g., 1234). We would like to receive help on how to bypass the answer_url field, and be able to supply a distinct text-to-speech text, per user.
In brief, is there a way to, instead of supplying to the voice call API, a static JSON object through a public URL, supply a JSON object dynamically generated that contains a distinct code for the user?
Below is an example of the nexmo node method to generate an outbound call:
nexmo.calls.create({
to: [{
type: 'phone',
number: RECEIVING_NUMBER
}],
from: {
type: "phone",
number: NEXMO_VIRTUAL_NUMBER
},
answer_url: ['https://developer.nexmo.com/ncco/tts.json']
}, (err, res) => {
if(err) console.log(JSON.stringify(err,null,2));
else { console.log(res); }
})