How to use the viber-bot.UserProfile function in viber-bot

To help you get started, we’ve selected a few viber-bot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DreamTeamMobile / botbuilder-viber / viber-connector.js View on Github external
ViberEnabledConnector.prototype.postMessage = function(message, cb) {
        var self = this,
            addr = message.address,
            user = addr.user;
        var realUserId = decodeURIComponent(addr.user.id)
        var profile = new UserProfile(realUserId, addr.user.name, '', '', '');
        if (message.type === 'typing') {
            // since Viber doesn't support "typing" notifications via API
            // this.viberBot.sendMessage(profile, [new VTextMessage('...', null, null, new Date(), '')]).then(function(x) { cb()}, function(y) {cb()})
            cb()
        } else {
            var viberMessages = [self.convertToViberMessage(message)];
            this.viberBot.sendMessage(profile, viberMessages).then(function(x) { cb() }, function(y) { cb() })
        }
    }