@app.route('/', methods=['GET', 'POST'])
def webhook():
    if (request.method == 'GET'):
        return 'Line Webhook Success.'
    elif (request.method == 'POST'):
        body = request.get_data(as_text=True)
        signature = request.headers['X-Line-Signature']
        linebot = Linebot(LINE_ACCESS_TOKEN, LINE_CHANNEL_SECRET)
        dataLIST = linebot.parse(body, signature)
        for dataDICT in dataLIST:
            if dataDICT['status']:
                if (dataDICT['type'] == 'message'):
                    try:
                        msgSTR = '[MSG] {}'.format(dataDICT['message'])
                    except Exception as e:
                        msgSTR = '[ERROR] {}'.format(str(e))
                    linebot.respText(dataDICT['replyToken'], msgSTR)
        return jsonify({'status': True, 'msg': 'Line Webhook Success.'})
    else:
        return 'HTTP_405_METHOD_NOT_ALLOWED'
@app.route('/', methods=['GET', 'POST'])
def webhook():
    if (request.method == 'GET'):
        return 'Line Webhook Success.'
    elif (request.method == 'POST'):
        body = request.get_data(as_text=True)
        signature = request.headers['X-Line-Signature']
        linebot = Linebot(LINE_ACCESS_TOKEN, LINE_CHANNEL_SECRET)
        dataLIST = linebot.parse(body, signature)
        for dataDICT in dataLIST:
            if dataDICT['status']:
                if (dataDICT['type'] == 'message'):
                    try:
                        msgSTR = '[MSG] {}'.format(dataDICT['message'])
                    except Exception as e:
                        msgSTR = '[ERROR] {}'.format(str(e))
                    linebot.respText(dataDICT['replyToken'], msgSTR)
        return jsonify({'status': True, 'msg': 'Line Webhook Success.'})
    else:
        return 'HTTP_405_METHOD_NOT_ALLOWED'