Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorException: Undefined index: url in file ViberDriver.php on line 202 #5

Open
EduardMalik opened this issue Jul 3, 2020 · 7 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@EduardMalik
Copy link

EduardMalik commented Jul 3, 2020

Hello @polyskalov

When i start conversation for example, i use ExampleConversation from botman studio default create:

    $question = Question::create("Huh - you woke me up. What do you need?")
        ->fallback('Unable to ask question')
        ->callbackId('ask_reason')
        ->addButtons([
            Button::create('Tell a joke')->value('joke'),
            Button::create('Give me a fancy quote')->value('quote'),
        ]);

    return $this->ask($question, function (Answer $answer) {
        if ($answer->isInteractiveMessageReply()) {
            if ($answer->getValue() === 'joke') {
                $joke = json_decode(file_get_contents('http://api.icndb.com/jokes/random'));
                $this->say($joke->value->joke);
            } else {
                $this->say(Inspiring::quote());
            }
        }
    });

ViberDriver not start conversation, and i see Excception:

    ErrorException: Undefined index: url in file /home/hotadd/www/chatbot/vendor/polyskalov/botman-viber-driver/src/ViberDriver.php on line 202

Stack trace:

  1. ErrorException->() /home/hotadd/www/chatbot/vendor/polyskalov/botman-viber-driver/src/ViberDriver.php:202
  2. Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() /home/hotadd/www/chatbot/vendor/polyskalov/botman-viber-driver/src/ViberDriver.php:202
  3. TheArdent\Drivers\Viber\ViberDriver->convertQuestion() /home/hotadd/www/chatbot/vendor/polyskalov/botman-viber-driver/src/ViberDriver.php:241
  4. TheArdent\Drivers\Viber\ViberDriver->buildServicePayload() /home/hotadd/www/chatbot/vendor/botman/botman/src/BotMan.php:642
  5. BotMan\BotMan\BotMan->reply() /home/hotadd/www/chatbot/vendor/botman/botman/src/Messages/Conversations/Conversation.php:66
  6. BotMan\BotMan\Messages\Conversations\Conversation->ask() /home/hotadd/www/chatbot/app/Conversations/ExampleConversation.php:35
  7. App\Conversations\ExampleConversation->askReason() /home/hotadd/www/chatbot/app/Conversations/ExampleConversation.php:43
  8. App\Conversations\ExampleConversation->run() /home/hotadd/www/chatbot/vendor/botman/botman/src/Traits/HandlesConversations.php:28
  9. BotMan\BotMan\BotMan->startConversation() /home/hotadd/www/chatbot/app/Http/Controllers/BotManController.php:40
  10. App\Http\Controllers\BotManController->startConversation() /home/hotadd/www/chatbot/vendor/botman/botman/src/BotMan.php:495
  11. call_user_func_array() /home/hotadd/www/chatbot/vendor/botman/botman/src/BotMan.php:495
  12. BotMan\BotMan\BotMan->callMatchingMessages() /home/hotadd/www/chatbot/vendor/botman/botman/src/BotMan.php:425
  13. BotMan\BotMan\BotMan->listen() /home/hotadd/www/chatbot/routes/botman.php:18

Can you look this? Many thanks!

@polyskalov polyskalov added the bug Something isn't working label Jul 3, 2020
@polyskalov
Copy link
Owner

Thank! Yeah sure i look at it next week

@rajendrap123
Copy link

@polyskalov let us know when you have fix for it, thanks for your efforts.

@polyskalov
Copy link
Owner

Guys, sorry for the delay. I'll try to fix it today or tomorrow

I fixed an error from this issue (not committed yet), but sending messages from the example doesn't work.

@rajendrap123
Copy link

rajendrap123 commented Jul 9, 2020 via email

@EduardMalik
Copy link
Author

Hello @polyskalov.
Is there any news on this issue?

@polyskalov
Copy link
Owner

@EduardMalik No, it's something weird. The function inside the driver does not send an incoming message in the parameter, so I cannot get the sender ID to send the message back.

I don't know why, it's taken a long time. If someone can help me determine the reason, or test it, I'd really appreciate it.

@polyskalov polyskalov added the help wanted Extra attention is needed label Jul 21, 2020
@YaroslavKozhemiaka
Copy link

YaroslavKozhemiaka commented Oct 22, 2020

Hello @polyskalov, @EduardMalik.
This error triggered when you try to send question instance without actions.
Example:

$question = Question::create("What animal pearson are you?")
            ->addButtons(
                [
                    Button::create("I like cats.")->value("cat"),
                    Button::create("I like dogs.")->value("dog")
                ]
            );

print_r - question argument method convertQuestion

Array
(
    [0] => Array
        (
            [name] => I like cats.
            [text] => I like cats.
            [image_url] => 
            [type] => button
            [value] => cat
            [additional] => Array
                (
                )

        )

    [1] => Array
        (
            [name] => I like dogs.
            [text] => I like dogs.
            [image_url] => 
            [type] => button
            [value] => dog
            [additional] => Array
                (
                )

        )

)

As you can see we haven't key url, which we try to call in line 202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants