S
S
Sergi0Limit2019-06-26 11:21:17
PHP
Sergi0Limit, 2019-06-26 11:21:17

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')
                ])
    )
);

the code works without problems, the user receives a request to receive a phone in the form of a button, and two scenarios work here:
1. if the user pressed the button on the desktop, then the bot receives a phone_reply response without information about the contact 5d1328dbba857154811790.png
2. if the user did the same on the mobile client - contact information comes 5d1328ea28173575225983.png
in both cases, current versions of clients are used, the platform also does not affect the response windows / mac - desktop client and ios / android - mobile client
tp viber is silent [email protected], if it is there at all.
How did you resolve this issue?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergi0Limit, 2019-06-26
@Sergi0Limit

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

N
N13, 2019-09-06
@N13

And how does the phone arrive? Is it also taken via $event->getMessage()->getText() ?

D
Denis BotViber, 2019-12-29
@cellmon

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 question

Ask a Question

731 491 924 answers to any question