I need help with a webhook to Zapier

Hi Andreas, I did your ‘send data to google sheets course’ and wrote the below code:

//In this codesample we will post data from Wix Code to a Google Sheet

import {fetch} from ‘wix-fetch’;
//We need this to use the fetch command

export function button1_click(event,$w){
//When the send button has been clicked we need to post the forms data to Zapier
const url = “https://hooks.zapier.com/hooks/catch/2560455/ady1ss/”;

let firstName = $w(“#firstName”).value;
let lastName = $w(“#lastName”).value;
let contactEmail = $w(“#contactEmail”).value;
let contactCompany =$w (“#contactCompany”).value;
let contactNumber = $w(“#contactNumber”).value;
let contactStaffN = $w(“#contactStaffN”).value;
let contactComments = $w(“#contactComments”).value;
let data = {
“firstName”:firstName,
“lastName”:lastName,
“contactEmail”:contactEmail,
“contactCompany”:contactCompany,
“contactNumber”:contactNumber,
“contactStaffN”:contactStaffN,
“contactComments”:contactComments
};
console.log(data);
varbodyData=JSON.stringify(data);

fetch (url,{method:'post',body:bodyData}) 
.then((httpResponse)=>{ 
    if(httpResponse.ok){ 
        returnhttpResponse.json(); 
    }else{ 
        returnPromise.reject("Fetchdidnotsucceed"); 
    } 
}) 
.then(json=>{ 
    console.log(JSON.stringify(json)); 
    $w("#button1").disable(); 
    $w("#button1").label="Thanks for submitting the data!"; 
}) 
.catch(err=>console.log(err)); 

}

I keep getting error messages from Wix though so could you or someone else be able to point out what I am doing wrong! Thanks :slight_smile: