Hi everyone,
I am using Airtable as an external database for my Wix Collections. It is a database of companies with various data for each of them. Please note that I am not a developer (unfortunately!). I have no problem adding an item (i.e a company) to my collections using Zapier / Webhook.
Now, I need to be able to remove specific items/rows (i.e companies) from my collections, using the same method (Zapier/Webhook). Here is the workflow: new event in a view in Airtable → triggers a Zap Webhook (with the name of a company in a data field - I want to remove that company and all its data from my Wix collection/dataset) → remove the row in the collection that corresponds to that company name. My function is called “removedealflow”.
Here is my code, so far:
export function post_removedealflow (request)
{ let dataCollectionName = “Dealflow” ;
request.body.json()
.then (body=> {
wixData.query( “dataCollectionName” )
.find()
.then( (results) => {
let item = results.items[ 0 ];
let id = item._id;
wixData.remove( “Dealflow” , id)
})
. catch (err=> response ({status: 500 , body: err}));
});
}
This doesn’t work. When I test this code in Zapier / Webhook, it returns " The app returned Internal Server Error" (nb: my collection has all the appropriate permissions).
Any suggestion to make that code work? Once I can add and remove items in my Wix collections with Airtable/Zapier, I would be the happiest man on Earth! Thanks in advance for your help!!