Convert your Voice code from Tropo to Nexmo

« Back to overview

Keep reading to see a comparison of how Nexmo and Tropo compare for working with Voice messages.
Bear in mind that with Nexmo the code runs on your own server, whilst with Tropo you store your code on a Tropo platform.

Nexmo provide server-side libraries in six different libraries to help you integrate our platform more easily.
Head to the tools page to find out more.

Sign Up

Make an outbound call

When making a voice call with Tropo you provide the words to be spoken directly in your application. On the Nexmo platform, calls are controlled using an NCCO, which is a JSON file that tells the Nexmo voice API how to interact with the call.

In the example below, we use a static JSON file that returns a single talk action containing text which will be spoken in to the call.

[
  {
    "action": "talk",
    "voiceName": "Russell",
    "text": "You are listening to a test text-to-speech call made with Nexmo Voice API"
  }
]

Text-to-speech is just one of the many actions you can perform with the Nexmo voice API. You can record calls, stream audio, build interactive menus and more! Take a look at our NCCO documentation for more information.

Example code


Tropo

call("+611300975708");
say("You are listening to a test text-to-speech call made with Tropo Voice API");
call("+611300975708");
say("You are listening to a test text-to-speech call made with Tropo Voice API");
call("+611300975708")
say("You are listening to a test text-to-speech call made with Tropo Voice API");
call "+611300975708"
say "You are listening to a test text-to-speech call made with Tropo Voice API"

Nexmo

nexmo.calls.create({
  to: [{
    type: 'phone',
    number: '611300975708'
  }],
  from: {
    type: 'phone',
    number: NEXMO_NUMBER
  },
  answer_url: ['https://raw.githubusercontent.com/nexmo-community/ncco-examples/gh-pages/text-to-speech.json']
})
$call = $client->calls()->create([
    'to' => [[
        'type' => 'phone',
        'number' => '611300975708'
    ]],
    'from' => [
        'type' => 'phone',
        'number' => NEXMO_NUMBER
    ],
    'answer_url' => ['https://raw.githubusercontent.com/nexmo-community/ncco-examples/gh-pages/text-to-speech.json'],
]);

response = client.create_call({
  'to': [{'type': 'phone', 'number': '611300975708'}],
  'from': {'type': 'phone', 'number': NEXMO_NUMBER},
  'answer_url': ['https://raw.githubusercontent.com/nexmo-community/ncco-examples/gh-pages/text-to-speech.json']
})
response = client.calls.create(
  to: [{
    type: 'phone',
    number: '611300975708'
  }],
  from: {
    type: 'phone',
    number: NEXMO_NUMBER
  },
  answer_url: [
    'https://raw.githubusercontent.com/nexmo-community/ncco-examples/gh-pages/text-to-speech.json'
  ]
)


What's next?

Ready to get started? Here's some further reading to help you get started with the Nexmo platform

Tutorials

Work through some in depth use_case, covering common use cases

product: voice/voice-api

Code Snippets

Want to dive in to code? Take a look at our library of code snippets to get started quickly