Giter VIP home page Giter VIP logo

sample-bot-isitup's Introduction

Sample Viber bot

A simple starting point for creating a Node.js based Viber bot. This bot allows you to test if a website is down for everyone or just you. You can download the completed bot or just follow the tutorial.

Prerequisites

  1. Node.js 5.0+
  2. 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.
  3. Active bot account.
  4. 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.

Usage

  • Clone the repository
git clone https://github.com/Viber/sample-bot-isitup myviberbot
cd myviberbot
npm install -g now
  • Let's deploy our bot with access token . Edit the following command with your access token and run it in the cloned repository folder
now -e VIBER_PUBLIC_ACCOUNT_ACCESS_TOKEN_KEY="YOUR_PUBLIC_ACCOUNT_TOKEN"

That's it! Now your bot is deployed. Start talking with it in your Viber app. Simply navigate to your Public Account and click on the Message button.

License

See the LICENSE file (MIT).

sample-bot-isitup's People

Contributors

itamarm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sample-bot-isitup's Issues

Not working

TypeError: Data must be a string or a buffer
at Hmac.update (crypto.js:97:16)
at MessageValidator._calculateHmacFromMessage (/home/nowuser/src/node_modules/viber-bot/lib/message/message-validator.js:17:54)
at MessageValidator.validateMessage (/home/nowuser/src/node_modules/viber-bot/lib/message/message-validator.js:11:30)
at _app.use (/home/nowuser/src/node_modules/viber-bot/lib/middleware.js:61:32)
at Layer.handle [as handle_request] (/home/nowuser/src/node_modules/viber-bot/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/nowuser/src/node_modules/viber-bot/node_modules/express/lib/router/index.js:317:13)
at /home/nowuser/src/node_modules/viber-bot/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/home/nowuser/src/node_modules/viber-bot/node_modules/express/lib/router/index.js:335:12)
at next (/home/nowuser/src/node_modules/viber-bot/node_modules/express/lib/router/index.js:275:10)
at textParser (/home/nowuser/src/node_modules/body-parser/lib/types/text.js:69:7)

How i can handle post requests in bot?

const bodyParser = require('body-parser');
const express = require('express');
const app = express();
app.use(bodyParser.json());
app.use("/viber/webhook", bot.middleware());
app.listen(port);
app.post("/", function (req, res) {
if (req.body.myRequest) {
console.log("success")
return res.sendStatus(200)
}
else {
//how handle viber request? } });`

update to winston 3.x.x

Hi! Thanks for this sample!
Please, help my update this with new winston 3.x.x and how to realize with it toYaml.config()?
TypeError: toYAML.config is not a function

4847668293650

Do I need an Android device?

Yes, Google Play Pass is compatible with mobile and tablet devices with Play Store version 16.6.25 and above, and Android version 4.4 and above.

bad recierver id error

always I call send_message API I get an error.
{"status":999,"status_message":"Bad receiver ID","message_token":5214133425990421983}

my request is
{
"receiver":"+9647504570707",
"sender":{
"name":"John McClane",
"avatar":"http://avatar.example.com"
},
"type":"text",
"text":"Hello from Abbas"

}

but always I replace receiver to nloI/TOL2seqOAjHslcr7Q== sends the message is a success but I unknow how to take Viber unique id from a phone number.

Message Validation error when initialising sample project

TypeError: Not a buffer
   at TypeError (native)
   at new Hmac (crypto.js:87:16)
   at Object.Hmac (crypto.js:85:12)
   at MessageValidator._calculateHmacFromMessage (/home/nowuser/src/node_modules/baf6ab1b53f7d259fc108c0cb6439ccabf2a8d2e/lib/message/message-validator.js:17:16)
   at MessageValidator.validateMessage (/home/nowuser/src/node_modules/baf6ab1b53f7d259fc108c0cb6439ccabf2a8d2e/lib/message/message-validator.js:11:30)
   at /home/nowuser/src/node_modules/baf6ab1b53f7d259fc108c0cb6439ccabf2a8d2e/lib/middleware.js:61:32
   at Layer.handle [as handle_request] (/home/nowuser/src/node_modules/86421e6b6de89c8645b06441570eaa27d4883cb5/lib/router/layer.js:95:5)
   at trim_prefix (/home/nowuser/src/node_modules/86421e6b6de89c8645b06441570eaa27d4883cb5/lib/router/index.js:312:13)
   at /home/nowuser/src/node_modules/86421e6b6de89c8645b06441570eaa27d4883cb5/lib/router/index.js:280:7
   at Function.process_params (/home/nowuser/src/node_modules/86421e6b6de89c8645b06441570eaa27d4883cb5/lib/router/index.js:330:12)

Freshly cloned repo, with the only change being creating & putting my own API key into the .env file. Running through now.sh as the readme instructs. Above is in browser when visiting now.sh URL; console output shows no errors:

> Deploying ~/repos/sample-bot-isitup
> Using Node.js 5.11.1 (requested: `>=5`)
> Ready! https://isitup-bot-wtaitilljq.now.sh (copied to clipboard) [3s]
> Initializing…
> Deployment complete!

Can I use viber-bot as participant of some viber group?

Hi guys, my task sounds like below:

  1. We have simple viber group with ~70 members + 3 administrators
  2. One day, some viber-bot will write some message in chat, for example, "Start counting!"
    After that, everybody who want to be added to the some list, let's say list of active member, this guys should answer to the GROUP CHAT (not to private message of viber-bot)" "+" or "agree"
  3. After that, I would like to count numbers of messages by some mask, let's say calculate all "+"

So, general question is it possible to SUBSCRIBE and LISTEN viber group messages?? I know how to do it, if user write DIRECTLY TO PM BOT, but how to listen groups???

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.