Answer the question
In order to leave comments, you need to log in
How to make share-phone work in viber bot on node?
All the best!
I need to get the user's phone number in the bot, but it doesn't work at all :(
The button for sending the number looks like this:
const keyboardSharePhoneViber = {
"Type": "keyboard",
"Buttons": [
{
"ActionType": "share-phone",
"ActionBody": "phone",
"Text": "Share your phone number",
"TextSize": "regular"
}
]
}
viberBot.sendMessage(response.userProfile, new TextMessage('Please shere your phone', keyboardSharePhoneViber))
(node:20304) UnhandledPromiseRejectionWarning: #
( 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 https://qna.habr.com/#promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html# cli_unhandled_reje... ). (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.
Answer the question
In order to leave comments, you need to log in
Try robiti like this:
bot.on(BotEvents.CONVERSATION_STARTED, (response) => {
response.send(new KeyboardMessage("Type": "keyboard",
"Buttons": [
{
"Columns": 6,
"Rows": 1,
"Text": "",
"ActionType": "share-phone",
"ActionBody": "phone",
}
], [], null, null, 3));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question