How to validate a Monday.com Webhook in python

Hi,

I’m trying to send the challenge test using python, I’m stuck with that any input.

jorge

Hey @Jorgemolina,

Thanks for reaching out.

When we send you the challenge, you can just respond with the same data as your app receives. To be transparent with you, I am not a Python developer myself, but this StackOverflow thread seems to provide a quick solution for a similar issue in Python.

I hope this helps clarify.

-Alex

I managed myself, just leave it to get access through webhook using python/flask (this code is just a test but it works

from flask import Flask, request, abort, jsonify

app = Flask(__name__)

@app.route('/webhook', methods=['POST'])
def webhook():
    if request.method == 'POST':
        data = request.get_json()
        challenge = data['challenge']
        
        return jsonify({'challenge': challenge})

        # print(request.json)
        # return 'success', 200
    else:
        abort(400)

if __name__ == '__main__':
    app.run(debug=True)

@Jorgemolina

Thanks so much for sharing your solution with us in the community! If you don’t mind, I could add this to our docs and mention that you’ve provided this code as an example starter solution for validating webhooks via Python.

-Alex

Yes, Alex please use it for your docs. I hope this help.

1 Like

@Jorgemolina

I really appreciate that! Thanks so much for helping us make our API more accessible :slight_smile: Kudos to you, sir!

-Alex

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.