Created
May 15, 2020 15:56
-
-
Save mepesh/31ce00547e4b0c98b8e0a1ecc5db27cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.route("/elements/multiple_card", methods=['POST']) | |
def multiple_card(): | |
data = news['data'] | |
data1 = data[0] | |
data2 = data[1] | |
data3 = data[2] | |
response = [{ | |
"card":{ | |
"title":data1['title'], | |
"subtitle":data1['source'], | |
"imageUri":data1['image_url'], | |
"buttons":[ | |
{ | |
"text":"Read Full Story", | |
"postback":data1['url'] | |
}, | |
{ | |
"text":"Corona Symptoms", | |
"postback":"symptoms" | |
} | |
] | |
}, | |
"platform":"FACEBOOK" | |
}, | |
{ | |
"card":{ | |
"title":data2['title'], | |
"subtitle":"Source "+data2['source']+" >>", | |
"imageUri":data2['image_url'], | |
"buttons":[ | |
{ | |
"text":"Read Full Story", | |
"postback":data2['url'] | |
}, | |
{ | |
"text":"Live Nepal Data", | |
"postback":"live-nepal-data" | |
} | |
] | |
}, | |
"platform":"FACEBOOK" | |
}, | |
{ | |
"card":{ | |
"title":data3['title'], | |
"subtitle":"Source "+data3['source']+" >>", | |
"imageUri":data3['image_url'], | |
"buttons":[ | |
{ | |
"text":"Read Full Story", | |
"postback":data3['url'] | |
}, | |
{ | |
"text":"Self Isolation", | |
"postback":"self isolation" | |
} | |
] | |
}, | |
"platform":"FACEBOOK" | |
}, | |
{ | |
"text":{"text":["Dummy text"]} | |
}, | |
] | |
reply = { "fulfillmentMessages": response } | |
return jsonify(reply) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment