AWS Lambda失败中的简单Twilio测试

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

我正在尝试设置示例AWS Lambda以响应文本消息。我正在使用Python 3.8,并具有以下非常简单的代码:

def lambda_handler(event, context):
    print("Received event: " + str(event))
    return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Message>Hello world 4! -Lambda</Message></Response>"

这似乎完全返回了API文档中指定的XML格式:

"<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Message>Hello world 4! -Lambda</Message></Response>"

这给了我12200“序言中不允许内容。”错误。我看不到这个XML字符串有什么问题。它看起来完全按照API Doc的说明进行格式化。谁能看到我做错了吗?

twilio twilio-api
1个回答
0
投票

这里是有效的TwiML(不确定为什么要使用引号和转义的引号输出?]。>

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Message>Hello world 4! -Lambda</Message>
</Response>
© www.soinside.com 2019 - 2024. All rights reserved.