Buttons in Mattermost Integration

I need to display the list of items in button format on Mattermost. For this Javascript message is for mattermost channel is configured as:
var message = {};
var attachments = [];
var attachment = {
“pretext”: “Please select time slot”,
“text”: “Time slots available are:”,
“actions”: [
{
“name”: “9:00 AM - 11:00 AM”,
“type” : “message”,
“integration”: {
“context”: {
“action”: “Regular Message”
}
}
},
{
“name”: “11:00 AM - 1:00 PM”,
“type” : “message”,
“integration”: {
“context”: {
“action”: “Regular Message”
}
}
}
]
}
attachments.push(attachment);
message.attachements = attachments;
print(JSON.stringify(message));

The http request received is
{
“channel”: “kore”,
“text”: {
“attachements”: [
{
“pretext”: “Please select time slot”,
“text”: “Time slots available are:”,
“actions”: [
{
“name”: “9:00 AM - 11:00 AM”,
“type”: “message”,
“integration”: {
“context”: {
“action”: “Regular Message”
}
}
},
{
“name”: “11:00 AM - 1:00 PM”,
“type”: “message”,
“integration”: {
“context”: {
“action”: “Regular Message”
}
}
}
]
}
]
}
}

It generates 400 bad request as Mattermost is not able to parse the string in “text”.
If the response expected is not part of “text” key it is working (checked by passing the same json via postman).

Is there any way that it is possible to get the response in expected way or in some way display buttons on mattermost ?

Hi @rishabh.bhatnagar,

We infer from your explanation that you have provided the button template script as the Mattermost channel response.
The Templates that are available for web/mobile client channel and are specific to webSDK.

Hence, the same template code when given as a response to the Mattermost channel will not get executed.

You will need to use channel-specific template code.
https://docs.mattermost.com/developer/interactive-messages.html

Let us know if you need any further clarification.

Regards,
Yoga Ramya