为什么在dialogflow中创建的丰富消息不会出现在经过Slack测试的机器人中?

莫妮卡的革命

我为“默认欢迎意图”创建了两个答案。

默认情况下,一个作为文本响应显示在Slack中,另一个作为文本响应显示在Slack中,另一个使用Slack作为我的机器人的通道,单击“添加响应”以开始使用Dialogflows UI为Slack创建响应。

第二个是以下内容,从docs轮询的默认模板

{
    "blocks": [
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "*Where should we order lunch from?* Poll by <fakeLink.toUser.com|Mark>"
            }
        },
        {
            "type": "divider"
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": ":sushi: *Ace Wasabi Rock-n-Roll Sushi Bar*\nThe best landlocked sushi restaurant."
            },
            "accessory": {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "Vote"
                },
                "value": "click_me_123"
            }
        },
        {
            "type": "context",
            "elements": [
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_1.png",
                    "alt_text": "Michael Scott"
                },
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_2.png",
                    "alt_text": "Dwight Schrute"
                },
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_3.png",
                    "alt_text": "Pam Beasely"
                },
                {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "3 votes"
                }
            ]
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": ":hamburger: *Super Hungryman Hamburgers*\nOnly for the hungriest of the hungry."
            },
            "accessory": {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "Vote"
                },
                "value": "click_me_123"
            }
        },
        {
            "type": "context",
            "elements": [
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_4.png",
                    "alt_text": "Angela"
                },
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_2.png",
                    "alt_text": "Dwight Schrute"
                },
                {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "2 votes"
                }
            ]
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": ":ramen: *Kagawa-Ya Udon Noodle Shop*\nDo you like to shop for noodles? We have noodles."
            },
            "accessory": {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "Vote"
                },
                "value": "click_me_123"
            }
        },
        {
            "type": "context",
            "elements": [
                {
                    "type": "mrkdwn",
                    "text": "No votes"
                }
            ]
        },
        {
            "type": "divider"
        },
        {
            "type": "actions",
            "elements": [
                {
                    "type": "button",
                    "text": {
                        "type": "plain_text",
                        "emoji": true,
                        "text": "Add a suggestion"
                    },
                    "value": "click_me_123"
                }
            ]
        }
    ]
}

打个招呼时,它应该提供如下图所示的图像:

对话

但是,如果在Integrations中启动测试后出现第一条消息,则即使在右侧的小对话框中也不会显示第二条消息。

在此处输入图片说明

I thought the problem would be that I needed to make the bot public as it seems that to use rich messages, we have to copy the ‘Events Request URL' value given by Dialogflow and paste it into the 'Request URL' field from the Interactive Messages section of my Slack app settings. But the bot don't even retrieve the default message.

Steps I followed to implement my bot

  • In the Slack app, go to the 'Bot users' section and click the 'Add a Bot User' button.
  • In the Slack app ‘Basic Information’ section, copy the 'Client ID', 'Client Secret' and 'Verification Token' and paste their values into the respective fields below.
  • Start the bot.
  • Copy the 'OAuth URL' value below and paste it into the 'Redirect URL(s)' field from the ‘OAuth & Permissions’ section of your Slack app settings. Save URLs.
  • Copy Events Request URL from the field below and paste it to Request URL in the ‘Events Subscription’ section of your Slack app.
  • Enable events in the ‘Event Subscriptions’ section.
  • Select necessary events in "Subscribe to Bot Events" section for example message.im, message.group, message.channel, im_created. These events will define which message types (direct, in channel, etc.) your bot will react to. Save changes. I selected message.im, message.groups, message.channels, im_created
  • In the Slack app settings, go to 'Manage Distribution' and add the bot to your Slack team using the 'Add to Slack' button (it bugged there)
Jordi

为了能够使用自定义有效负载发送所需的响应,您应该首先添加Dialogflow向松弛发送请求所需的格式。

{
  "slack": {
    "text": "Testing custom payloads",
    "attachments": []
  }
}

在附件中,添加阻止格式,然后它应将消息发送到您的机器人。

在此处输入图片说明

最终消息如下所示:

{
  "slack": {
    "text": "",
    "attachments": [{
    "blocks": [
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "*Where should we order lunch from?* Poll by <fakeLink.toUser.com|Mark>"
            }
        },
        {
            "type": "divider"
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": ":sushi: *Ace Wasabi Rock-n-Roll Sushi Bar*\nThe best landlocked sushi restaurant."
            },
            "accessory": {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "Vote"
                },
                "value": "click_me_123"
            }
        },
        {
            "type": "context",
            "elements": [
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_1.png",
                    "alt_text": "Michael Scott"
                },
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_2.png",
                    "alt_text": "Dwight Schrute"
                },
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_3.png",
                    "alt_text": "Pam Beasely"
                },
                {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "3 votes"
                }
            ]
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": ":hamburger: *Super Hungryman Hamburgers*\nOnly for the hungriest of the hungry."
            },
            "accessory": {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "Vote"
                },
                "value": "click_me_123"
            }
        },
        {
            "type": "context",
            "elements": [
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_4.png",
                    "alt_text": "Angela"
                },
                {
                    "type": "image",
                    "image_url": "https://api.slack.com/img/blocks/bkb_template_images/profile_2.png",
                    "alt_text": "Dwight Schrute"
                },
                {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "2 votes"
                }
            ]
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": ":ramen: *Kagawa-Ya Udon Noodle Shop*\nDo you like to shop for noodles? We have noodles."
            },
            "accessory": {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "emoji": true,
                    "text": "Vote"
                },
                "value": "click_me_123"
            }
        },
        {
            "type": "context",
            "elements": [
                {
                    "type": "mrkdwn",
                    "text": "No votes"
                }
            ]
        },
        {
            "type": "divider"
        },
        {
            "type": "actions",
            "elements": [
                {
                    "type": "button",
                    "text": {
                        "type": "plain_text",
                        "emoji": true,
                        "text": "Add a suggestion"
                    },
                    "value": "click_me_123"
                }
            ]
        }
    ]
}]
  }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

