Viber API Documentation7.3.0

Docs / Tools / Share Button

Viber Share Button

Viber provides a custom URL scheme to help your mobile website visitors share your content via a Viber message.

Sharing (forwarding) a message

To perform this action use the following URL scheme

viber://forward?text=<Your Text>  

How does it work?

With the Viber Share button you can share content directly on Viber.

Once your website user selects the Viber Share button, a predefined text and the current page’s url can be sent to any Viber contact selected by your user.

The user will either be able to edit the text or simply send it without making any changes.

Setting up the Viber Share button

In order to setup the Viber Share button, follow the instructions below:

1. Download Viber Share button kit.
2. Place the following code in the page you want to integrate the Viber Share button:

<a id="viber_share">Click</a>
<script>
    var buttonID = "viber_share";
    var text = "Check this out: ";
    document.getElementById(buttonID)
        .setAttribute('href',"viber://forward?text=" + encodeURIComponent(text + " " + window.location.href));
</script>

3. Choose one of our Viber Share button images and place it on your website within the <a> tag.
4. To change the sharing text, change the text variable:

var text = "Check this out: ";

5. Optional: In case you are already using a viber_share variable on your website, you can change the variable to any ID.

Troubleshooting