Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,415
Community Members
 
Community Events
185
Community Groups

Need help creating a server using jira webhook to listen to new tickets

Edited
Achyut Jagini
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Apr 11, 2023

Anyone here has experience of working with jira webhook and creating a server to listen to new tickets .

I tried creating using flask but unable to deploy on AWS EC2 due to http and https issue.

Need help for production grade.

Any new ticket is created ,or any ticket fields updated can be separate cases in server code.

Can just update to database separate tables.

But I am having issue in deployment

 

 

My code currently

 

from flask import Flask, request, render_template
import os
import sqlite3

app = Flask(__name__)

# Connect to the SQLite database
conn = sqlite3.connect('tickets.db')

# Create a table to store the ticket data
conn.execute('''CREATE TABLE IF NOT EXISTS tickets
             (id INT PRIMARY KEY NOT NULL,
              summary TEXT NOT NULL,
              description TEXT NOT NULL);''')

@app.route('/', methods=['GET'])
def index():
    return 'Hello World!'

@app.route('/webhook1', methods=['POST'])
def handle_webhook():
    data = request.json
    issue_id = data['issue']['id']
    issue_summary = data['issue']['fields']['summary']
    issue_description = data['issue']['fields']['description']
    
     
    app.logger.info(data)
    app.logger.info('issue id=%s', issue_id)
    app.logger.info('issue summary=%s',issue_summary)
    app.logger.info('issue description=%s', issue_description)
    
     if(data[body][details]=="issue created"):
    # Insert the new ticket data into the database
          cursor = conn.cursor()
         insert_query = "INSERT INTO tickets (id, summary, description) VALUES (?, ?, ?)"
         insert_values = (issue_id, issue_summary, issue_description)
          cursor.execute(insert_query, insert_values)
         conn.commit()
          cursor.close()

    return 'Ticket created'

if __name__ == '__main__':
    app.run(host='0.0.0.0',port=8080)


  webhook settings
img.jpg
http not allowed

 

erro4.jpg

ec2 instance showing error for post request when new ticket created as https used when ec2 instance has http public url

error.jpgerror2.jpg

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events