Integration
Node.js backend integration.
Use this general server-side example as the starting point for jobs, articles, products, listings, events, announcements, or custom content.
Node.js
How this integration works
Use this in an Express, Next.js API route, NestJS, or background worker.
Keep your zedgad API key on the server. The integration sends a title, summary, public URL, optional image URL, and any useful metadata to the project webhook.
- Keep the file in a server-only folder such as integrations/zedgad.js.
- Use a server environment variable for ZEDGAD_API_KEY.
- Call sendContentToZedgad from the code path that publishes your content.
Node.js
Create integrations/zedgad.js
Replace the sample content fields with your own model fields. The important part is that zedgad receives a stable ID, content type, title, summary, public URL, optional image URL, and any metadata you want to keep with the post.
integrations/zedgad.js
const ZEDGAD_API_KEY = process.env.ZEDGAD_API_KEY;
const ZEDGAD_WEBHOOK_URL = "https://api.zedgad.com/api/webhooks/content/";
export async function sendContentToZedgad(content) {
const response = await fetch(ZEDGAD_WEBHOOK_URL, {
method: "POST",
headers: {
Authorization: `Bearer ${ZEDGAD_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
external_id: String(content.id),
type: content.type || "article",
title: content.title,
summary: content.summary,
url: content.publicUrl,
image_url: content.imageUrl,
metadata: {
source: content.source || "website",
category: content.category,
},
}),
});
if (!response.ok) {
throw new Error(`zedgad request failed: ${response.status}`);
}
return response.json();
}