У меня есть бот, который хорошо справляется с желанием использовать Dialogflow для Slack. Однако я не знаю, как поступить с ответом на welcome intent
, чтобы запустить второй пост. Действительно, welcome intent
, который выводит контекст await_answer1
, показывает следующий шаблон в json:
{
"slack": {
"text": "",
"attachments": [
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*How have you been feeling?* Poll by <fakeLink.toUser.com|Mihailo>"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":tired_face: *I’ve been feeling more exasperated and hopeless*"
},
"accessory": {
"type": "button",
"text": {
"emoji": true,
"type": "plain_text",
"text": "Vote"
},
"value": "1"
}
},
{
"accessory": {
"value": "2",
"type": "button",
"text": {
"emoji": true,
"type": "plain_text",
"text": "Vote"
}
},
"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": "3"
},
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":relieved: *More calm and hopeful*"
}
},
{
"type": "divider"
},
]
}
]
}
}
И я хотел бы обработать ответ. Поэтому я создал намерение answer1
, которое принимает await_answer1
в качестве входного контекста. Обучающие фразы являются выходом из вышеуказанного шаблона: 1
, 2
, 3
, 4
, 5
. И текстовый ответ по умолчанию - Interesting!
Однако после выбора ответа вместо answer1
стоит Fallback intent
. Следовательно, как обработать ответ о пользовательской полезной нагрузке в диалоговом потоке?
Ответ AngelDev
Я попытался включить block_id
:
{
"slack": {
"text": "",
"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"
},
"type": "section",
"block_id": "1",
"text": {
"type": "mrkdwn",
"text": ":tired_face: *I’ve been feeling more exasperated and hopeless*"
}
},
{
"accessory": {
"type": "button",
"text": {
"emoji": true,
"type": "plain_text",
"text": "Vote"
},
"value": "2"
},
"type": "section",
"block_id": "2",
"text": {
"type": "mrkdwn",
"text": ":expressionless: *Generally, less freaked out than other people*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":relieved: *More calm and hopeful*"
},
"accessory": {
"type": "button",
"text": {
"emoji": true,
"type": "plain_text",
"text": "Vote"
},
"value": "3"
}
},
{
"type": "section",
"block_id": "4",
"text": {
"type": "mrkdwn",
"text": ":fearful: *More scared and panicked*"
},
"accessory": {
"value": "4",
"type": "button",
"text": {
"emoji": true,
"type": "plain_text",
"text": "Vote"
}
}
},
{
"type": "section",
"block_id": "5",
"text": {
"type": "mrkdwn",
"text": ":open_mouth: *More surprised and baffled*"
},
"accessory": {
"value": "5",
"type": "button",
"text": {
"emoji": true,
"type": "plain_text",
"text": "Vote"
}
}
}
]
}
]
}
}
Еще, когда я нажимаю на кнопка, на которую бот DialogFlow попадает в намерение DefaultFallback, а не в намерение answer1
, которое должно обрабатывать контекст await_answer1
.