This is a simple python package to create a webhook server that can be used to handle Notion webhooks and trigger actions.
pip install secnex-notion-webhook-server
from notion_webhook.server import WebhookServer
server = WebhookServer()
server.start()
from notion_webhook.server import Server, Handler, WebhookHandler
from notion_webhook.db import TokenDatabase
db = TokenDatabase()
if db.check_first_run():
token_id, token = db.create_token()
print(token)
handler = Handler(WebhookHandler(db).webhook_handler)
handlers = {
"/webhook": handler
}
server = Server(
addr=os.getenv("HOST", "0.0.0.0"),
port=int(os.getenv("PORT", 8000)),
handlers=handlers,
app_name=os.getenv("APP_NAME", "NotionWebhookServer")
)
server.start()
You find the example in the examples folder.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request.
For questions or support, please contact us at support@secnex.io.