Hi, I can’t set up a webhook.
I use code from here:
from flask import Flask, request, abort, jsonify
app = Flask(__name__)
@app.route('/webhook', methods=s'POST'])
def webhook():
if request.method == 'POST':
data = request.get_json()
challenge = datat'challenge']
return jsonify({'challenge': challenge})
# print(request.json)
# return 'success', 200
else:
abort(400)
if __name__ == '__main__':
app.run(debug=True)
But it didnt work.
For url generation i use ngrok.
I see challenges in ngrok:
{
"challenge": "UEkR7-4VSXqp34ve39ghi8qLJew1qsjEI69Y2TLfvuq6SDAEJ-z88gZHHW3yPBHSV9HfwGOeLlAOwlp7qzAIUQ"
}
But ngrok terminal:
POST / 404 NOT FOUND
And python terminal:
* Serving Flask app 'app'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: ****
127.0.0.1 - - -04/Dec/2023 14:48:13] "POST / HTTP/1.1" 404 -
What am I doing wrong?