@Scorpiored88

Как в боте viber на node заствить работать share-phone?

Всем доброго!
Нужно в боте получить телефон пользователя, но никак не получается :(
Кнопка для отправкиномера у меня выглядит так:

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.


Также гдето писали что нужно вручную указать min_api_version но я так и не понил где это прописывать...

Помогите пожалуйста
  • Вопрос задан
  • 242 просмотра
Пригласить эксперта
Ответы на вопрос 1
@GeniusAtamans
Спробуй зробити так:
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));
});

Там де 3 у виклику, це min_api_version
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы