Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viber REST API, how to find Unique Viber user id?

Tags:

api

postman

viber

Resource URL https://chatapi.viber.com/pa/send_message

General send message parameters

enter image description here

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}

like image 710
Aleksandra Avatar asked Dec 27 '17 08:12

Aleksandra


People also ask

How can I get Viber ID?

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.

Is Viber REST API free?

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.

How can I get Viber API key?

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.

What is Viber bot?

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.


1 Answers

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.

like image 111
Choletski Avatar answered Sep 28 '22 20:09

Choletski