Как обрабатывать пользовательские данные в Dialogflow? - PullRequest
0 голосов
/ 24 апреля 2020

У меня есть бот Dialogflow, который запускает контекст await_answer1, который должен обрабатываться намерением answer1. Однако этого никогда не происходит, даже если установить для дескрипторов answer1 контекстов значение await_answer1 и указать входные данные, которые следует ожидать:

enter image description here

await_answer1 получает полезную нагрузку следующей пользовательской полезной нагрузки:

{
  "slack": {
    "attachments": [
      {
        "blocks": [
          {
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": "*How have you been feeling?* Poll by <fakeLink.toUser.com|Mihailo>"
            }
          },
          {
            "type": "divider"
          },
          {
            "accessory": {
              "type": "button",
              "text": {
                "emoji": true,
                "type": "plain_text",
                "text": "Vote"
              },
              "value": "1"
            },
            "block_id": "1",
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": ":tired_face: *I’ve been feeling more exasperated and hopeless*"
            }
          },
          {
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": ":expressionless: *Generally, less freaked out than other people*"
            },
            "accessory": {
              "type": "button",
              "text": {
                "emoji": true,
                "type": "plain_text",
                "text": "Vote"
              },
              "value": "2"
            },
            "block_id": "2"
          },
          {
            "accessory": {
              "type": "button",
              "text": {
                "type": "plain_text",
                "text": "Vote",
                "emoji": true
              },
              "value": "3"
            },
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": ":relieved: *More calm and hopeful*"
            }
          },
          {
            "block_id": "4",
            "accessory": {
              "type": "button",
              "text": {
                "emoji": true,
                "type": "plain_text",
                "text": "Vote"
              },
              "value": "4"
            },
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": ":fearful: *More scared and panicked*"
            }
          },
          {
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": ":open_mouth: *More surprised and baffled*"
            },
            "block_id": "5",
            "accessory": {
              "type": "button",
              "text": {
                "emoji": true,
                "type": "plain_text",
                "text": "Vote"
              },
              "value": "5"
            }
          }
        ]
      }
    ]
  }
}

, которая создает:

enter image description here

Но как единое целое можно увидеть, он не обрабатывает выбранный ответ. Как я могу узнать, что было в выбранном ответе, чтобы увидеть, что его нет в ответах answer1 намерение должно ответить?

С помощью конструктора набора ботов я смог получить полезную нагрузку при нажатии на первый кнопка:

{
    "type": "block_actions",
    "user": {
        "id": "U0CA5",
        "username": "Amy McGee",
        "name": "Amy McGee",
        "team_id": "T3MDE"
    },
    "api_app_id": "A0CA5",
    "token": "Shh_its_a_seekrit",
    "container": {
        "type": "message",
        "text": "The contents of the original message where the action originated"
    },
    "trigger_id": "12466734323.1395872398",
    "team": {
        "id": "T0CAG",
        "domain": "acme-creamery"
    },
    "response_url": "https://www.postresponsestome.com/T123567/1509734234",
    "actions": [
        {
            "type": "button",
            "block_id": "1",
            "action_id": "pvoS",
            "text": {
                "type": "plain_text",
                "text": "Vote",
                "emoji": true
            },
            "value": "1",
            "action_ts": "1587732582.695699"
        }
    ]
}

Но как справиться с такой полезной нагрузкой?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...