Skip to content

Webhooks

Set up webhooks to receive real-time notifications when Confluence content changes.

  • Authenticated profile with admin permissions (atlcli auth login)
  • For receiving webhooks: Public URL accessible from Atlassian servers
  • Space permission: Space Admin to register webhooks

Webhooks allow external systems to be notified when events occur in Confluence:

  • Page created, updated, or deleted
  • Page moved or renamed
  • Page trashed or restored
  • Comments added

atlcli supports both registering webhooks with Confluence and running a local webhook server.

Register a webhook to receive events:

Terminal window
atlcli webhook register --url https://your-server.com/webhook --events page_created,page_updated

Options:

FlagDescription
--urlWebhook endpoint URL (required)
--eventsComma-separated event types
--spaceFilter to specific space key
--pagesFilter to specific page IDs
--secretHMAC secret for signature verification
EventDescription
page_createdNew page created
page_updatedPage content updated
page_removedPage permanently deleted
page_trashedPage moved to trash
page_restoredPage restored from trash
page_movedPage moved to new location
comment_createdComment added to page
comment_updatedComment edited
comment_removedComment deleted
Terminal window
# All page events in a space
atlcli webhook register \
--url https://ci.company.com/confluence-hook \
--events page_created,page_updated,page_removed \
--space DOCS
# Specific pages only
atlcli webhook register \
--url https://notify.company.com/hook \
--events page_updated \
--pages 12345,67890
# With HMAC signature verification
atlcli webhook register \
--url https://secure.company.com/hook \
--events page_updated \
--secret "your-webhook-secret"

View registered webhooks:

Terminal window
atlcli webhook list

Output:

ID URL EVENTS SPACE
wh-001 https://ci.company.com/hook page_created,updated DOCS
wh-002 https://notify.company.com/hook page_updated (all)

Use --json for JSON output.

Remove a registered webhook:

Terminal window
atlcli webhook delete wh-001 --confirm

Run a local server to receive and process webhook events:

Terminal window
atlcli webhook server --port 8080

Options:

FlagDescription
--portPort to listen on (default: 8080)
--secretHMAC secret for verification
--handlerCustom handler script path

The server logs incoming events:

[2025-01-14 10:30:00] Webhook server started on :8080
[2025-01-14 10:30:15] page_updated: "API Reference" (12345) by alice@company.com
[2025-01-14 10:31:22] page_created: "New Guide" (12346) by bob@company.com

Process events with a custom script:

Terminal window
atlcli webhook server --port 8080 --handler ./process-event.sh

Handler receives JSON via stdin:

process-event.sh
#!/bin/bash
EVENT=$(cat)
TYPE=$(echo $EVENT | jq -r '.eventType')
PAGE_ID=$(echo $EVENT | jq -r '.page.id')
case $TYPE in
page_updated)
echo "Page $PAGE_ID was updated"
# Trigger rebuild, notification, etc.
;;
esac

Use webhooks with docs sync for real-time updates:

Terminal window
# Start sync with webhook support
atlcli wiki docs sync ./docs --watch --webhook-port 8080

When a page is updated in Confluence:

  1. Webhook receives the event
  2. Sync automatically pulls the changed page
  3. Local file is updated
Terminal window
# Register webhook and start sync
atlcli wiki docs sync ./docs \
--watch \
--webhook-port 8080 \
--webhook-url https://your-server.com:8080/webhook

Event payloads contain:

{
"eventType": "page_updated",
"timestamp": "2025-01-14T10:30:15Z",
"user": {
"accountId": "abc123",
"displayName": "Alice",
"email": "alice@company.com"
},
"page": {
"id": "12345",
"title": "API Reference",
"spaceKey": "DOCS",
"version": 5,
"url": "https://company.atlassian.net/wiki/spaces/DOCS/pages/12345"
}
}

When using --secret, atlcli signs payloads with HMAC-SHA256:

X-Atlcli-Signature: sha256=abc123...

Verify in your handler:

import hmac
import hashlib
def verify_signature(payload, signature, secret):
expected = 'sha256=' + hmac.new(
secret.encode(),
payload.encode(),
hashlib.sha256
).hexdigest()
return hmac.compare_digest(signature, expected)

The webhook server exposes a health endpoint:

Terminal window
curl http://localhost:8080/health
{"status": "ok", "uptime": 3600}
Terminal window
# In your CI/CD pipeline
atlcli webhook register \
--url https://ci.company.com/trigger/docs-build \
--events page_updated \
--space DOCS

When documentation changes, trigger a rebuild.

Terminal window
# Custom handler for Slack
atlcli webhook server --port 8080 --handler ./slack-notify.sh
slack-notify.sh
#!/bin/bash
EVENT=$(cat)
TITLE=$(echo $EVENT | jq -r '.page.title')
USER=$(echo $EVENT | jq -r '.user.displayName')
URL=$(echo $EVENT | jq -r '.page.url')
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\": \"$USER updated <$URL|$TITLE>\"}" \
$SLACK_WEBHOOK_URL
Terminal window
# Log all changes to file
atlcli webhook server --port 8080 --handler ./audit-log.sh
audit-log.sh
#!/bin/bash
cat >> /var/log/confluence-audit.jsonl

Symptom: Registered webhook doesn’t receive events.

Causes:

  • URL not publicly accessible
  • Firewall blocking incoming requests
  • Webhook registration failed silently

Fix: Verify URL is reachable from the internet. Check atlcli webhook list to confirm registration.

Symptom: X-Atlcli-Signature header doesn’t match.

Cause: Secret mismatch between registration and verification code.

Fix: Ensure the same secret is used when registering and verifying. Check for encoding issues.

  • Sync - Use webhooks with sync for real-time updates
  • Configuration - Webhook configuration options
Jira and Confluence are trademarks of Atlassian Corporation Plc. atlcli is not affiliated with, endorsed by, or sponsored by Atlassian.