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

问题描述 投票:1回答:1

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

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

第二个是以下,a default template for polling from the 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"
                }
            ]
        }
    ]
}

当打​​个招呼时,它应该给出如下图所示的内容:

dialog

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

enter image description here

我以为问题是因为我需要公开bot,因为要使用丰富消息,我们必须复制Dialogflow给出的'Events Request URL'值并将其粘贴到我的Slack应用设置的“交互式消息”部分。但是该漫游器甚至都不会检索默认消息。

我实现我的机器人所遵循的步骤

  • 在Slack应用中,转到“ Bot用户”部分,然后单击“添加Bot用户”按钮。
  • 在Slack应用的“基本信息”部分中,复制“客户ID”,“客户机密”和“验证令牌”,并将其值粘贴到下面的相应字段中。
  • 启动机器人。
  • 复制下面的'OAuth URL'值,然后将其粘贴到Slack应用设置的'OAuth&Permissions'部分的'Redirect URL(s)字段中。保存网址。
  • 从下面的字段复制事件请求URL,并将其粘贴到Slack应用的“事件订阅”部分中的“请求URL”。>
  • 在“事件订阅”部分中启用事件。
  • 在“订阅Bot事件”部分中选择必要的事件,例如message.im,message.group,message.channel,im_created。这些事件将定义您的机器人将响应的消息类型(直接消息,通道消息等)。保存更改。我选择了message.im,message.groups,message.channels,im_created
  • 在Slack应用程序设置中,转到“管理发行版”,然后使用“添加到Slack”按钮(已在此处进行错误检查)将漫游器添加到Slack团队中。

我为默认的欢迎意图创建了两个答案。默认情况下,一个作为文本响应显示在Slack中,另一个作为文本响应显示在Slack中,单击...

json dialogflow chatbot slack slack-api
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.