Question

Troubleshooting Webhook POSTING to Flask Server

  • 11 February 2022
  • 2 replies
  • 192 views

Userlevel 1

I am trying to use my Flask server to receive webhooks from a Zap, but getting an error when I test:

 

Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
TypeError: receive_webhook() missing 1 required positional argument: 'request'

 

Here is my handler for the webhook:

@app.route("/webhook", methods=['POST'])
def receive_webhook(request):
print(request.json)

return request.json

 

It seems like Zapier is calling my handler with no argument. Shouldn’t it be passing the payload as that argument or am I misunderstanding something here? 

 

Thanks for any assistance.


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +11

Hey @podcastpartnership,

Hmm, are you seeing any errors in the Zap history or is the webhook marked as having been sent successfully?

It’s not clear how the Webhooks by Zapier step has been configured in your Zap. Are you using the Post or Custom Request option to generate the POST request to your Flask server?

Can you please share a screenshot of the full set up of the webhook step here? This will help folks in Community to better assist you. Please make sure to remove any Personally Identifiable Information from the screenshot first though.

Look forward to hearing from you! :relaxed:

Userlevel 1

Thanks for your response @SamB! Allow me to answer your questions:

 

Hmm, are you seeing any errors in the Zap history or is the webhook marked as having been sent successfully?

 

Nothing in Zap history, as I am testing the webhook step in isolation in the editor before turning it on.

 

It’s not clear how the Webhooks by Zapier step has been configured in your Zap. Are you using the Post or Custom Request option to generate the POST request to your Flask server?

 

I am using a POST. Here’s the screenshots of the step:

 

 

 

 

Thank you! Let me know if there’s anything else I can provide.