Webhook Integration

Send article data to any URL endpoint whenever you publish. Perfect for custom platforms, automation tools, or building your own integrations.

What You'll Need

  • A public URL endpoint that accepts POST requests
  • The ability to process JSON data
  • Optional: A secret key for authentication

Webhooks work with virtually any service that can receive HTTP requests, including:

  • Automation platforms — Zapier, Make.com, n8n, Pipedream
  • Serverless functions — Vercel Functions, AWS Lambda, Cloudflare Workers
  • Custom applications — Next.js API routes, Express servers, any backend
  • Notification services — Slack, Discord, email services

Setting Up the Integration

Step 1: Add Webhook Integration

  1. Navigate to Integrations in the Lovarank sidebar
  2. Click Create Integration
  3. Select Webhooks from the options

Step 2: Configure Your Endpoint

Enter your webhook details:

  • Integration Name — A friendly name to identify this webhook
  • Webhook URL — The full URL of your endpoint (must be publicly accessible)
  • Secret Key — Optional authentication token for securing requests

Step 3: Test Your Connection

After saving, use the Send Test button to verify your endpoint:

  1. Click Send Test in the webhook settings
  2. Check your endpoint received the test payload
  3. Verify the response status is 200 OK

Test payloads include "test": true so you can identify them in your code.

How It Works

When you publish an article, Lovarank sends a POST request to your webhook URL containing:

{
  "title": "Your Article Title",
  "content_html": "<h1>Your Article</h1><p>Full HTML content...</p>",
  "content_markdown": "# Your Article\n\nFull Markdown content...",
  "slug": "your-article-title",
  "meta_description": "SEO description for the article",
  "status": "published",
  "featured_image": "https://...",
  "published_url": null,
  "scheduled_date": null,
  "published_at": "2024-03-15T10:30:00Z",
  "is_republish": false,
  "test": false
}

Payload Fields

FieldDescription
titleThe article headline
content_htmlFull article in HTML format
content_markdownFull article in Markdown format
slugURL-friendly identifier (stays constant on updates)
meta_descriptionSEO meta description
statusAlways "published" when webhook fires
featured_imageURL to the featured image, if set
published_urlWhere the article was published, if available
scheduled_dateOriginal scheduled date, if article was scheduled
published_atTimestamp when the webhook was sent
is_republishtrue when updating an existing article
testtrue for test payloads from "Send Test" button

Authentication

If you provide a Secret Key, Lovarank sends it in the Authorization header:

Authorization: Bearer your-secret-key

This Bearer token format works seamlessly with:

  • Zapier webhook triggers
  • Make.com HTTP modules
  • Custom API authentication middleware

Validating the Token

In your endpoint, compare the Authorization header:

export default function handler(req, res) {
  const authHeader = req.headers['authorization'];
  const expected = `Bearer ${process.env.LOVARANK_WEBHOOK_SECRET}`;

  if (authHeader !== expected) {
    return res.status(401).json({ error: 'Unauthorized' });
  }

  // Process the article...
  const article = req.body;
  console.log('Received:', article.title);

  res.status(200).json({ success: true });
}

Handling Updates

When you update and republish an article, the webhook fires again with is_republish: true. Use the slug field to identify which article to update:

const article = req.body;

if (article.is_republish) {
  // Update existing article by slug
  await db.articles.update({
    where: { slug: article.slug },
    data: {
      title: article.title,
      content_html: article.content_html,
      meta_description: article.meta_description,
    }
  });
} else {
  // Create new article
  await db.articles.create({
    data: {
      slug: article.slug,
      title: article.title,
      content_html: article.content_html,
      meta_description: article.meta_description,
    }
  });
}

Many databases support "upsert" operations that handle both cases automatically.

Common Use Cases

Zapier Integration

  1. Create a Webhooks by Zapier trigger with "Catch Hook"
  2. Copy the Zapier webhook URL
  3. Paste it in Lovarank's webhook settings
  4. Add the Zapier-provided secret as your Secret Key
  5. Build your Zap to process incoming articles

Custom Static Site

For Next.js, Hugo, Jekyll, or similar:

  1. Create an API endpoint to receive webhooks
  2. Write article data to your content directory
  3. Trigger a site rebuild
  4. Optionally push to your Git repository

Notification Systems

Send article notifications to your team:

  1. Receive the webhook
  2. Format a message with the article title and link
  3. Post to Slack, Discord, or send via email

Request Headers

Every webhook request includes:

HeaderValue
Content-Typeapplication/json
User-AgentLovarank-Webhook/1.0
Accept*/*
AuthorizationBearer <your-secret-key> (if configured)

Troubleshooting

401 Unauthorized

  • Verify your endpoint expects Bearer token authentication
  • Check the Secret Key matches what your endpoint expects
  • Ensure there are no extra spaces in your secret

403 Forbidden

  • Your server may have firewall or bot protection blocking requests
  • Whitelist the Lovarank User-Agent or disable bot protection for your webhook path
  • Check Cloudflare, AWS WAF, or similar security tools

404 Not Found

  • Verify your webhook URL is correct
  • Ensure your endpoint is deployed and accessible
  • Check for typos in the URL path

Connection Timeout

  • Your endpoint may be taking too long to respond
  • Respond with 200 immediately, then process asynchronously
  • Check your server logs for errors

Webhook Not Triggering

  • Confirm the integration is connected and saved
  • Verify the article is being published (not just saved)
  • Check the integration isn't disabled

Managing the Integration

Editing Settings

  1. Go to Integrations in Lovarank
  2. Click on your webhook integration
  3. Update the URL or Secret Key
  4. Save changes

Disconnecting

Click the trash icon on your webhook integration to remove it. This stops all future webhook calls to that endpoint.

Frequently Asked Questions

Can I send to multiple endpoints? Create a separate webhook integration for each endpoint, or have your primary endpoint forward data to other services.

What if my endpoint is down? Lovarank shows an error if your endpoint doesn't respond with 200. Webhooks aren't automatically retried—click "Republish" once your endpoint is fixed.

Is the data secure? Use HTTPS for your endpoint and always validate the Bearer token to ensure requests are genuinely from Lovarank.

Can I filter which articles trigger webhooks? Currently, all published articles trigger connected webhooks. Filter logic should be handled in your endpoint.

What response should my endpoint return? Return a 200 status code to indicate success. The response body is logged but not required.

Can I test without publishing a real article? Yes! Use the Send Test button to send a sample payload. Test payloads include test: true so you can handle them differently.

Do images come through the webhook? Yes. The featured_image field contains the image URL, and images in the content are embedded in content_html with their URLs.

Can I use webhooks with WordPress or other supported platforms? Yes, but native integrations are easier. Use webhooks when you need custom behavior or when connecting to unsupported platforms.

Was this page helpful?