В настоящее время я пытаюсь добавить кнопки быстрого ответа в свой чат-бот для обмена сообщениями, который я разработал с помощью Amazon Lex и Python в Amazon Lambda. Я нашел это на сайте Facebook для разработчиков:
curl -X POST -H "Content-Type: application/json" -d '{
"recipient":{
"id":"<PSID>"
},
"message":{
"text": "Here's a quick reply!",
"quick_replies":[
{
"content_type":"text",
"title":"Search",
"payload":"<POSTBACK_PAYLOAD>",
"image_url":"http://example.com/img/red.png"
},
{
"content_type":"location"
},
{
"content_type":"text",
"title":"Something Else",
"payload":"<POSTBACK_PAYLOAD>"
}
]
}
}' "https://graph.facebook.com/v2.6/me/messages?access_token=<PAGE_ACCESS_TOKEN>"
Я пробовал искать решения, но для них требуется библиотека fbmessenger. Я надеялся использовать библиотеку urllib вместо библиотек с открытым исходным кодом. Есть ли этому решение?
Кнопка быстрого ответа в Messenger
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"
}
]
}
]
}
)