Reputation: 11
Using Zapier, I'm trying to set up a Zap that will run once a day and go through a spreadsheet to pick up anything with a specific keyword and add it to another sheet, remove it from the original sheet, and rinse and repeat. I'm using Daily Schedule trigger to run some Python code with a Post function to send the webhook. The URL links to another Zap with a Catch Hook trigger, which should execute when that webhook comes in to run through the steps to adjust the spreadsheets, and then concludes with an A/B path which will repeat the webhook if there are still more instances of the keyword to move/delete. However, my Zap is not triggering to the webhook, and I'm not sure why. I'm very new to webhooks and been unable to find an answer on my own.
import requests
hookUrl = 'https://hooks.zapier.com/hooks/catch/123456/1abcd2/'
id = input.get('value')
response = requests.post(hookUrl, id)
id = int(id)+1
return {'value': id}
I would expect the code to execute a post to the webhook URL and trigger the Zap, but the Zap does not react. The code executes successfully otherwise with returning the incremented ID.
Any insight?
Upvotes: 0
Views: 362
Reputation: 11
Here's what worked:
import requests
hookUrl = 'https://hooks.zapier.com/hooks/catch/123456/1abcd2/'
payload = {'id': input.get('value')}
r = requests.post(hookUrl, data=payload)
id = int(input.get('value'))+1
return {'value': id}
The error was in not defining a key for the variable now called payload
. Once the key was added to keep the JSON formatting (thank you, xavdid!), it worked like a charm. Now, I have a Zap that sends out this webhook every day at midnight, which runs a DIFFERENT Zap with a final pathing step which either a.) terminates the Zap or b.) sends a webhook and loops the Zap again, depending on whether any entries in a Spreadsheet with a given variable still exist.
Thanks for the help!
Upvotes: 1