代码之家  ›  专栏  ›  技术社区  ›  user3855877

从Lambda返回给Lex的带有附件的响应卡不包含附件

  •  0
  • user3855877  · 技术社区  · 7 年前

    我使用Python编写的AWS Lambda函数返回带有附件的响应卡(根据 https://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html#using-lambda-response-format Hyperlink in response card button in Amazon Lex

    image

    def close_response_card(session_attributes, fulfillment_state, message):
        return {
        'sessionAttributes': session_attributes,
        "dialogAction": {
            "type": "Close",
            "fulfillmentState": fulfillment_state,
            'message': message,
            "responseCard": {
                "version": 1,
                "contentType": "application/vnd.amazonaws.card.generic",
                'genericAttachments': [
                    {
                        'title': 'Here is a list of hospitals',
                        'subTitle': 'Below is a map',
                        'attachmentLinkUrl': 'https://www.google.com/maps/search/?api=1&query=nearby+hospitals',
                        'imageUrl': 'https://images.sftcdn.net/images/t_optimized,f_auto/p/95612986-96d5-11e6-af7c-00163ec9f5fa/3771854867/google-maps-screenshot.png'
                }
            ]
         }
      }
        }
    

    我想创建一张卡片,让用户在点击卡片后下载一些文件。

    0 回复  |  直到 7 年前