Reputation: 152
I need to display buttons in Viber bot using rich_media message type and Viber REST API.
When buttons are rendered the Rich Media element has a fixed height (see on screenshot).
If there is five buttons in Rich Media element some empty place appear under the last button.
My source sode for rendering buttons:
var reply = {
type: "raw",
method: "send_message",
body: {
receiver: $request.data.chatId,
sender:{
name: "John McClane",
avatar: "http://avatar.example.com"
},
min_api_version: 2,
type: "rich_media",
rich_media: {
Type: "rich_media",
Buttons: [
{
Rows: 1,
ActionBody: "Option 1",
ActionType: "reply",
Text: "Option 1"
},
{
Rows: 1,
ActionBody: "Option 2",
ActionType: "reply",
Text: "Option 2"
},
{
Rows: 1,
ActionBody: "Option 3",
ActionType: "reply",
Text: "Option 3"
},
...
]
}
}
}
I need to adjust the height of Rich Media element so the element stretches depending on the number of buttons. Is there a way to set height or disable default height of Rich Media element?
Upvotes: 0
Views: 407
Reputation: 152
Found the solution by myself. There is a parameter called ButtonsGroupRows (rich_media.ButtonsGroupRows, docs on this parameter). 7 is default value.
Upvotes: 0