Overview

The Viber card has 1 template orientation options:

  1. Vertical card

The vertical card contains the following elements:

  • Title text
  • Subtitle text
  • Image: image in a vertical card is displayed as a horizontal image at the top of the card with aspect ratio of 2:1, 16:9, or 7:3.
  • Buttons with the following actions:
    • Link
    • Publish text

JSON Template Properties

Property Name Description Type Required
type Types of basic elements supported by Structured Content framework. If using Viber Cards — type of header element should always be set to "vertical". If using Viber Carousels — type of header element will always be “carousel” Enum Y
tag Tag of template view, must be “generic” for Viber rich content templates. Within basic element objects, will be “title”/”subtitle”, which will indicate what text should be rendered in each of those elements (the title and subtitle have a default style in Viber) Enum Y
elements Array of elements/templates. By using elements in your structured content template, you can send basic elements, such as simple text, images or buttons Elements/Templates Y
text The message text in a “text” type element String Y
tooltip Element tooltip. Used also for aira String N
url Image URL in a “image” type element String Y
style Basic structured content elements style object. (Only applies to text and button elements) Style elements N
color Defines what the text color of the element will be. String #000000
background-color Defines what the background color of the element will be. (Only applies to buttons) String #000000
button Buttons contain click and action properties that define the type of action set on user click operation Object N
click Click objects contain the action type set on the click operation for each button Object N
action Actions are a list of applicative user actions on buttons, which will run on the consumer side and will help them to achieve their operation. Button actions for Viber cards and carousels can be set to Publish text or Link Enum - “publishText”, “link” N

Code Examples

Vertical Card

{
  "type": "vertical",
  "tag": "generic",
  "elements": [
    {
      "type": "vertical",
      "elements": [
        {
          "type": "image",
          "url": "https://i.pinimg.com/736x/a0/67/5e/a0675e5161d7ae5be2550987f397a641--flower-shops-paper-flowers.jpg",
          "tooltip": "Flowers"
        },
        {
          "type": "text",
          "tag": "title",
          "text": "Birthday Bouquet",
          "tooltip": "Title",
          "style": {
            "color": "#FFFFFF"
          }
        },
        {
          "type": "text",
          "tag": "subtitle",
          "text": "Wild flowers",
          "tooltip": "subtitle",
          "style": {
            "color": "#000000"
          }
        },
        {
          "type": "button",
          "tooltip": "Publish text example",
          "title": "Publish text example",
          "style": {
            "color": "#FFFFFF",
            "background-color": "#000000"
          },
          "click": {
            "actions": [
              {
                "type": "publishText",
                "text": "Published text button tap"
              }
            ]
          }
        },
        {
          "type": "button",
          "tooltip": "URL button example",
          "title": "URL button example",
          "click": {
            "actions": [
              {
                "type": "link",
                "name": "URL button tap",
                "uri": "https://www.pinterest.com/lyndawhite/beautiful-flowers/"
              }
            ]
          }
        }
      ]
    }]}