import axios from 'axios';
axios.post('https://api.artificialstudio.ai/api/generate', {
model: 'invitation-designer',
input: {
event_type : "Wedding",
card_style : "Elegant",
color_scheme : "Pastel",
text_content : "John & Sarah
Request the pleasure of your company
As they join in marriage
Saturday, June 15th, 2024
5:00 PM
Sunset Beach Resort",
additional_details : "Include floral elements, gold accents, and a subtle beach theme"
},
webhook: 'https://your-webhook-url.com/api/webhook',
}, {
headers: {
'Content-Type': 'application/json',
'Authorization': 'YOUR_API_KEY'
}
}).then(res => {
console.log('Success:', res.data);
}).catch(error => {
console.error('Error:', error);
});
app.post("/api/webhook", (req: any, res: any) => {
console.log(req.body) // id, output, status, model, payload, error...
res.send("Webhook received");
});