def qismo_message(): try: output = request.get_json() participants = output["payload"]["room"]["participants"] recipient_id = helper.search_customer(participants) if recipient_id is None: raise Exception("Customer ID not found") # message_type = output["payload"]["message"]["type"] payload = output["payload"] message = payload["message"] message_type = message["type"] if message_type == "text": text = message["text"] fb.send_message(recipient_id, text) elif message_type == "file_attachment": attachment_payload = message["payload"] caption = attachment_payload["caption"] attachment_url = attachment_payload["url"] # !!!Send file like csv still error fb.send_attachment_message(recipient_id, attachment_url) if caption is not None or caption is not "": fb.send_message(recipient_id, caption) return jsonify(success.message("Success handling Qismo message")), 200 except Exception as e: app.logger.error(str(e)) return jsonify(error.qismo_error(str(e))), 200