Public Account Documentation6.9.0

Docs / FAQ / Developers FAQ

Developers FAQ

Table of Contents

General

Can I send messages based on users phone numbers?

Sending messages to users is done based on the user ID. The user ID is unique for each user and provided to you with any callback triggered by a user’s action. There is currently no option to send messages based on phone numbers.

Authentication Tokens

How do I get my token?

Your token is generated and provided to you during the Public Account creation process. As a Public Account administrator, you can always find the account token in the “edit info” page.

Can my token expire?

Tokens are permanent and do not expire unless changed by the Viber team.

Can I change my token?

Refreshing your token can only be done by Viber support team. If you believe your authentication token has been compromised please contact Viber support to get a new one.

Webhook

What happens if the webhook is not available?

In case the webhook is offline Viber will re-try to deliver the callback several times for up to an hour until HTTP status code 200 OK is received.

Can my Public Account have more than one webhook?

Only one webhook per Public Account is currently supported.

Can more than one Public Account use the same webhook?

The same webhook can be set for more than one Public Account.

Why am I not getting any callbacks to my webhook?

There are a few steps you can take if you’re not getting callbacks to your token:

Supported webhook certificates

The endpoint certificate authority should be on the Sun Java trusted root certificates list.

Account Subscribers

How do I get the user ID?

The user ID is available to you in all callbacks received from our server. Keep in mind that before you can message a user he must subscribe to your PA or send you a message.

Will the same user ID be valid when sending messages from all Public Accounts?

User ID is unique per user and per Public Account. This means that the same user will have different user IDs on each Public Account.

Can the user ID change or expire?

User IDs do not change or expire. Each user has a unique and permanent ID when communicating with a Public Account. The user ID will only change if the user activated Viber with a different number, as this will create a completely new Viber account. Keep in mind that the same user will have a different user ID on each Public Account.

Keyboards

What is the keyboards maximum size?

The maximum JSON size for all API requests is 30kb. The keyboard can contain up to 12 rows in portrait mode.

What happens if I send an invalid keyboard?

Most keyboard validations take place on the client. If the request is successfully sent to the client and then fails one of the client validations you will receive a “failed” callback. The flow for such a case will be as follows:

  1. Message is sent.
  2. Response with status 0 is received to indicate a successful request.
  3. The message reaches the client and fails client validation.
  4. Failed callback is sent to the webhook, containing the unique message token and a string explaining the failure.

I sent a few keyboards, which one will the user see?

Viber will always display the last keyboard sent to the user.