Answer the question
In order to leave comments, you need to log in
Why doesn't viber work with share-phone in the desktop client?
I work with the api bot of the viber messenger.
There was a need to ask the user for his phone number.
The documentation describes how to do this with ActionType share-phone. I use the viber-bot-php php library and there is an example of how to do it:
$bot->getClient()->sendMessage(
(new \Viber\Api\Message\Text())
->setSender($botSender)
->setReceiver($event->getSender()->getId())
->setMinApiVersion(3)
->setText("We need your phone number")
->setKeyboard(
(new \Viber\Api\Keyboard())
->setButtons([
(new \Viber\Api\Keyboard\Button())
->setActionType('share-phone')
->setActionBody('phone_reply')
->setText('Send phone number')
])
)
);
Answer the question
In order to leave comments, you need to log in
TP nevertheless answered, only a week has passed, but that's the little things ...
We currently don't have this action type supported on desktop clients.
Our teams are discussing the possibility to add it in future versions. I'll update you if there are any news on the subject.
To still be able to use this action type, I suggest adding some sort of fallback, in which if the callback is returned without the number, explicitly ask for the user to enter it.
maybe it will be useful for someone
And how does the phone arrive? Is it also taken via $event->getMessage()->getText() ?
After the last update of Viber September 2020, information with a contact finally began to come from the Desktop client!
Already contains a phone number.
Good luck with bot building in Viber.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question