how to integrate Jira webhook in flask for getting created issues?

  flask, jira, python, python-jira, webhooks

I am new to Jira and webhooks. I am trying to write a python script that should invoke the Jira webhook when a new issue is created and it should return me the issue key, description, summary, etc. I have created the webhook in Jira system settings under webhook and trying to use in my code but I am not able to get any response. Below is what I have tried:

import collections

from flask import abort, request, jsonify, make_response

webhook_url = ""

class JiraWebhook(object):
    def __init__(self, app, endpoint="/jira"):
        app.add_url_rule(endpoint, view_func=self.handle, methods=["POST"])
        self._hooks = collections.defaultdict(list)

    def hook(self, event_type="jira:issue_created"):
        def decorator(f):
            return f
        return decorator

    def _post_received(self):
        data = request.get_json()
        if data is None:
        event_type = data.get("webhookEvent")
        if event_type is None:
        for hook in self._hooks[event_type]:

        return "", 200


   from flask import Flask
import app

app = Flask(__name__)
jw = JiraWebhook(app)

def webhook_service():
    return "Webhook Service"

def issue_created(payload):
    print("Issue created")

if __name__ == "__main__":"", port = 80)

I am not able to figure it out that:

  1. How can I connect to Jira Webhook so everytime an issue is created, it will print me the details?
  2. Where do I need to define my Jira credentails?

Can anyone guide me? Sorry, If This is a very basic question. Thanks in advance.

Source: Python Questions