tropo / tropo-webapi-php

A set of PHP classes for working with the Voxeo Tropo WebAPI
MIT License
94 stars 50 forks source link

Error creating outbound call json #69

Closed mkismy closed 6 years ago

mkismy commented 6 years ago

The sample shown in the document nor this sample file succeeds creating a outbound call json. Bellow are some samples I tried with the codes in this commit: 63d3725d41cc77af8c9c91c01a343e1819f89b23

Code1

$tropo = new Tropo();
$tropo->call("+14155550100");
$tropo->say("Tag, you're it!");
$tropo->RenderJson();

Result1

Fatal error: Uncaught exception 'Exception' with message 'When Argument 1 passed to Tropo::call() is a string, argument 2 passed to Tropo::call() must be of the type array.' in /Users/admin/Downloads/tropo-webapi-php-master/tropo.class.php:233
Stack trace:
#0 /Users/admin/Downloads/tropo-webapi-php-master/call-test.php(7): Tropo->call(Array)
#1 {main}
  thrown in /Users/admin/Downloads/tropo-webapi-php-master/tropo.class.php on line 233

OK. Lets make it an array.

Code2

$tropo = new Tropo();
$tropo->call(["+14155550100"]);
$tropo->say("Tag, you're it!");
$tropo->RenderJson();

Result2

Fatal error: Uncaught exception 'Exception' with message 'When Argument 1 passed to Tropo::call() is a string, argument 2 passed to Tropo::call() must be of the type array.' in /Users/admin/Downloads/tropo-webapi-php-master/tropo.class.php:233
Stack trace:
#0 /Users/admin/Downloads/tropo-webapi-php-master/call-test.php(7): Tropo->call(Array)
#1 {main}
  thrown in /Users/admin/Downloads/tropo-webapi-php-master/tropo.class.php on line 233

I give up 😕

Are these error caused due to api changes or is the document just incomplete?

mkismy commented 6 years ago

I contacted support and they told me they had made many changes to the SDK, but sample codes in GitHub and docs are not in maintenance. They shall be updating it soon.

They didn't affirm but it seems like the test codes are kind of up-to-date.

In the case above, the minimum code would be this:

$tropo = new Tropo();
$tropo->call("xxxxxxxxx", [ 'name' => 'foo' ]);
$tropo->say("Test can succeed!", [ 'name' => 'foo' ]);
$tropo->RenderJson();