Search code examples
djangowebhookshttpresponse

Django webhooks


Need help in creating and understanding webhooks in Django.From where should I start ? How should I get to learn to implement a simple webhook in which I pass 2,3 parameters like id and name and it should get printed through the URL into the view without any third party or package.


Solution

  • webhooks is nothing special, it is just an URL endpoint, you can define the format of the request and the response. The most common format now is JSON in both the request and response.

    here is a simple webhook

    def run(request):
        import json
        req = json.loads(request.body)
        ..... # do your function
        return  JsonResponse({"message":"Received Succesfully")