Sending Webhook from Shopify

Hi! I am trying to send a webhook from Shopify button on our storefront (when someone submits email for newsletter). It is not being sent to POST API with the webhook input configured. I tried using the Xano AI which gave the code is below. I tried this but still nothing is happening on the browser inspect network tab. This button is working when using n8n webhook, but would like to skip that and send straight to Xano. Any help would be greatly appreciated, thank you!

function sendWebhook(url, payload) { fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }) .then(response => response.json()) .then(data => console.log('Success:', data)) .catch((error) => console.error('Error:', error)); }

// Example usage const url = 'https://your-xano-api-endpoint'; // Replace with your Xano Webhook URL const payload = { key1: 'value1', key2: 'value2' };

sendWebhook(url, payload);

3 replies