【问题标题】:Botkit reply with an imageBotkit 回复图片
【发布时间】:2018-12-04 21:46:07
【问题描述】:

您好,我试图在我的回调函数中使用图像进行 botkit 回复,但不确定 convo.say()bot.reply() 将如何处理发送图像。有没有人有让 slackbot 回复图片的经验?

【问题讨论】:

    标签: node.js slack-api botkit


    【解决方案1】:

    由于您使用的是 slack,因此应该可以使用交互式消息。

    这是来自 slack 自己的交互式消息文档的示例消息对象(可在此处找到:https://api.slack.com/docs/message-buttons

    {
        "text": "New comic book alert!",
        "attachments": [
            {
                "title": "The Further Adventures of Slackbot",
                "fields": [
                    {
                        "title": "Volume",
                        "value": "1",
                        "short": true
                    },
                    {
                        "title": "Issue",
                        "value": "3",
                "short": true
                    }
                ],
                "author_name": "Stanford S. Strickland",
                "author_icon": "http://a.slack-edge.com/7f18https://a.slack-edge.com/a8304/img/api/homepage_custom_integrations-2x.png",
                "image_url": "http://i.imgur.com/OJkaVOI.jpg?1"
            },
            {
                "title": "Synopsis",
                "text": "After @episod pushed exciting changes to a devious new branch back in Issue 1, Slackbot notifies @don about an unexpected deploy..."
            },
            {
                "fallback": "Would you recommend it to customers?",
                "title": "Would you recommend it to customers?",
                "callback_id": "comic_1234_xyz",
                "color": "#3AA3E3",
                "attachment_type": "default",
                "actions": [
                    {
                        "name": "recommend",
                        "text": "Recommend",
                        "type": "button",
                        "value": "recommend"
                    },
                    {
                        "name": "no",
                        "text": "No",
                        "type": "button",
                        "value": "bad"
                    }
                ]
            }
        ]
    }
    

    您也可以从这里https://api.slack.com/docs/messages/builder创建自己的自定义消息

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-04
      相关资源
      最近更新 更多