{"id":13464186,"url":"https://github.com/Viber/viber-bot-node","last_synced_at":"2025-03-25T10:32:05.791Z","repository":{"id":13880471,"uuid":"74022796","full_name":"Viber/viber-bot-node","owner":"Viber","description":"The Viber bot NodeJS library provides just what you need to develop intelligent bots that interact naturally with your Viber users. ","archived":false,"fork":false,"pushed_at":"2023-03-06T08:55:21.000Z","size":596,"stargazers_count":108,"open_issues_count":9,"forks_count":77,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-03-10T00:58:08.415Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://developers.viber.com/","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Viber.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-11-17T11:58:47.000Z","updated_at":"2025-01-27T18:48:05.000Z","dependencies_parsed_at":"2024-01-16T05:43:16.938Z","dependency_job_id":"9feee52b-3483-4ea3-9952-2b0c747f45c2","html_url":"https://github.com/Viber/viber-bot-node","commit_stats":{"total_commits":95,"total_committers":15,"mean_commits":6.333333333333333,"dds":0.5473684210526315,"last_synced_commit":"e202b1b6d73f929269caf82c392173937e2d4412"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viber%2Fviber-bot-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viber%2Fviber-bot-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viber%2Fviber-bot-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viber%2Fviber-bot-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Viber","download_url":"https://codeload.github.com/Viber/viber-bot-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245444195,"owners_count":20616338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T14:00:36.409Z","updated_at":"2025-03-25T10:32:05.456Z","avatar_url":"https://github.com/Viber.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Viber Node.JS Bot API\nUse this library to develop a bot for the Viber platform.\nThe library is available on **[GitHub](https://github.com/Viber/viber-bot-node)** as well as a package on [npm](https://www.npmjs.com/package/viber-bot).\n\n## License\nThis library is released under the terms of the Apache 2.0 license. See [License](https://github.com/Viber/viber-bot-node/blob/master/LICENSE.md) for more information.\n\n## Library Prerequisites\n\n1. Node \u003e= 5.0.0\n1. An Active Viber account on a platform which supports Public Accounts/ bots (iOS/Android). This account will automatically be set as the account administrator during the account creation process.\n1. Active Public Account/ bot - Create an account [here](https://developers.viber.com/docs/general/get-started).\n1. Account authentication token - unique account identifier used to validate your account in all API requests. Once your account is created your authentication token will appear in the account’s “edit info” screen (for admins only). Each request posted to Viber by the account will need to contain the token.\n1. Webhook - Please use a server endpoint URL that supports HTTPS. If you deploy on your own custom server, you'll need a trusted (ca.pem) certificate, not self-signed. Read our [blog post](https://developers.viber.com/blog/2017/05/24/test-your-bots-locally) on how to test your bot locally.\n\n## Installation\nThis library is released on [npm](https://www.npmjs.com/package/viber-bot).\n\n### npm\nInstall with [`npm install viber-bot --save`](https://www.npmjs.com/package/viber-bot)\n\n### Express\nIf you are already using express or equivalent, you can do the following:\n\n```js\napp.use(\"/viber/webhook\", bot.middleware());\n```\nPlease revisit [app.use()](http://expressjs.com/en/api.html#app.use) documentation.\nFor more information see [ViberBot.middleware()](#middleware).\n\n## Let's get started!\nCreating a basic Viber bot is simple:\n\n1. Import `viber-bot` library to your project\n2. Create a Public Account or bot and use the API key from [https://developers.viber.com]()\n3. Configure your bot as described in the documentation below\n4. Add the bot as middleware to your server with `bot.middleware()`\n5. Start your web server\n6. Call `setWebhook(url)` with your web server url\n\n### Creating an echo Bot\nFirstly, let's *import and configure* our bot:\n\n```js\n'use strict';\n\nconst ViberBot = require('viber-bot').Bot;\nconst BotEvents = require('viber-bot').Events;\n\nconst bot = new ViberBot({\n\tauthToken: YOUR_AUTH_TOKEN_HERE,\n\tname: \"EchoBot\",\n\tavatar: \"http://viber.com/avatar.jpg\" // It is recommended to be 720x720, and no more than 100kb.\n});\n\n// Perfect! Now here's the key part:\nbot.on(BotEvents.MESSAGE_RECEIVED, (message, response) =\u003e {\n\t// Echo's back the message to the client. Your bot logic should sit here.\n\tresponse.send(message);\n});\n\n// Wasn't that easy? Let's create HTTPS server and set the webhook:\nconst https = require('https');\nconst port = process.env.PORT || 8080;\n\n// Viber will push messages sent to this URL. Web server should be internet-facing.\nconst webhookUrl = process.env.WEBHOOK_URL;\n\nconst httpsOptions = {\n\tkey: ...,\n\tcert: ...,\n\tca: ...\n}; // Trusted SSL certification (not self-signed).\nhttps.createServer(httpsOptions, bot.middleware()).listen(port, () =\u003e bot.setWebhook(webhookUrl));\n```\n\n### Using Winston logger\nWe provide an option to use [Winston](https://www.npmjs.com/package/winston) logger with our library.\nThe only requirement is that you use Winston \u003e= 2.0.0.\n\n```js\n'use strict';\n\nconst ViberBot = require('viber-bot').Bot;\nconst winston = require('winston');\nconst toYAML = require('winston-console-formatter'); // makes the output more friendly\n\nfunction createLogger() {\n\tconst logger = new winston.Logger({\n\t\tlevel: \"debug\"\n\t}); // We recommend DEBUG for development\n\tlogger.add(winston.transports.Console, toYAML.config());\n\treturn logger;\n}\n\nconst logger = createLogger();\nconst bot = new ViberBot({\n\tlogger: logger,\n\tauthToken: ...,\n\t...\n});\n```\n\n### Do you supply a basic router for text messages?\nWell funny you ask. Yes we do. But a word of warning - messages sent to your router callback will also be emitted to the `BotEvents.MESSAGE_RECEIVED` event.\n\n```js\nconst TextMessage = require('viber-bot').Message.Text;\n\n// A simple regular expression to answer messages in the form of 'hi' and 'hello'.\nbot.onTextMessage(/^hi|hello$/i, (message, response) =\u003e\n    response.send(new TextMessage(`Hi there ${response.userProfile.name}. I am ${bot.name}`)));\n```\n\nHave you noticed how we created the `TextMessage` instance? There's a all bunch of message types you should get familiar with.\n\n* [Text Message](#TextMessage)\n* [Url Message](#UrlMessage)\n* [Contact Message](#ContactMessage)\n* [Picture Message](#PictureMessage)\n* [Video Message](#VideoMessage)\n* [Location Message](#LocationMessage)\n* [Sticker Message](#StickerMessage)\n* [File Message](#FileMessage)\n* [Rich Media Message](#RichMediaMessage)\n* [Keyboard Message](#KeyboardMessage)\n\nCreating them is easy! Every message object has its own unique constructor corresponding to its API implementation. Click on each type in the list to find out more. Check out the full API documentation for more advanced uses.\n\n## API\n\n### Viber Bot\n\n`require('viber-bot').Bot`\n\nAn event emitter, emitting events [described here](#onEvent).\n\n* ViberBot\n    * [new ViberBot()](#newViberBot)\n    * [.getBotProfile()](#getBotProfile) ⇒ `promise.JSON`\n    * [.getUserDetails(userProfile)](#getUserDetails) ⇒ `promise.JSON`\n    * [.getOnlineStatus(viberUserIds)](#getOnlineStatus) ⇒ `promise.JSON`\n    * [.setWebhook(url)](#setWebhook) ⇒ `promise.JSON`\n    * [.sendMessage(userProfile, messages, [optionalTrackingData])](#sendMessage) ⇒ `promise.ARRAY`\n    * [.postToPublicChat(userProfile, messages)](#postToPublicChat) ⇒ `promise.ARRAY`\n    * [.on(handler)](#onEvent)\n    * [.onTextMessage(regex, handler)](#onTextMessage) : `handler` = [`TextMessageHandlerCallback`](#TextMessageHandlerCallback)\n    * [.onError(handler)](#onError) : `handler` = [`ErrorHandlerCallback`](#ErrorHandlerCallback)\n    * [.onConversationStarted(userProfile, isSubscribed, context, onFinish)](#onConversationStarted) : `onFinish` = [`ConversationStartedOnFinishCallback`](#ConversationStartedOnFinishCallback)\n    * [.onSubscribe(handler)](#onSubscribe) : `handler` = [`SubscribeResponseHandlerCallback`](#SubscribeResponseHandlerCallback)\n    * [.onUnsubscribe(handler)](#onUnsubscribe) : `handler` = [`UnsubscribeResponseHandlerCallback`](#UnsubscribeResponseHandlerCallback)\n    * [.middleware()](#middleware)\n\n\n\u003ca name=\"newViberBot\"\u003e\u003c/a\u003e\n\n### New ViberBot()\n\n| Param | Type | Description |\n| --- | --- | --- |\n| options.logger | `object` | Winston logger |\n| options.authToken | `string` | Viber Auth Token  |\n| options.name | `string` | Your BOT Name |\n| options.avatar | `string` | Avatar URL. **No more than 100kb.** |\n| options.registerToEvents | `array` | example: [\"message\", \"delivered\"] |\n\n\u003ca name=\"onEvent\"\u003e\u003c/a\u003e\n\n### bot.on(handler)\n\n`require('viber-bot').Events`\n\n| Param | Type |\n| --- | --- |\n| handler | `EventHandlerCallback` |\n| message | [`Message Object`](#MessageObject) |\n| response | [`Response Object`](#ResponseObject) |\n| err | `Error Object` |\n\nSubscribe to events:\n\n* MESSAGE_RECEIVED (Callback:  `function (message, response) {}`)\n* MESSAGE_SENT (Callback:  `function (message, userProfile) {}`)\n* SUBSCRIBED (Callback:  `function (response) {}`)\n* UNSUBSCRIBED (Callback:  `function (response) {}`)\n* CONVERSATION_STARTED (Callback:  `function (userProfile, isSubscribed, context, onFinish) {}`)\n* ERROR (Callback:  `function (err) {}`)\n\n**Example**  \n\n```js\nbot.on(BotEvents.MESSAGE_RECEIVED, (message, response) =\u003e ... );\nbot.on(BotEvents.MESSAGE_SENT, (message, userProfile) =\u003e ... );\nbot.on(BotEvents.CONVERSATION_STARTED, (userProfile, isSubscribed, context, onFinish) =\u003e ... );\nbot.on(BotEvents.ERROR, err =\u003e ... );\nbot.on(BotEvents.UNSUBSCRIBED, response =\u003e ... );\nbot.on(BotEvents.SUBSCRIBED, response =\u003e\n    response.send(`Thanks for subscribing, ${response.userProfile.name}`));\n```\n\n\u003ca name=\"getBotProfile\"\u003e\u003c/a\u003e\n\n### bot.getBotProfile()\n\nReturns a `promise.JSON` [with the following JSON](https://developers.viber.com/docs/api/rest-bot-api/#get-account-info).\n\n```js\nbot.getBotProfile().then(response =\u003e console.log(`Public Account Named: ${response.name}`));\n```\n\n\u003ca name=\"getUserDetails\"\u003e\u003c/a\u003e\n\n### bot.getUserDetails(userProfile)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| userProfile | [`UserProfile`](#UserProfile) | `UserProfile` object |\n\nThe `getUserDetails` function will fetch the details of a specific Viber user based on his unique user ID. The user ID can be obtained from the callbacks sent to the account regarding user's actions. This request can be sent twice during a 12 hours period for each user ID.\n\nReturns a `promise.JSON`.\n\n```js\nbot.onSubscribe(response =\u003e bot.getUserDetails(response.userProfile)\n        .then(userDetails =\u003e console.log(userDetails)));\n```\n\n\u003ca name=\"getOnlineStatus\"\u003e\u003c/a\u003e\n\n### bot.getOnlineStatus(viberUserIds)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| viberUserIds | `array of strings` | Collection of Viber user ids |\n\nReturns a `promise.JSON`.\n\n```js\nbot.getOnlineStatus([\"a1, \"a2\"]).then(onlineStatus =\u003e console.log(onlineStatus));\n```\n\n\u003ca name=\"setWebhook\"\u003e\u003c/a\u003e\n\n### bot.setWebhook(url)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| url | `string` | Trusted SSL Certificate |\n\nReturns a `promise.JSON`.\n\n```js\nbot.setWebhook(\"https://my.bot/incoming\").then(() =\u003e yourBot.doSomething()).catch(err =\u003e console.log(err));\n```\n\n\u003ca name=\"sendMessage\"\u003e\u003c/a\u003e\n\n### bot.sendMessage(userProfile, messages, [optionalTrackingData])\n\n| Param | Type | Description |\n| --- | --- | --- |\n| userProfile | [`UserProfile`](#UserProfile) | `UserProfile` object |\n| messages | `object or array` | Can be `Message` object or array of `Message` objects |\n| [optionalTrackingData] | `JSON` | Optional. JSON Object. Returned on every message sent by the client |\n\n**Note:** When passing array of messages to `sendMessage`, messages will be sent by explicit order (the order which they were given to the `sendMessage` method). The library will also cancel all custom keyboards except the last one, sending only the last message keyboard.\n\nReturns a `promise.ARRAY` array of message tokens.\n\n```js\n// Single message\nconst TextMessage = require('viber-bot').Message.Text;\nbot.sendMessage(userProfile, new TextMessage(\"Thanks for shopping with us\"));\n\n// Multiple messages\nconst UrlMessage = require('viber-bot').Message.Url;\nbot.sendMessage(userProfile, [\n\tnew TextMessage(\"Here's the product you've requested:\"),\n\tnew UrlMessage(\"http://my.ecommerce.site/product1\"),\n\tnew TextMessage(\"Shipping time: 1-3 business days\")\n]);\n```\n\n\u003ca name=\"postToPublicChat\"\u003e\u003c/a\u003e\n\n### bot.postToPublicChat(userProfile, messages)\nThe Viber post API allows the Public Account owner to post a message in the Public Account’s public chat.\n\n| Param | Type | Description |\n| --- | --- | --- |\n| userProfile | [`UserProfile`](#UserProfile) | `UserProfile` object |\n| messages | `object or array` | Can be `Message` object or array of `Message` objects |\n\n**Note:** When passing array of messages to `postToPublicChat`, messages will be sent by explicit order (the order which they were given to the `postToPublicChat` method).\n\n**Note:** This method does not support keyboard attachment. \n\nReturns a `promise.ARRAY` array of message tokens.\n\n```js\n// Single message\nconst TextMessage = require('viber-bot').Message.Text;\nbot.postToPublicChat(userProfile, new TextMessage(\"Thanks for shopping with us\"));\n\n// Multiple messages\nconst UrlMessage = require('viber-bot').Message.Url;\nbot.postToPublicChat(userProfile, [\n\tnew TextMessage(\"Here's the product you've requested:\"),\n\tnew UrlMessage(\"http://my.ecommerce.site/product1\"),\n\tnew TextMessage(\"Shipping time: 1-3 business days\")\n]);\n```\n\n\u003ca name=\"middleware\"\u003e\u003c/a\u003e\n\n### bot.middleware()\n\nReturns a middleware implementation to use with `http/https`.\n\n```js\nconst https = require('https');\nhttps.createServer({\n\tkey: ...,\n\tcert: ...,\n\tca: ...\n}, bot.middleware()).listen(8080);\n```\n\n\u003ca name=\"onTextMessage\"\u003e\u003c/a\u003e\n\n### bot.onTextMessage(regex, handler)\n\n| Param | Type |\n| --- | --- |\n| regex | `regular expression` |\n| handler | [`TextMessageHandlerCallback`](#TextMessageHandlerCallback) |\n\n\u003ca name=\"TextMessageHandlerCallback\"\u003e\u003c/a\u003e\n\n##### TextMessageHandlerCallback: `function (message, response) {}`\n\n```js\nbot.onTextMessage(/^hi|hello$/i, (message, response) =\u003e\n    response.send(new TextMessage(`Hi there ${response.userProfile.name}. I am ${bot.name}`)));\n```\n\n\u003ca name=\"onError\"\u003e\u003c/a\u003e\n\n### bot.onError(handler)\n\n| Param | Type |\n| --- | --- |\n| handler | [`ErrorHandlerCallback`](#ErrorHandlerCallback) |\n\n\u003ca name=\"ErrorHandlerCallback\"\u003e\u003c/a\u003e\n\n##### ErrorHandlerCallback: `function (err) {}`\n\n```js\nbot.onError(err =\u003e logger.error(err));\n```\n\n\u003ca name=\"onConversationStarted\"\u003e\u003c/a\u003e\n\n### bot.onConversationStarted(userProfile, isSubscribed, context, onFinish)\n\n| Param | Type | Description |\n| --- | --- |\n| userProfile | [`UserProfile`](#UserProfile) | `UserProfile` object |\n| isSubscribed | boolean | Indicates whether a user is already subscribed |\n| context | String | Any additional parameters added to the deep link used to access the conversation passed as a string |\n| onFinish | [`ConversationStartedOnFinishCallback`](#ConversationStartedOnFinishCallback) | When called, a [`Message`](#MessageObject) will be sent to the client |\n\nConversation started event fires when a user opens a conversation with the Public Account/ bot using the “message” button (found on the account’s info screen) or using a [deep link](https://developers.viber.com/docs/tools/deep-links).\n\nThis event is **not** considered a subscribe event and doesn't allow the account to send messages to the user; however, it will allow sending one \"welcome message\" to the user. See [sending a welcome message](#SendingWelcomeMessage) below for more information. \n\n\u003ca name=\"ConversationStartedOnFinishCallback\"\u003e\u003c/a\u003e\n\n##### ConversationStartedOnFinishCallback: `function (responseMessage, optionalTrackingData) {}`\n\nThe `ConversationStartedOnFinishCallback` accepts `null` and [`MessageObject`](#MessageObject) only. Otherwise, an exception is thrown.\n\n```js\nbot.onConversationStarted((userProfile, isSubscribed, context, onFinish) =\u003e\n\tonFinish(new TextMessage(`Hi, ${userProfile.name}! Nice to meet you.`)));\n\nbot.onConversationStarted((userProfile, isSubscribed, context, onFinish) =\u003e\n\tonFinish(new TextMessage(`Thanks`), {\n\t\tsaidThanks: true\n\t}));\n```\n\n\u003ca name=\"onSubscribe\"\u003e\u003c/a\u003e\n\n### bot.onSubscribe(handler)\n\n| Param | Type |\n| --- | --- |\n| handler | [`SubscribeResponseHandlerCallback`](#SubscribeResponseHandlerCallback) |\n\n\u003ca name=\"SubscribeResponseHandlerCallback\"\u003e\u003c/a\u003e\n\n##### SubscribeResponseHandlerCallback: `function (response) {}`\n\n```js\nbot.onSubscribe(response =\u003e console.log(`Subscribed: ${response.userProfile.name}`));\n```\n\n\u003ca name=\"onUnsubscribe\"\u003e\u003c/a\u003e\n\n### bot.onUnsubscribe(handler)\n\n| Param | Type |\n| --- | --- |\n| handler | [`UnsubscribeResponseHandlerCallback`](#UnsubscribeResponseHandlerCallback) |\n\n\u003ca name=\"UnsubscribeResponseHandlerCallback\"\u003e\u003c/a\u003e\n\n##### UnsubscribeResponseHandlerCallback: `function (userId) {}`\n\n```js\nbot.onUnsubscribe(userId =\u003e console.log(`Unsubscribed: ${userId}`));\n```\n\n\u003ca name=\"ResponseObject\"\u003e\u003c/a\u003e\n\n### Response object\n\nMembers:\n\n| Param | Type | Notes |\n| --- | --- | --- |\n| userProfile | [`UserProfile`](#UserProfile) | --- |\n\n* Response\n    * [.send(messages, [optionalTrackingData])](#sendMessage) ⇒ `promise.JSON`\n\n\u003ca name=\"UserProfile\"\u003e\u003c/a\u003e\n\n### UserProfile object\n\nMembers:\n\n| Param | Type | Notes |\n| --- | --- | --- |\n| id | `string` | --- |\n| name | `string` | --- |\n| avatar | `string` | Optional Avatar URL |\n| country | `string` | **currently set in CONVERSATION_STARTED event only** |\n| language | `string` | **currently set in CONVERSATION_STARTED event only** |\n\n\u003ca name=\"MessageObject\"\u003e\u003c/a\u003e\n\n### Message Object\n\n```js\nconst TextMessage = require('viber-bot').Message.Text;\nconst UrlMessage = require('viber-bot').Message.Url;\nconst ContactMessage = require('viber-bot').Message.Contact;\nconst PictureMessage = require('viber-bot').Message.Picture;\nconst VideoMessage = require('viber-bot').Message.Video;\nconst LocationMessage = require('viber-bot').Message.Location;\nconst StickerMessage = require('viber-bot').Message.Sticker;\nconst RichMediaMessage = require('viber-bot').Message.RichMedia;\nconst KeyboardMessage = require('viber-bot').Message.Keyboard;\n```\n\n**Common Members for `Message` interface**:\n\n| Param | Type | Description |\n| --- | --- | --- |\n| timestamp | `string` | Epoch time |\n| token | `string` | Sequential message token |\n| trackingData | `JSON` | JSON Tracking Data from Viber Client |\n\n**Common Constructor Arguments `Message` interface**:\n\n| Param | Type | Description |\n| --- | --- | --- |\n| optionalKeyboard | `JSON` | [Writing Custom Keyboards](https://developers.viber.com/docs/tools/keyboards) |\n| optionalTrackingData | `JSON` | Data to be saved on Viber Client device, and sent back each time message is received |\n\n\u003ca name=\"TextMessage\"\u003e\u003c/a\u003e\n\n#### TextMessage object\n\n| Member | Type\n| --- | --- |\n| text | `string` |\n\n```js\nconst message = new TextMessage(text, [optionalKeyboard], [optionalTrackingData]);\nconsole.log(message.text);\n```\n\n\u003ca name=\"UrlMessage\"\u003e\u003c/a\u003e\n\n#### UrlMessage object\n\n| Member | Type\n| --- | --- |\n| url | `string` |\n\n```js\nconst message = new UrlMessage(url, [optionalKeyboard], [optionalTrackingData]);\nconsole.log(message.url);\n```\n\n\u003ca name=\"ContactMessage\"\u003e\u003c/a\u003e\n\n#### ContactMessage object\n\n| Member | Type\n| --- | --- |\n| contactName | `string` |\n| contactPhoneNumber | `string` |\n\n```js\nconst message = new ContactMessage(contactName, contactPhoneNumber, [optionalAvatar], [optionalKeyboard], [optionalTrackingData]);\nconsole.log(`${message.contactName}, ${message.contactPhoneNumber}`);\n```\n\n\u003ca name=\"PictureMessage\"\u003e\u003c/a\u003e\n\n#### PictureMessage object\n\n| Member | Type\n| --- | --- |\n| url | `string` |\n| text | `string` |\n| thumbnail | `string` |\n\n```js\nconst message = new PictureMessage(url, [optionalText], [optionalThumbnail], [optionalKeyboard], [optionalTrackingData]);\nconsole.log(`${message.url}, ${message.text}, ${message.thumbnail}`);\n```\n\n\u003ca name=\"VideoMessage\"\u003e\u003c/a\u003e\n\n#### VideoMessage object\n\n| Member | Type\n| --- | --- |\n| url | `string` |\n| size | `int` |\n| thumbnail | `string` |\n| duration | `int` |\n\n```js\nconst message = new VideoMessage(url, size, [optionalText], [optionalThumbnail], [optionalDuration], [optionalKeyboard], [optionalTrackingData]);\nconsole.log(`${message.url}, ${message.size}, ${message.thumbnail}, ${message.duration}`);\n```\n\n\u003ca name=\"LocationMessage\"\u003e\u003c/a\u003e\n\n#### LocationMessage object\n\n| Member | Type\n| --- | --- |\n| latitude | `float` |\n| longitude | `float` |\n\n```js\nconst message = new LocationMessage(latitude, longitude, [optionalKeyboard], [optionalTrackingData]);\nconsole.log(`${message.latitude}, ${message.longitude}`);\n```\n\n\u003ca name=\"StickerMessage\"\u003e\u003c/a\u003e\n\n#### StickerMessage object\n\n| Member | Type\n| --- | --- |\n| stickerId | `int` |\n\n```js\nconst message = new StickerMessage(stickerId, [optionalKeyboard], [optionalTrackingData]);\nconsole.log(message.stickerId);\n```\n\n\u003ca name=\"FileMessage\"\u003e\u003c/a\u003e\n\n#### FileMessage object\n\n| Member | Type\n| --- | --- |\n| url | `string` |\n| sizeInBytes | `int` |\n| filename | `string` |\n\n```js\nconst message = new FileMessage(url, sizeInBytes, filename, [optionalKeyboard], [optionalTrackingData]);\nconsole.log(`${message.url}, ${message.sizeInBytes}, ${message.filename}`);\n```\n\n\u003ca name=\"RichMediaMessage\"\u003e\u003c/a\u003e\n\n#### RichMediaMessage object\n\n| Member | Type\n| --- | --- |\n| richMedia | `Object` |\n\n```js\nconst SAMPLE_RICH_MEDIA = {\n\t\"ButtonsGroupColumns\": 6,\n\t\"ButtonsGroupRows\": 2,\n\t\"BgColor\": \"#FFFFFF\",\n\t\"Buttons\": [{\n\t\t\"ActionBody\": \"http://www.website.com/go_here\",\n\t\t\"ActionType\": \"open-url\",\n\t\t\"BgMediaType\": \"picture\",\n\t\t\"Image\": \"http://www.images.com/img.jpg\",\n\t\t\"BgColor\": \"#000000\",\n\t\t\"TextOpacity\": 60,\n\t\t\"Rows\": 4,\n\t\t\"Columns\": 6\n\t}, {\n\t\t\"ActionBody\": \"http://www.website.com/go_here\",\n\t\t\"ActionType\": \"open-url\",\n\t\t\"BgColor\": \"#85bb65\",\n\t\t\"Text\": \"Buy\",\n\t\t\"TextOpacity\": 60,\n\t\t\"Rows\": 1,\n\t\t\"Columns\": 6\n\t}]\n};\n\nconst message = new RichMedia(SAMPLE_RICH_MEDIA, [optionalKeyboard], [optionalTrackingData]);\n```\n\n\u003ca name=\"KeyboardMessage\"\u003e\u003c/a\u003e\n\n#### KeyboardMessage object\n\n| Member | Type\n| --- | --- |\n| keyboard | `JSON` |\n\n```js\n\nconst SAMPLE_KEYBOARD = {\n\t\"Type\": \"keyboard\",\n\t\"Revision\": 1,\n\t\"Buttons\": [\n\t\t{\n\t\t\t\"Columns\": 3,\n\t\t\t\"Rows\": 2,\n\t\t\t\"BgColor\": \"#e6f5ff\",\n\t\t\t\"BgMedia\": \"http://www.jqueryscript.net/images/Simplest-Responsive-jQuery-Image-Lightbox-Plugin-simple-lightbox.jpg\",\n\t\t\t\"BgMediaType\": \"picture\",\n\t\t\t\"BgLoop\": true,\n\t\t\t\"ActionType\": \"reply\",\n\t\t\t\"ActionBody\": \"Yes\"\n\t\t}\n\t]\n};\n\nconst message = new KeyboardMessage(SAMPLE_KEYBOARD, [optionalTrackingData]);\n```\n\n## Sample project\nWe've created the [Is It Up sample project](https://github.com/Viber/sample-bot-isitup) to help you get started.\n\n## Community\nJoin the conversation on **[Gitter](https://gitter.im/viber/bot-node)**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FViber%2Fviber-bot-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FViber%2Fviber-bot-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FViber%2Fviber-bot-node/lists"}