Skip to main content

Stable webhook URLs for localhost. One line of code. Django adapter.

Project description

simplehook / simplehook-django

One line of code. Webhooks just work.

Stop tunneling. Stop polling. Stop building webhook infrastructure. Add one SDK call and your local app receives real webhooks from Stripe, GitHub, Twilio — any provider.

listenToWebhooks(application, os.environ["SIMPLEHOOK_KEY"])

Your app opens an outbound WebSocket to simplehook.dev. When a webhook arrives at your stable URL, it's forwarded through the connection to your local server. Your response goes back to the caller. No CLI. No tunnel process. No URL that changes every session.

Why simplehook?

  • No CLI — just pip install and one function call
  • Permanent URLs — set once in Stripe/GitHub, never change them
  • Real responses — passthrough mode returns your actual response to the caller (TwiML, verification, etc.)
  • Queue + retry — if your app is offline, events queue and deliver when you reconnect
  • Dev mode by default — only connects in development, never in production

Install

pip install simplehook-django

Quick start

# manage.py or wsgi.py
import os
import django
from django.core.wsgi import get_wsgi_application
from simplehook_django import listenToWebhooks

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
django.setup()

application = get_wsgi_application()

listenToWebhooks(application, os.environ["SIMPLEHOOK_KEY"])
# views.py
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
def stripe_webhook(request):
    print("Webhook received!", request.body)
    return JsonResponse({"received": True})

Options

listenToWebhooks(application, api_key, {
    "force_enable": False,     # Connect even in production
    "server_url": "...",       # Override server URL
    "on_connect": callback,    # Called when connected
    "on_disconnect": callback, # Called when disconnected
    "silent": False,           # Suppress console output
})

Dev mode

By default, simplehook only connects in development. Set SIMPLEHOOK_ENABLED=false to disable, or force_enable: True to force.

Production is detected when DJANGO_SETTINGS_MODULE is set and DEBUG is False.

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simplehook_django-0.3.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simplehook_django-0.3.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file simplehook_django-0.3.1.tar.gz.

File metadata

  • Download URL: simplehook_django-0.3.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for simplehook_django-0.3.1.tar.gz
Algorithm Hash digest
SHA256 424c6353eb708b30220ca0067b1b49879732d01f10e6a04c11582af6611feb78
MD5 652c3e207c3832582b0249e0a479ce90
BLAKE2b-256 348f092f9288cfc08c05197859dd4707fef166ed4c0b423e66098247f7d81368

See more details on using hashes here.

File details

Details for the file simplehook_django-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simplehook_django-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5376b2371656e4d4103cc5bd181edcf769cb16476d8da4d5650c60b119f84315
MD5 67afb0de94001177a4728fcd1774f3fe
BLAKE2b-256 4aefc981399b6a8af1a0c1bca7d1609e43034d7e835d85795d5124b0f3d397fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page