Amazon Lex中的Messenger快速回复按钮

2024-05-19 12:04:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在尝试添加快速回复按钮在Facebook信使为我的亚马逊雷克斯聊天机器人。这是我用python编写的代码,但在'responseCard'行中出现语法错误:{

def helpMe(intent_request):

session_attributes = intent_request['sessionAttributes'] if intent_request['sessionAttributes'] is not None else {}

return close(
    session_attributes,
    'Fulfilled',
    {
        'contentType': 'PlainText',
        'content': 'It seems like you need help, let me save you from your misery.\n\n' 
         + '- If you want to find '
         + 'out what insurance plan is suitable for your dear self, try asking me "Which integrated Shield Plan is right for me?".\n\n '
         + '- If you want me to explain about your current plan, you could try asking me ' 
         + '"Explain my current plan".\n\n '
         + '- If you wanna listen to my extremely hilarious puns, just type in "joke" and you will not regret it hehe. '
    },
    'responseCard': {
    'version': '0',
    'contentType': 'application/vnd.amazonaws.card.generic',
    'genericAttachments': [
        {
        'title': 'Help',
        'subTitle': 'Select button of choice',
        'imageUrl': '',
        "buttons":[ 
             {
                "text":"recommend plan",
                "value":"Which integrated Shield Plan is right for me"
             },
             {
                "text":"current plan",
                "value":"Explain my current plan"
             },
             {
                "text":"tell me a joke",
                "value":"joke"
             }
            ]
        }
    ]
    }
)

我找不到解决错误的办法,有人能帮我吗?你知道吗

Facebook Quick Reply Button


Tags: totextyouforyourifisvalue

热门问题