I’m using a web-hook to post a modal interactive message in the slack channel but the message is not displayed in the slack channel
var message={};
var attachments = [];
var attachment = {
"type": "modal",
"submit": {
"type": "plain_text",
"text": "Submit",
"emoji": true
},
"close": {
"type": "plain_text",
"text": "Cancel",
"emoji": true
},
"title": {
"type": "plain_text",
"text": "Your accommodation",
"emoji": true
},
"blocks": [
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Please choose an option where you'd like to stay from Oct 21 - Oct 23 (2 nights).",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Airstream Suite*\n*Share with another person*. Private walk-in bathroom. TV. Heating. Kitchen with microwave, basic cooking utensils, wine glasses and silverware."
},
"accessory": {
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/Streamline-Beach.png",
"alt_text": "Airstream Suite"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "1x Queen Bed"
},
{
"type": "mrkdwn",
"text": "|"
},
{
"type": "mrkdwn",
"text": "$220 / night"
}
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Choose",
"emoji": true
},
"value": "click_me_123"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View Details",
"emoji": true
},
"value": "click_me_123"
}
]
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Redwood Suite*\n*Share with 2 other person*. Studio home. Modern bathroom. TV. Heating. Full kitchen. Patio with lounge chairs and campfire style fire pit and grill."
},
"accessory": {
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/redwoodcabin.png",
"alt_text": "Redwood Suite"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "1x King Bed"
},
{
"type": "mrkdwn",
"text": "|"
},
{
"type": "mrkdwn",
"text": "$350 / night"
}
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "✓ Your Choice",
"emoji": true
},
"style": "primary",
"value": "click_me_123"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View Details",
"emoji": true
},
"value": "click_me_123"
}
]
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Luxury Tent*\n*One person only*. Shared modern bathrooms and showers in lounge building. Temperature control with heated blankets. Lights and electrical outlets."
},
"accessory": {
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/tent.png",
"alt_text": "Redwood Suite"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "1x Queen Bed"
},
{
"type": "mrkdwn",
"text": "|"
},
{
"type": "mrkdwn",
"text": "$260 / night"
}
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Choose",
"emoji": true
},
"value": "click_me_123"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View Details",
"emoji": true
},
"value": "click_me_123"
}
]
},
{
"type": "divider"
}
]
};
attachments.push(attachment);
message.attachments = attachments;
print(JSON.stringify(message));