美文网首页
关于Slack消息模式

关于Slack消息模式

作者: 不_一 | 来源:发表于2018-06-14 22:14 被阅读0次
    {
        "text": "This is a line of text.\nAnd this is another one."
    }
    
    普通消息
    {
        "attachments": [
            {
                "fallback": "Required plain-text summary of the attachment.",
                "color": "#36a64f",
                "pretext": "Optional text that appears above the attachment block",
                "author_name": "Bobby Tables",
                "author_link": "http://flickr.com/bobby/",
                "author_icon": "http://flickr.com/icons/bobby.jpg",
                "title": "Slack API Documentation",
                "title_link": "https://api.slack.com/",
                "text": "Optional text that appears within the attachment",
                "fields": [
                    {
                        "title": "Priority",
                        "value": "High",
                        "short": false
                    }
                ],
                "image_url": "http://my-website.com/path/to/image.jpg",
                "thumb_url": "http://example.com/path/to/thumb.png",
                "footer": "Slack API",
                "footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
                "ts": 123456789
            }
        ]
    }
    
    附件
    {
        "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",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "game",
                        "text": "Chess",
                        "type": "button",
                        "value": "chess"
                    },
                    {
                        "name": "game",
                        "text": "Falken's Maze",
                        "type": "button",
                        "value": "maze"
                    },
                    {
                        "name": "game",
                        "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"
                        }
                    }
                ]
            }
        ]
    }
    
    按钮
    {
        "text": "您已设置过的远程工作名单:",
        "attachments": [
            {
                "text": "张三",
                "fallback": "您的日期选择有误 ",
                "callback_id": "start date",
                "color": "#3AA3E3",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "移除 ",
                        "text": ":heavy_multiplication_x:移除",
                        "type": "button",
                        "style": "danger",
                        "value": "days"
                    }
                ]
            },
            {
                "text": "李四",
                "fallback": "您的日期选择有误 ",
                "callback_id": "start date",
                "color": "#3AA3E3",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "移除 ",
                        "text": ":heavy_multiplication_x:移除",
                        "type": "button",
                        "style": "danger",
                        "value": "days"
                    }
                ]
            },
            {
                "text": "王五",
                "fallback": "您的日期选择有误 ",
                "callback_id": "start date",
                "color": "#3AA3E3",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "移除 ",
                        "text": ":heavy_multiplication_x:移除",
                        "type": "button",
                        "style": "danger",
                        "value": "days"
                    }
                ]
            },
            {
                "text": "赵六",
                "fallback": "您的日期选择有误 ",
                "callback_id": "start date",
                "color": "#3AA3E3",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "移除 ",
                        "text": ":heavy_multiplication_x:移除",
                        "type": "button",
                        "style": "danger",
                        "value": "days"
                    }
                ]
            },
            {
                "fallback": "您的日期选择有误 ",
                "callback_id": "start date",
                "color": "#FFFFFF",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "翻页",
                        "text": "保存",
                        "type": "select",
                        "value": "翻页",
                        "options": [
                            {
                                "text": "第1页",
                                "value": "1"
                            }
                        ]
                    },
                    {
                        "name": "移除 ",
                        "text": ":arrow_right:",
                        "type": "button",
                        "value": "days"
                    }
                ]
            },
            {
                "fallback": "您不能提交 ",
                "callback_id": "submit error",
                "color": "FFFFFF",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "close",
                        "text": "关闭",
                        "type": "button",
                        "value": "close"
                    }
                ]
            },
            {
                "text": "您已将王小二移出远程工作名单。",
                "fallback": "您的日期选择有误 ",
                "callback_id": "start date",
                "attachment_type": "default"
            }
        ]
    }
    
    选择框
    {
        "text": "Would you like to play a game?",
        "attachments": [
            {
                "pretext":"hello world",
                "text": "Choose a game to play",
                "fallback": "You are unable to choose a game",
                "callback_id": "wopr_game",
                "color": "#3AA3E3",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "game",
                        "text": "Chess",
                        "type": "button",
                        "value": "chess"
                    },
                    {
                        "name": "game",
                        "text": "Falken's Maze",
                        "type": "button",
                        "value": "maze"
                    },
                    {
                        "name": "game",
                        "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"
                        }
                    }
                ]
            },
             {
                "title": "Title",
                "pretext": "Pretext _supports_ mrkdwn",
                "text": "```Testing right now!```",
                "mrkdwn_in": [
                    "text",
                    "pretext"
                ]
            },
            {
                "pretext":"hello",
                "text": "world",
                "fallback": "You are unable to choose a game",
                "callback_id": "wopr_game",
                "color": "#3AA3E3",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "game",
                        "text": "Chess",
                        "type": "button",
                        "value": "chess"
                    },
                    {
                        "name": "game",
                        "text": "Falken's Maze",
                        "type": "button",
                        "value": "maze"
                    },
                    {
                        "name": "game",
                        "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"
                        }
                    }
                ]
            }
        ]
    }
    
    markdown样式

    相关文章

      网友评论

          本文标题:关于Slack消息模式

          本文链接:https://www.haomeiwen.com/subject/jypueftx.html