Skip to content

Webhooks

Webhooks let you automatically trigger actions on other services when something happens with your comments. The most common use case is triggering a site rebuild when a new comment is submitted.

A webhook is a way for JamComments to send a message to another service when a specific event occurs. Instead of that service constantly asking “any new comments?” (polling), JamComments proactively says “hey, a new comment was just submitted!” (pushing).

Webhooks are triggered when:

  • A new comment is submitted on your site
  • A comment’s status changes (approved, rejected, etc.)
  • You toggle certain settings (like removing branding)
  1. Go to your site’s settings in the JamComments dashboard
  2. Scroll to the Webhooks section
  3. Click Add Webhook
  4. Enter a name (for your reference) and the URL to call

That’s it! From now on, JamComments will send a POST request to that URL whenever a comment event occurs.

Most Jamstack hosts let you trigger new builds via a special URL. This means when someone leaves a comment, your site automatically rebuilds and the comment appears without you doing anything.

Vercel:

  1. Go to your project settings
  2. Find “Git” → “Deploy Hooks”
  3. Create a hook and copy the URL
  4. Paste it into JamComments

Netlify:

  1. Go to Site settings → Build & deploy → Build hooks
  2. Create a build hook and copy the URL
  3. Paste it into JamComments

Cloudflare Pages:

  1. Go to your project settings
  2. Find “Builds & deployments” → “Build hooks”
  3. Create a hook and copy the URL
  4. Paste it into JamComments

You can send comment notifications to Slack using their incoming webhooks:

  1. Create a Slack app with incoming webhooks enabled
  2. Copy the webhook URL
  3. Paste it into JamComments
  4. New comments will appear as Slack messages

If you have your own server or serverless function, you can have JamComments call it directly. This lets you build custom workflows like:

  • Sending custom email notifications
  • Updating a database
  • Posting to social media
  • Running moderation checks

When JamComments calls your webhook URL, it sends a JSON payload with information about what happened:

{
"event": "comment.created",
"site": {
"domain": "your-site.com",
"name": "My Blog"
},
"comment": {
"id": 123,
"content": "Great article!",
"author": "Jane Doe",
"path": "/posts/my-post",
"status": "pending"
}
}

The event field tells you what happened:

  • comment.created — New comment submitted
  • comment.approved — Comment was approved
  • comment.rejected — Comment was rejected

Not sure if your webhook is working? Here are a few ways to test:

  1. Use a webhook testing service like webhook.site — it gives you a temporary URL that shows exactly what JamComments sends
  2. Check your hosting provider’s build logs — if using a deploy hook, you should see new builds starting
  3. Submit a test comment in development mode — webhooks won’t fire in development mode, so use production

You can create as many webhooks as you need for a single site. Each webhook fires independently, so if one fails, the others still run.

JamComments makes a best-effort attempt to deliver webhooks. If your endpoint returns an error (non-2xx status), JamComments may retry a few times but cannot guarantee delivery.

For critical workflows, consider:

  • Making your webhook handler idempotent (safe to call multiple times)
  • Having a backup plan in case webhooks fail
  • Monitoring your endpoint’s availability