Skip to main content

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

Project description

simplehook / simplehook-flask

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(app, 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-flask

Quick start

from flask import Flask, request, jsonify
from simplehook_flask import listenToWebhooks

app = Flask(__name__)

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

@app.post("/stripe/events")
def stripe_webhook():
    print("Webhook received!", request.json)
    return jsonify(received=True)

Options

listenToWebhooks(app, 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 FLASK_ENV === "production" or FLASK_DEBUG is not set.

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_flask-0.3.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

simplehook_flask-0.3.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for simplehook_flask-0.3.1.tar.gz
Algorithm Hash digest
SHA256 344703deb44133c4fc2b140b502f33275f9ab34d6edbb4ef9d2028773b12c3ad
MD5 d57195e870220a8e8c4db9b79b0e1812
BLAKE2b-256 e159425740cffb3ccc346fe5ca98319f924b1ad918d110912348ea9cf8698ba5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simplehook_flask-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a28c9d2baebbbfb571dcd1142708a7225d79f445c5f728f4f38dbb6e6fae3600
MD5 9d12ab8ba559bc190ed68ab9bfa3060a
BLAKE2b-256 a13afc7148f16ed4357ab5e2c50989fe79fb8658a6c9a1ce898e97174f1c3a9d

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