Viber API Documentation7.1.0

Docs / FAQ / Developers FAQ

Developers FAQ

Table of Contents

Authentication Tokens

How do I get the account token?

Your token is generated and provided during the creation process. The account admin can find the token in the “edit info” page.

Can the account token expire?

Tokens will not expire unless you request a new token from the Viber team.

Can I change the account token?

Yes, but only in very specific circumstances. If you believe your token has been compromised you may request a new one from the Viber Support team.

Webhooks

What happens if the webhook is not available?

When a webhook appears offline, Viber will retry the callback several times for an hour until the HTTP code 200 OK is received.

Can an account have more than one webhook?

Each account can have only one webhook.

Can more than one account use the same webhook?

The same webhook can be used for more than one account.

Why am I not getting callbacks to my webhook?

If you are not receiving callbacks to your webhook, please check the following:

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’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 the same user ID valid when sending messages from all accounts?

The user ID is unique per user and per account. This means that the same user will have a different user ID for each account of your they message.

Can the user ID change or expire?

User IDs do not change or expire. Each user has a unique ID when they communicate with an account. The ID won’t change unless the user activates Viber with a different number (as this will be a new Viber account). Keep in mind that the same user will have a different ID for each account.

Keyboards

What is the maximum size for a keyboard?

The maximum JSON for all API requests is 30kb. The keyboard can contain up to 12 rows in portrait mode. Learn more about Viber’s keyboard requirements here.

What happens if I send an invalid keyboard?

Most keyboard valuations 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 in this case is 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.

General

What is the difference between a Public Account and a bot?

Both Public Accounts and bots are ways for you to interact with users through Viber. The differences between them are as follows:

The creation process for each is different, so when you know which one you want, follow the links below:

Are there specific requirements for a bot?

We request that all bots placed on Viber fulfil our criteria. Take a look at the checklist for bots here.

Can I send messages based on users phone numbers?

Messages are sent to users based on user ID rather than phone number.

Messages are sent to users based on their user ID when they perform an action which triggers a callback.

Unique user IDs are created as a combination of user and account, so the same user may have more than one ID if they are contacting more than one of your accounts.