GraphAPI架构扩展不会出现在消息中

来自分类Dev

为什么ser.readline数据不会出现在mysql中?

来自分类Dev

知道为什么矩形不会出现在我的Fabricjs画布中吗?

来自分类Dev

为什么我的CardView不会出现在我的片段中?

来自分类Dev

为什么meta box不会出现在WordPress Add New UI中?

来自分类Dev

为什么输入#名称会出现在输出中?

来自分类Dev

经过SAML身份验证的用户不会出现在Spring Security的SessionRegistry中

来自分类Dev

经过SAML身份验证的用户不会出现在Spring Security的SessionRegistry中

来自分类Dev

为什么我的应用程序不会出现在应用程序商店或iTunes搜索中?

来自分类Dev

当有人登录时,为什么/ bin / login不会出现在ps输出中

来自分类Dev

时代精神记录的假小子笔记不会出现在Unity破折号中。为什么不?

来自分类Dev

为什么 MYVAR=something 不会出现在 printenv 中?这与 getenv 函数有关吗?

来自分类Dev

为什么在发出发布请求时用户名不会出现在我的负载中?

来自分类Dev

为什么AdMob测试广告会出现在我的应用中,但实际的广告却不再显示?

来自分类Dev

发送到ASL的日志消息不会出现在查询中

来自分类Dev

发送到ASL的日志消息不会出现在查询中

来自分类Dev

为什么硬件故障不会出现在编程语言级别?

来自分类Dev

为什么QToolTips不会出现在QMenu的QActions上

来自分类Dev

为什么我的精灵不会出现在我的背景之上?

来自分类Dev

为什么我的acf自定义字段不会出现在某个位置?

来自分类Dev

为什么即使禁用了AdBlock,弹出窗口也不会出现在Firefox上?

来自分类Dev

为什么Skype不会出现在“设置”>“隐私”下?

来自分类Dev

为什么我的推文按钮不会出现在我的页面上?

来自分类Dev

创建新的应用程序项目时,合金选项不会出现在 appcelerator 中

来自分类Dev

作为 Slack 机器人回复丰富的消息

来自分类Dev

UIBarButtonItems不会出现在导航栏中

来自分类Dev

哪些字符永远不会出现在URL中?

来自分类Dev

ImageView永远不会出现在Android LinearLayout中

来自分类Dev

在Eclipse中,Glass不会出现在DDMS下

Related 相关文章

  1. 1

    GraphAPI架构扩展不会出现在消息中

  2. 2

    为什么ser.readline数据不会出现在mysql中?

  3. 3

    知道为什么矩形不会出现在我的Fabricjs画布中吗?

  4. 4

    为什么我的CardView不会出现在我的片段中?

  5. 5

    为什么meta box不会出现在WordPress Add New UI中?

  6. 6

    为什么输入#名称会出现在输出中?

  7. 7

    经过SAML身份验证的用户不会出现在Spring Security的SessionRegistry中

  8. 8

    经过SAML身份验证的用户不会出现在Spring Security的SessionRegistry中

  9. 9

    为什么我的应用程序不会出现在应用程序商店或iTunes搜索中?

  10. 10

    当有人登录时,为什么/ bin / login不会出现在ps输出中

  11. 11

    时代精神记录的假小子笔记不会出现在Unity破折号中。为什么不?

  12. 12

    为什么 MYVAR=something 不会出现在 printenv 中?这与 getenv 函数有关吗?

  13. 13

    为什么在发出发布请求时用户名不会出现在我的负载中?

  14. 14

    为什么AdMob测试广告会出现在我的应用中,但实际的广告却不再显示?

  15. 15

    发送到ASL的日志消息不会出现在查询中

  16. 16

    发送到ASL的日志消息不会出现在查询中

  17. 17

    为什么硬件故障不会出现在编程语言级别?

  18. 18

    为什么QToolTips不会出现在QMenu的QActions上

  19. 19

    为什么我的精灵不会出现在我的背景之上?

  20. 20

    为什么我的acf自定义字段不会出现在某个位置?

  21. 21

    为什么即使禁用了AdBlock,弹出窗口也不会出现在Firefox上?

  22. 22

    为什么Skype不会出现在“设置”>“隐私”下?

  23. 23

    为什么我的推文按钮不会出现在我的页面上?

  24. 24

    创建新的应用程序项目时,合金选项不会出现在 appcelerator 中

  25. 25

    作为 Slack 机器人回复丰富的消息

  26. 26

    UIBarButtonItems不会出现在导航栏中

  27. 27

    哪些字符永远不会出现在URL中?

  28. 28

    ImageView永远不会出现在Android LinearLayout中

  29. 29

    在Eclipse中,Glass不会出现在DDMS下

热门标签

归档