Resource URL https://chatapi.viber.com/pa/send_message
General send message parameters
I am trying to send message to viber from Postman. I don't know how to find Unique Viber user id, that parameter is required.
I am getting this error:
{"status":999,"status_message":"Bad receiver ID","message_token":5126721184521938239}
How do I get the user's ID? The user ID is available in all callbacks received from our server. Remember that a user must have subscribed to your account or sent you a message before you can message them.
Viber's bot platform is open and free for developers to create bots in our ecosystem. Once you've created your bot you are welcome to share it with your Viber contacts or promote it outside Viber on your website or social media channels using a deeplink.
Once your application has been approved, Viber will send you a message inviting you to create a bot. Follow the URL to create Public Account. Once you are done with Public Account details, you will be asked to choose chat solution. Select 'Viber Chat API' to get your app key.
Thus, Viber Bots are not phone number-based chats but are based on anonymized Viber-generated IDs. You receive this unique Viber ID, which enables you to communicate with them. Viber Bots use session-based communication. A session starts when an end user sends a message to your Viber Bot.
Danny Dainton mentioned the docs on how you can get data including unique ID about your own account not about somebody else!
You'll receive callbacks containing user unique ID to your webhook if a user subscribes to your public account, and ONLY THEN you'll be able to send message to that user.
As per viber docs:
The send_message API allows accounts to send messages to Viber users who subscribe to the account. Sending a message to a user will be possible only after the user has subscribed to the Public Account by pressing the subscribe button or by sending a message, or by sending a message to a bot (see subscribed callback for additional information).
and VERY IMPORTANT
Before an account can send messages to a user, the user will need to subscribe to the account. Subscribing can take place in one of two ways:
User sends message to the account (both Public Accounts and bots)
when a user sends its first message to a account the user will be automatically subscribed to the account. Sending the first message will not trigger a subscribe callback, only a message callback (see receive message from user section). Subscribed event is sent to the Public Account (Public Accounts only)
user clicks a subscribe button which triggers the subscribe callback as described below.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With