I think something goes wrong within my for loop. It's repeat a lot while I want it to post once and then stop. Can someone please check if I miss something in my code?
for entry in incoming_message['entry']:
for message in entry['messaging']:
# Check to make sure the received call is a message call
if 'message' in message:
if 'attachments' in message['message']:
# Send attachment
print(message['message']['attachments'][0]['type'])
post_facebook_message(message['sender']['id'],
message['message']
['attachments'][0]['type'])
continue
else:
pprint(message)
# Assuming the sender only sends text.
post_facebook_message(message['sender']['id'],
message['message']['text'])
break
elif 'postback' in message:
post_facebook_message(message['sender']['id'],
message['postback']['payload'])
break
return HttpResponse()
Aucun commentaire:
Enregistrer un commentaire