Integration

Python backend integration.

Use this general server-side example as the starting point for jobs, articles, products, listings, events, announcements, or custom content.

Python

How this integration works

Use this in a Django, Flask, FastAPI, or worker-based backend.

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.

  • Install requests if your project does not already use it.
  • Save the file as integrations/zedgad.py or another backend-only module.
  • Call send_content_to_zedgad after your content is saved or published.

Python

Create integrations/zedgad.py

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.py
import os
import requests

ZEDGAD_API_KEY = os.environ["ZEDGAD_API_KEY"]
ZEDGAD_WEBHOOK_URL = "https://api.zedgad.com/api/webhooks/content/"

def send_content_to_zedgad(content):
    payload = {
        "external_id": str(content.id),
        "type": getattr(content, "type", "article"),
        "title": content.title,
        "summary": content.summary,
        "url": content.public_url,
        "image_url": content.image_url,
        "metadata": {
            "source": getattr(content, "source", "website"),
            "category": content.category,
        },
    }

    response = requests.post(
        ZEDGAD_WEBHOOK_URL,
        headers={"Authorization": f"Bearer {ZEDGAD_API_KEY}"},
        json=payload,
        timeout=20,
    )
    response.raise_for_status()
    return response.json()