node.jschatbotviberviber-apiviber-bot

Viber Node.JS Bot API - RichMediaMessage object - doesn't work


Without min api version -

const message = new RichMediaMessage(SAMPLE_RICH_MEDIA);

With min api version -

const message = new RichMediaMessage(SAMPLE_RICH_MEDIA, null, [], undefined, undefined, null, 7);

Both doesn't work while sending

response.send(message);

The error log is like below enter image description here

Normal text message works well

const message = new TextMessage('hi');

response.send(message);

enter image description here


Solution

  • I have found the issue.
    In their api documentation,
    https://developers.viber.com/docs/api/nodejs-bot-api/#RichMediaMessage

    "ButtonsGroupRows": 2 (this should be => 4+1=5)
    

    Changing "2" to "5" solved it.