Comments (7)
You write exact same code in "Don't work" and "Work")
from viber-bot-php.
sorry. misspelling. :)
Don't work
->onConversation(function ($event) use ($bot, $botSender, $log) {
$log->info('onConversation ');
return (new \Viber\Api\Message\Text())
->setSender($botSender)
->setText('same text');
})
and nothing in the logs
from viber-bot-php.
it looks like you forgot to init $log variable
from viber-bot-php.
did not forget.
$log = new Logger('bot');
$log->pushHandler(new StreamHandler('/tmp/bot.log'));
try {
$bot = new Bot(['token' => $apiKey]);
$bot
->
etc.
from viber-bot-php.
Check you webserver access_log and error_log.
If access_log not contains HTTP 200 for this request - try to find records inside error_log.
from viber-bot-php.
I don't know if this is a Lib bug or what
I had the same bug in Laravel app.
This change helped me in onConversation event:
$bot
->onConversation(function ($event) use ($bot, $botSender) {
//I had to echo my json encoded message and die() to stop code execution. Nothing else returned the correct response
echo json_encode($this->defaultMessage);
die();
})
from viber-bot-php.
У меня проблема так и осталась. Событие срабатывает, но обратное сообщение пользователю не отправляется в любом виде... Подскажите, в чем может быть проблема?
$bot = new Bot(['token' => $apiKey]);
$bot
->onConversation(function ($event) use ($bot, $botSender, $log ) {
$log->info('onConversation ' . var_export($event, true));
$context = $event->getContext();
if ($context != "" && $context != null) {
add_with_referral($event->getSender()->getId(), $event->getSender()->getName(), $context);
} else {
add_user($event->getSender()->getId(), $event->getSender()->getName(), $log);
}
return (new \Viber\Api\Message\Text)
->setSender($botSender)
->setText("Can i help you?");
})
from viber-bot-php.
Related Issues (20)
- Отправка сообщений на почту
- Обновление зависимостей HOT 6
- Uncaught exception 'RuntimeException' with message 'Signature header not found'
- При нажатии на кнопку ее текст выводиться в чате HOT 1
- onConversation() dont send welcome message. HOT 1
- How to send one message to several people?
- Не работает setInputFieldState HOT 2
- Как добавить значение из массива в кнопки для вайбер бота HOT 1
- viber
- Как обрабатывать нажатие на кнопки?
- Misspelled Failure event classsproperty dsc
- Как отправить сразу несколько изображений!??
- Ссылка на телефон в сообщении
- [Viber Bug] Web hook URL query parameters
- Подскажите как отследить отписку? HOT 4
- There is a problem with return types while extending Bot class
- Перенос бота HOT 1
- Не подключает файлы autoload
- Как удалить старый вебхук
- java.util.concurrent.TimeoutException
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from viber-bot-php.