chmod +x webhook_setup.pypython webhook_setup.pyimp_xxxxxxxx)The script uses webhook.site to create a free, unique URL that can receive webhook payloads. This URL is temporary but perfect for testing.
The script authenticates with the target site using basic authentication credentials and saves the session cookies to cookies.txt for subsequent requests.
Makes a POST request to {base_url}/@api/deki/webhooks with XML body:
Makes a POST request to {base_url}/@api/deki/webhooks with XML body:
<webhook>
<webhook-url>{unique-url}</webhook-url>
<authorization-header>Bearer {bearer-authorization-header}</authorization-header>
</webhook>
This authorization header does not actually serve as authorizing; it is for validation for the end user listening to the Webhook.
Makes a PUT request to {base_url}/@api/deki/webhooks/{id}/events/page_create to configure the webhook to receive page creation events, using cookie-based authentication.
After setup, you can choose to listen for incoming webhook requests in real-time. The script will:
The script uses basic authentication for the target site:
auth_credentials tuple in the webhook_setup.py file at line 52:auth_credentials = ("YOUR_USERNAME", "YOUR_PASSWORD")Before running the script, you must edit webhook_setup.py and replace the REDACTED values with your actual username and password.
auth_credentials tuple in the authenticate_with_expert() function.poll_interval parameter in listen_to_webhook() (default is 2 seconds).add_page_create_event() for other event types, such as:
After setup, the script provides a URL to view incoming webhook requests in real-time. This is useful for:
The script includes comprehensive error handling for:
============================================================
Webhook Setup Script
============================================================
Enter the base URL of your target site: https://example.com
Generating unique webhook URL...
Webhook URL created: https://webhook.site/abc123...
View requests at: https://webhook.site/#!/abc123...
Creating webhook at https://example.com...
Webhook created successfully!
Webhook ID: 42
Adding page_create event to webhook 42...
page_create event added successfully!
============================================================
Setup Complete!
============================================================
Webhook URL: https://webhook.site/abc123...
Webhook ID: 42
Your webhook is now configured to receive page_create events.
View incoming requests at: https://webhook.site/#!/abc123...
## Triggering the Webhook
To test the webhook and trigger a page_create event, you must:
1. **Log in to your target site** using the same credentials configured in the script
2. **Manually create a new page** in the site
3. The webhook will automatically trigger and send a payload to your webhook.site URL when the page is created
The webhook only responds to actual page creation events within the target site - it cannot be triggered programmatically through this script.
------------------------------------------------------------
Do you want to listen for incoming webhook requests? (y/n): y
============================================================
Webhook Listener Active
============================================================
Listening for incoming requests...
Press Ctrl+C to stop listening
============================================================
New Request Received!
Time: 2024-01-29T10:30:45Z
Method: POST
Request ID: def456...
Body:
<event id="143c3406-fdfd-11f0-8674-aa9553f76750" datetime="2026-01-30T16:59:45Z" mt-epoch="1136393985653" type="page:create" wikiid="REDACTED" language="en-US" journaled="true" version="5"><request id="143c3406-fdfd-11f0-8674-2e3f57c9d8ea" seq="1" count="2"><signature>POST:pages/*/contents</signature></event>
============================================================
Stopped listening to webhook
auth_credentials tuple and that cookies.txt is created successfully.