Skip to content

Instantly share code, notes, and snippets.

@mepesh
Created May 15, 2020 15:56
Show Gist options
  • Save mepesh/31ce00547e4b0c98b8e0a1ecc5db27cd to your computer and use it in GitHub Desktop.
Save mepesh/31ce00547e4b0c98b8e0a1ecc5db27cd to your computer and use it in GitHub Desktop.
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