Usage samples: Viber

πŸ‘

Please see ChatApps Send API for the full API reference.

Sending a Text Message

Text only

{
    "user": {
        "msisdn": "+6500000"
    },
    "clientMessageId": "<optionalClientMessageId>",
    "type": "text",
    "content": {
        "text": "Here is your booking reference: ABC1234. For more information, visit https://8x8.com/1234!",
        "sms": {
            "encoding": "AUTO",
            "source": "<SENDERID>"
        }
    }
}

The corresponding message the user will receive:

Viber text message including URL

Viber text messages can include URL


Sending a Rich Media Message

Image only

{
    "user": {
        "msisdn": "+6500000"
    },
    "clientMessageId": "<optionalClientMessageId>",
    "type": "image",
    "content": {
        "url": "https://www.redbrick.sg/wp-content/uploads/2020/04/coleen-rivas-OZ2rS2zCjNo-unsplash-1125x1500.jpg",
        "fallbackText": "We tried to send an image - but Welcome to Singapore",
        "sms": {
            "encoding": "AUTO",
            "source": "<SENDERID>"
        }
    }
}

The corresponding message the user will receive:

Viber Rich Media: Image only message

Viber Rich Media: Image only message


Video only

Refer to Supported Content Types for more info on supported file formats and size limits.

Sample Request:
{
    "user": {
        "msisdn": "+6500000"
    },
    "type": "video",
    "content": {
        "url": "https://samplelib.com/lib/preview/mp4/sample-5s.mp4",
        "fallbackText": "Attempt to send a video via Viber was unsuccessful. Please get in touch for more information",
        "sms": {
            "encoding": "AUTO",
            "source": "<SENDERID>"
        },
        "video": {
            "filesize": "2700",
            "duration": "5",
            "thumbnail": "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg"
        }
    }
}

The corresponding message the user will receive:

Viber Rich Media: Video-only message

Viber Rich Media: Video-only message


File only

Refer to Supported Content Types for more info on supported file formats and size limits.

Sample Request:
{
    "user": {
        "msisdn": "+6500000"
    },
    "clientMessageId": "<optionalClientMessageId>",
    "type": "file",
    "content": {
        "url": "https://www.clickdimensions.com/links/TestPDFfile.pdf",
        "fallbackText": "Please see the menu here www.file.com/file.pdf",
        "sms": {
            "encoding": "AUTO",
            "source": "<SENDERID>"
        }
    }
}

The corresponding message the user will receive:

File

Viber Rich Media: File-only message


Text + Button

{
    "user": {
        "msisdn": "+6500000"
    },
    "clientMessageId": "<optionalClientMessageId>",
    "type": "buttons",
    "content": {
        "text": "Hello Jessie,\n\nYour order #420007 has been processed and is now ready for pickup at our MBS store. \n\nFor your convenience, the store is open from 9am to 9pm. We look forward to seeing you!\n\nBest,\nThe Snackbar Team",
        "button": {
            "caption": "Get Directions to Store",
            "action": "https://maps.google.com/?q=Your+Store+Location"
        },
        "sms": {
            "encoding": "AUTO",
            "source": "<SENDERID>"
        }
    }
}

The corresponding message the user will receive:

Viber Rich Media: text and call-to-action button

Viber Rich Media: text and call-to-action button


Text + Image

{
  "user": {
    "msisdn": "+6500000"
  },
  "clientMessageId": "<optionalClientMessageId>",
  "type": "buttons",
  "content": {
    "text": "Hello Mr Jobs,\n\nDon't miss our upcoming summer sale! Starting next Monday, enjoy up to 20% off on selected apple-based products.\n\nBest,\nThe Grocerio Team",
    "url": "https://www.abc.net.au/reslib/201408/r1320712_18276029.jpg",
    "button": {
      "caption": "",
      "action": ""
    },
    "sms": {
      "encoding": "AUTO",
      "source": "<SENDERID>"
    }
  }
}

The corresponding message the user will receive:

Viber Rich Media message: Text and Image

Viber Rich Media message: Text and Image


Text + Image + Button

{
  "user": {
    "msisdn": "+6500000"
  },
  "clientMessageId": "<optionalClientMessageId>",
  "type": "buttons",
  "content": {
    "text": "πŸŽ‰ Successful Purchase! πŸŽ‰\n\nHello Ana,\n\nThank you for purchasing your Singapore OCBC Skyway ticket! Your ticket is now confirmed and ready for use.\n\nπŸ“… Date: October 15, 2023\n⏰ Time: 3:00 PM - 4:00 PM\n🎫 Ticket ID: SKY98723\n\nTo view your e-ticket, click the button below.",
    "url": "https://www.redbrick.sg/wp-content/uploads/2020/04/coleen-rivas-OZ2rS2zCjNo-unsplash-1125x1500.jpg",
    "button": {
      "caption": "View E-ticket",
      "action": "https://ocbcskyway.com/e-ticket/SKY1234"
    },
    "sms": {
      "encoding": "AUTO",
      "source": "<SENDERID>"
    }
  }
}

The corresponding message the user will receive:

Viber Rich Media message

Viber Rich Media message: Text, image, and call-to-action button