Skip to main content
Version: 0.15.17

ViberEvent

rawEvent

Underlying raw event from Viber.

Example:

event.rawEvent;
// {
// event: 'message',
// timestamp: 1457764197627,
// message_token: 4912661846655238145,
// sender: {
// id: '01234567890A=',
// name: 'John McClane',
// avatar: 'http://avatar.example.com',
// country: 'UK',
// language: 'en',
// api_version: 1,
// },
// message: {
// type: 'text',
// text: 'a message to the service',
// tracking_data: 'tracking data',
// },
// }

isMessage

Determine if the event is a message event.

Example:

event.isMessage; // true

message

The message object from Viber raw event.

Example:

event.message;
// {
// type: 'text',
// text: 'a message to the service',
// tracking_data: 'tracking data',
// }

isText

Determine if the event is a message event which includes text.

Example:

event.isText; // true

text

The text string from Viber raw event.

Example:

event.text; // 'a message to the service'

isPicture

Determine if the event is a message event which includes picture.

Example:

event.isPicture; // true

picture

The picture URL from Viber raw event.

Example:

event.picture; // 'http://example.com/img.jpg'

isVideo

Determine if the event is a message event which includes video.

Example:

event.isVideo; // true

video

The video URL from Viber raw event.

Example:

event.video; // 'http://example.com/video.mp4'

isFile

Determine if the event is a message event which includes file.

Example:

event.isFile; // true

file

The file URL from Viber raw event.

Example:

event.file; // 'http://example.com/doc.pdf'

isSticker

Determine if the event is a message event which includes sticker.

Example:

event.isSticker; // true

sticker

The sticker id from Viber raw event.

Example:

event.sticker; // 46105

isContact

Determine if the event is a message event which includes contact.

Example:

event.isContact; // true

contact

The contact object from Viber raw event.

Example:

event.contact;
// {
// name: 'Itamar',
// phone_number: '+972511123123',
// }

isURL

Determine if the event is a message event which includes URL.

Example:

event.isURL; // true

url

The URL from Viber raw event.

Example:

event.url; // 'http://example.com'

isLocation

Determine if the event is a message event which includes location.

Example:

event.isLocation; // true

location

The location object from Viber raw event.

Example:

event.location;
// {
// lat: 50.76891,
// lon: 6.11499,
// }

isSubscribed

Determine if the event is a subscribed event.

Example:

event.isSubscribed; // true

subscribed

The subscribed payload from Viber raw event.

Example:

event.subscribed;
// {
// event: 'subscribed',
// timestamp: 1457764197627,
// user: {
// id: '01234567890A=',
// name: 'John McClane',
// avatar: 'http://avatar.example.com',
// country: 'UK',
// language: 'en',
// api_version: 1,
// },
// message_token: 4912661846655238145,
// }

isUnsubscribed

Determine if the event is an unsubscribed event.

Example:

event.isUnsubscribed; // true

unsubscribed

The unsubscribed payload from Viber raw event.

Example:

event.unsubscribed;
// {
// event: 'unsubscribed',
// timestamp: 1457764197627,
// user_id: '01234567890A=',
// message_token: 4912661846655238145,
// }

isConversationStarted

Determine if the event is a conversation_started event.

Example:

event.isConversationStarted; // true

conversationStarted

The conversation started payload from Viber raw event.

Example:

event.conversationStarted;
// {
// event: 'conversation_started',
// timestamp: 1457764197627,
// message_token: 4912661846655238145,
// type: 'open',
// context: 'context information',
// user: {
// id: '01234567890A=',
// name: 'John McClane',
// avatar: 'http://avatar.example.com',
// country: 'UK',
// language: 'en',
// api_version: 1,
// },
// subscribed: false,
// }

isDelivered

The delivered payload from Viber raw event.

Example:

event.isDelivered; // true

delivered

The delivered payload from Viber raw event.

Example:

event.delivered;
// {
// event: 'delivered',
// timestamp: 1457764197627,
// message_token: 4912661846655238145,
// user_id: '01234567890A=',
// }

isSeen

Determine if the event is a seen event.

Example:

event.isSeen; // true

seen

The seen payload from Viber raw event.

Example:

event.seen;
// {
// event: 'seen',
// timestamp: 1457764197627,
// message_token: 4912661846655238145,
// user_id: '01234567890A=',
// }

isFailed

Determine if the event is a failed event.

Example:

event.isFailed; // true

failed

The failed payload from Viber raw event.

Example:

event.failed;
// {
// event: 'failed',
// timestamp: 1457764197627,
// message_token: 4912661846655238145,
// user_id: '01234567890A=',
// desc: 'failure description',
// }