N
N
Nikita Peterson2019-01-16 16:18:26
API
Nikita Peterson, 2019-01-16 16:18:26

How to send a message through the Viber button on the site?

There is a shop site. On the product page there is a button "Send to Viber", which should send information about the product of interest to the buyer to the store owner's Viber.
There is a function like viber://chat?number=+3753333333 but it only opens a dialog box. I looked at the API, but as far as I understood, the principle works there a little differently, the message is sent to the person who clicks the button.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2019-01-16
@dimonchik2013

and you into it
wrote?
If not, what stopped?

S
Siberian_Bear, 2019-01-17
@Siberian_Bear

You do not understand the very principle of sending messages to instant messengers. This is not sms/mail.
And this is normal, I also delved into it for a long time, there was no one who would suggest.
The saddest thing is that for the sake of a simple sneeze, you need to fully configure your platform to work with the bot.
Briefly, you need to do this:
1) create a bot in the interface. you will probably be the owner of the bot. Although this is incorrect, it is correct that the owner of the system / store would create.
2) integrate the bot into the system. be sure to set up hooks. those. create routes on which the viber itself will knock. write all incoming requests to hooks in the logs for testing (to see what the viber sends to you). can be written to the database.
3) When everything is set up, it should work like this: look for a bot from the owner’s viber account (open via link). send a message.
4) viber sends a hook to your system saying "such and such a participant has been added, sent you such and such a message, uid is such and such, now you can send messages to him."
5) and only after that you can send him messages to api, indicating this received uid.
6) messages, of course, you will send from the backend, and not via "viber://chat?number=+3753333333". Well, or from the front, but you'll figure it out yourself.
PS
1) as an example, in order to separate who is who from the incoming users, they are asked to enter a certain code in order to understand by the code: which client in the system = viber user.
2) Why is it so difficult: instant messengers are protected from spammers.
3) you can make a business account, it is simpler in terms of technology, but more difficult organizationally
4) it is still difficult to test - everything will work only on a public server, with httpS. Those. sometimes it is necessary to set up the site with a specialist.
5) Try Telegram, the principle is a little different there, it is much easier to implement such a one-time procedure with a single number. You can get a ready-made Uid without a code, and hardcode it already for displaying on api. If interested, I will write more.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question