onlyoneuche / hookedpy

Send and Receive Webhooks with Django (Reference)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hookedpy

Send and Receive Webhooks with Django (Reference)

Receiving Webhooks

Using Ngrok

  1. setup ngrok on your machine
  2. tunnel your port to ngrok to make it publicly available (put your local host on the internet)
./ngrok http 8000
  1. ngrok will then provide a publicly available url that fowards to your localhost(reverse proxy)

http://83d4-169-255-125-200.ngrok.io -> http://localhost:8000

You are now ready to process webhook events

  • Provide your webhook URL http://83d4-169-255-125-200.ngrok.io/hook/process/ to whoever will be sending you webhooks
  • The logic on /hook/process should then parse the event and do with it as you have commanded.

Sending Webhooks

Sending webhook events is pretty much straightfoward.

  1. Receive the destination webhook URL
  2. Get the data ready
  3. Call the http://localhost:8000/hook/send/ endpoint with the data
curl -X POST http://localhost:8000/hook/send/ -d '{"foo": "bar"}'

About

Send and Receive Webhooks with Django (Reference)

License:MIT License


Languages

Language:Python 100.0%