zjor / webhook-logger

Webhook logger API server powered by FastAPI. Stores any POST request. Used for testing webhooks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Webhook Logger

Overview

The service stores any JSON POST request to the database and allows to view request history with GET request.

Demo

Features

  • allows to group webhook logs under /api/{entity}
  • allows to access stored request by ID
  • stores request headers

API Reference

  • Store any payload:
$> curl -X POST https://sleepy-reaches-84241.herokuapp.com/api/example -H 'Content-Type: application/json' -d '{"paymentId": "abcde", "status": "pending"}'
  • List stored requests
curl https://sleepy-reaches-84241.herokuapp.com/api/example
  • List and limit requests
curl https://sleepy-reaches-84241.herokuapp.com/api/example?limit=3
  • Get a single request by ID
curl https://sleepy-reaches-84241.herokuapp.com/api/example/611b7d4c-cbb1-4e18-9ebe-cc53829d22b0

How to

Run dockerized version locally

  1. docker build -t webhook-logger .
  2. docker run --rm -e DATABASE_URL=$DATABASE_URL -p 8000:8000 webhook-logger

Run with docker-compose

  • $> docker-compose up

TODO

  • store headers
  • add get entity by ID endpoint
  • accept limit param for number of entities
  • (?) delete records older then X days
  • run locally with docker-compose
  • show stats: ...{stats: {distinctNames: N, total: M}}, schemaVersion: 3, ...
  • add endpoint descriptions

About

Webhook logger API server powered by FastAPI. Stores any POST request. Used for testing webhooks.


Languages

Language:Python 94.0%Language:Dockerfile 4.9%Language:Procfile 1.1%