const response = await fetch('http://localhost:3010/api/notifications', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer YOUR_API_TOKEN',
},
body: JSON.stringify({
name: 'Price Monitor',
description: 'Monitor product price changes',
url: 'https://example.com/product',
evaluationFunction: `
const price = document.querySelector('.price').textContent;
const numericPrice = parseFloat(price.replace('$', ''));
return numericPrice < 100;
`,
actions: [
{
type: 'email',
config: {
to: '[email protected]',
subject: 'Price Alert!',
},
},
],
}),
});