I need help with a webhook to Zapier

Ok, set the import statement on top of your code

import {fetch} from 'wix-fetch';

and then if you have a button or whatever try this code and modify for your project, it’s working to send whatever you want to Zapier.

function sendButton_click(event,$w){
 //When the send button has been clicked we need to post the forms data to Zapier
 consturl="yourzapierwebhookaddresshere/";
 letfrom=$w("#from").value;
 letto=$w("#to").value;
 letsubject=$w("#subject").value;
 letmessage=$w("#message").value;
 letdata={"from":from,"to":to,"subject":subject,"message":message};
 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("#sendButton").disable();
 $w("#sendButton").label="Thanks for submitting the data!";
    })
    .catch(err=>console.log(err));
}