Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Alpin52
@Alpin52

Here's a test case I was advised to do from viber support team:
Image 1
Yotam (Viber Support)
January 12, 2021 1:23 PM (UTC+02:00)
Hi Alexey,

Regarding not receiving events, can you please confirm you are not seeing incoming requests that are sent to your webhook from Viber when you send your bot a message?

If that is the case, then to allow us to narrow down the cause of the issue, please try the following test:

  1. Go to https://webhook.site
  2. Copy the Your unique URL (keep the page open in your browser during the next steps).
  3. Use this URL in your set_webhook request and send it.
  4. Send a message to your bot, and check the callback that appears in https://webhook.site

Let us know the result of step #4 and we'll advise on the next steps.

On webhook.site I can see the messages I send from my viber client
Alpin52
@Alpin52
I checked apache logs and there are 3 pairs of POST GET requests from viber when I send a message. But my code isn't executed
Milos Petkovic
@milospetkovic
hi. I need help with subscribed event . there's info in my console "Unhandled promise rejection." when user subscribes
I need info how to handle this event
bot.on(BotEvents.SUBSCRIBED, (response) => {
console.log('subscribed...');
});
Shai Alon
@shaialon
FYI: just use https://app.chatleap.com/ to build your Viber bot without coding.
It handles all these edge cases and much more.
Cheers.
Milos Petkovic
@milospetkovic
Thanks. I'm already in the middle of the process of creating an app
I've commented out variable in the env file so the warrning came out because of it
I've just placed:
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason)
});
in order to see what has caused the warning. I hope someone will help this also
Preslav Semov Hadzhitsanev
@preslavsh
@shaialon what is the pricing of chatleap
Milos Petkovic
@milospetkovic
hm, I've one doubt and hope someone will help mi out with this. I've a new chat bot and I can see it on my phone via More -> Settings -> My Bots (or access it directly scanning qr code on bot account's qr in partners.viber.com..). I can receive a messages other viber users send to my bot and I can respond to them from my node app..
But, what if user/client sends a message to my private account (not to the bot) ?
The bot is going to be used for some company, and I want to handle activities received to company's bot.. But the end users can send a message to company's viber private account ? There's no way to handle activities in that case ?
Preslav Semov Hadzhitsanev
@preslavsh
@milospetkovic you can send to the "Private account" in the bot, not as message from the user. In the community you can receive the messages from the users.
Can my chatbot be private? If I create it and not publish it?
Milos Petkovic
@milospetkovic
I'm just wondering: My client has a phone number and the phone has regular Viber account (linked with his phone number). Chat bot for my client should be as a "Public account" so the other user's can communicate with him via the chat bot ("Public account"). But, if they (customers) have the client's phone number in their contacts on the phone then they will have my client's personal viber account also. In case when customer sends a message to my client's personal viber account then I can't handle those messages (because they're sent to private account)
Can my chatbot be private? If I create it and not publish it?<
Your chatbot is not publicly visible until you publish it. But, if someone scans your chatbot's qr code or you share it via viber with your users, they can see your chatbot
Preslav Semov Hadzhitsanev
@preslavsh
@milospetkovic yes there is no direct link user-profile->chatbot->user-profile, you can make chatbot-user->chatbot->chatbot-user
Mihail Madzharov
@MihailMadzharovFalcon
HI guys I am trying to use the viber bot api. I set up webhook on firebase functions. And when I call https://chatapi.viber.com/pa/set_webhook I aways get 200 with status 1. But my url is correct all of my endpoinnts are returning 200 ok.
Nebojša
@njevdjo
After sharing the bot with a friend, I received a message from him that he could not subscribe and that the invitation is blurred.
image.png
The bot otherwise works well for the other 13 subscribers.
@milospetkovic Земљак можда ти знаш одговор? :)
Milos Petkovic
@milospetkovic
@njevdjo здраво земљак :), no I didn't have that kind of situation
I've tried with maybe 4/5 different accounts and there were no problems
Konstantin
@Zuten

@Zuten
Hi guys.
I have a web server with viber bot in it. But to use it I need SSL certificate, so I installed the certbot from LetsEncrypt and made request for my domain bot.tke.ck.ua. Certbot said "congrats", and so I pasted the path for certs in server httpsOptions:

const https = require('https');
const port = 80;

// Viber will push messages sent to this URL. Web server should be internet-facing.
const webhookUrl = 'bot.tke.ck.ua';

const httpsOptions = {
key: fs.readFileSync('C:/Certbot/live/bot.tke.ck.ua/privkey.pem'),
cert: fs.readFileSync('C:/Certbot/live/bot.tke.ck.ua/cert.pem'),
ca: fs.readFileSync('C:/Certbot/live/bot.tke.ck.ua/fullchain.pem')
};

const server = https.createServer(httpsOptions, bot.middleware()).listen(port, () => bot.setWebhook(webhookUrl))

But after running the server I'm only getting a lot of node exceptions:

[nodemon] starting node viber_bot.js
(node:3132) UnhandledPromiseRejectionWarning: #
(Use node --trace-warnings ... to show where the warning was created)
(node:3132) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see Command-line options | Node.js v15.11.0 Documentation 1). (rejection id: 1)
(node:3132) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

In other hand, whem I'm using ngrok for SSL, there is no problem.

What I'm doing wrong, and what I need to do?
@Zuten
Even when I copied the code from documentation and pasted certs to node app folder I have the same problem. Code:

const ViberBot = require('viber-bot').Bot;
const BotEvents = require('viber-bot').Events;
const fs = require('fs');

console.log("Const set");

const bot = new ViberBot({
authToken: "",
name: "Бот",
avatar: "" // It is recommended to be 720x720, and no more than 100kb.
});

console.log("Bot created");

// Perfect! Now here's the key part:
bot.on(BotEvents.MESSAGE_RECEIVED, (message, response) => {
// Echo's back the message to the client. Your bot logic should sit here.
response.send(message);
});

console.log("Bot function on message receive, working");

// Wasn't that easy? Let's create HTTPS server and set the webhook:
const https = require('https');
const port = process.env.PORT || 8080;

console.log("Https set");

// Viber will push messages sent to this URL. Web server should be internet-facing.
const webhookUrl = 'bot.tke.ck.ua';
const privateKey = fs.readFileSync('cert/privkey.pem', 'utf-8');
const certificate = fs.readFileSync('cert/cert.pem', 'utf-8');
const caChain = fs.readFileSync('cert/chain.pem', 'utf-8')

console.log("Obj httpsOptions inner defined");

const httpsOptions = {
key: privateKey,
cert: certificate,
ca: caChain
}

console.log("httpsOptions set");

// Trusted SSL certification (not self-signed).
https.createServer(httpsOptions, bot.middleware()).listen(port, () => bot.setWebhook(webhookUrl));
console.log("Server started");

Vitaliy
@scorpioRED
Hi! maybe somebody can help me to understand how to use share-phone button to ask user sher his phone number.
Here is how is look part of my code
const keyboardSharePhoneViber = { "Type": "keyboard", "Buttons": [ { "ActionType": "share-phone", "ActionBody": "phone", "Text": "Shere phone number", "TextSize": "regular" } ] }
Then I try to send this button
viberBot.sendMessage(response.userProfile, new TextMessage(keyboardSharePhoneViber))
Vitaliy
@scorpioRED
And I got an error
(node:20304) UnhandledPromiseRejectionWarning: #<Object> (node:20304) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:20304) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I found some information, that I have to set min_api_version to 3, but I did not find any info where I have set this parameter in node viber bot module
Maybe you can send me some example how to do than
Preslav Semov Hadzhitsanev
@preslavsh

@scorpioRED firs you are using TextMessage for sending keyboard your call should be "new TextMessage("text", keyboard) , but TextMessage does not havem in api version

Try using KeyboardMessage instead KeyboardMessage(SAMPLE_KEYBOARD, [optionalTrackingData], null, null, [minApiVersion])

Gus
@mdkgr
Hi to everyone! First time here! Two questions; 1.) Can I send messages to phone numbers from a JS array, 2.) Are there limits to the amount of messages or any other limit that I should be aware of? Thanks!
Alex Buznik
@beshur
Hey guys
I get an error while trying to setWebhook with message { status: 1, chathostname: 'SN-CHAT-06' }
Alex Buznik
@beshur
Nevermind, it seems I just provided wrong webhook URL
Vladyslav Tkachuk
@vlapick
Hey. I try make the corners of a button rounded, but no working
{ "type": "keyboard", "inputFieldState": "hidden", "buttons": [ { "ActionBody": "/test", "ActionType": "reply", "BgColor": "#FF0000", "Frame.CornerRadius": "4", "Columns": 6, "Rows": 1, "Text": "<b><font color=\"#FFFFFF\">test</font></b>", "TextHAlign": "center", "TextSize": "regular", "TextVAlign": "middle", "Silent": false } ] }
Preslav Semov Hadzhitsanev
@preslavsh
@vlapick You should increase api version of the message
andrij200390
@andrij200390
@preslavsh I use api version 4, but "inputFieldState":"hidden" not working.
ILYA ARTEMOV
@mist-leet

Hello everybody. I have a small problem sending messages with the keyboard.
Bug reproduction:

  1. The user starts a dialogue with the bot
  2. The user disconnects the network on the phone
  3. The bot sends a message with the keyboard
  4. The bot sends a message without a keyboard
  5. The user turns on the network and opens a dialog

Expected:
User will see 2 messages, keyboard will not show
Received:
User receives 2 messages + keyboard from the first message

Reproduced only on Anroid, with the network turned off. If not disabled, the keyboard is not shown
On IOS is not reproduced at all

justinroyvilla
@justinroyvilla
Hi, is there a library to build rich media content, complete with input text, buttons, calendar, etc?
MuthukumarGM
@MuthukumarGM
Hi I am trying to integrate with my chat application
but I have no Idea where to start
in VIber
Michael Pritchin
@mpritchin
Hi
Maybe somebody know is it possible to send file to bot? Now I don't see the attachment button in bot chat.
John Cyrill Corsanes
@jcchikikomori
Hello. Is Viber can do WebView like open link without opening externally?
mufik-petro
@mufik-petro
Привет. Кто знает, может бот удалять участников сообщества/канала?
Или есть ли вообще такая функция по REST API?
Danil Yahoda
@retqs
Hello everyone, I've got some issue while running bot with webook, I have an array of keys, I'm looping through each key and I have single instance of it, but I only have one webhook url
const URL = https://website.com;
bot
.setWebhook(URL)
.then((val) => console.log(val, 'viber connected it"s ok'))
.catch((err) => console.log(err));
I get "viber connected it's ok" but bot won't react to any of event command, like: BotEvents.MESSAGE_RECEIVED, BotEvents.CONVERSATION_STARTED
If I put port to URL https://website.com:2001, https://website.com:2002, it wound throw me an error with status 1 that means invalid setWebhook
But on local host If I hardcode key and use ngrok it's okay,
Telegrams bots are running on ports https://website.com:2012,https://website.com:2013 and it's they're satisfied with that url but viber not
What could go wrong?
And I'm using express