Answer the question
In order to leave comments, you need to log in
How to authorize a user on the site through the Viber bot?
We are doing a project on Laravel, where user authorization via messengers is required.
We need to implement authorization through Viber in a similar way to the website of the migration service of Ukraine ( new coupon section ).
We made a bot, we were able to make a button that sends the user's phone number. But we can’t figure out how to transfer the user’s phone number to the site from the bot.
How exactly can you make the site catch the user's phone number and let you log in?
Answer the question
In order to leave comments, you need to log in
1) You enter a phone number to the bot.
2) The bot asks for an authorization token (it can be self-generated or permanent, this is secondary here) for a specific number,
3) If there is a number, then the bot proxies the link to the client, such as - /token-login?token=hard_token
4) when clicked, the server recognizes the client , and authorizes it with the method you have.
Update: as discussed with the author, this is most likely about using deep linking . The user follows the link, where some identifier or hash is passed to the context, then shares his phone number with the bot, and authorization is passed.
I leave the previous answer, as it may also be useful:
Viber Bot (nee Viber Public Account) does not allow sending messages to a phone number. To do this, you need to use Viber Business Messages (nee Viber Service Messages) through Viber partners.
The usual practice in this area is to send a message via Viber, then send a spare SMS after a timeout. This is called the buzzword "cascade". To increase reliability, you can also include WhatsApp in the cascade (and other channels sent by phone number, for example, mail.ru notify). But you can simply, when checking the user's number, offer him to choose the preferred channel for checking from the list (if it doesn't work, the user will try another channel on his own).
You need to be prepared for the fact that the cost of sending to Viber / WA by phone number is more expensive than SMS. Although it is customary to charge a message for messengers only upon successful delivery (undelivered ones are free), there is also a mandatory monthly payment (for Viber this is a requirement of Viber itself, for WhatsApp, most providers sell a minimum package of at least 5-10 thousand rubles, and those who do not they take a subscriber, even free messages are charged to cover their expenses).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question