Last active
January 9, 2017 03:22
-
-
Save mbrevoort/888100d20ce3f98a101385c84793a8b1 to your computer and use it in GitHub Desktop.
Slack Message Builder Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const smb = require('slack-message-builder') | |
smb() | |
.text("Would you like to play a game?") | |
.attachment() | |
.text("Choose a game to play") | |
.fallback("You are unable to choose a game") | |
.callbackId("wopr_game") | |
.color("#3AA3E3") | |
.action() | |
.name("chess") | |
.text("Chess") | |
.type("button") | |
.value("chess") | |
.end() | |
.action() | |
.name("maze") | |
.text("Falken's Maze") | |
.type("button") | |
.value("maze") | |
.end() | |
.action() | |
.name("war") | |
.text("Thermonuclear War") | |
.style("danger") | |
.type("button") | |
.value("war") | |
.confirm() | |
.title("Are you sure?") | |
.text("Wouldn't you prefer a good game of chess?") | |
.okText("Yes") | |
.dismissText("No") | |
.end() | |
.end() | |
.end() | |
.json() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"text": "Would you like to play a game?", | |
"attachments": [ | |
{ | |
"text": "Choose a game to play", | |
"fallback": "You are unable to choose a game", | |
"callback_id": "wopr_game", | |
"color": "#3AA3E3", | |
"actions": [ | |
{ | |
"name": "chess", | |
"text": "Chess", | |
"type": "button", | |
"value": "chess" | |
}, | |
{ | |
"name": "maze", | |
"text": "Falken's Maze", | |
"type": "button", | |
"value": "maze" | |
}, | |
{ | |
"name": "war", | |
"text": "Thermonuclear War", | |
"style": "danger", | |
"type": "button", | |
"value": "war", | |
"confirm": { | |
"title": "Are you sure?", | |
"text": "Wouldn't you prefer a good game of chess?", | |
"ok_text": "Yes", | |
"dismiss_text": "No" | |
} | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment