Skip to main content

JIRA Webhook Integration

Automatically create Credo AI use cases when Jira issues are created.

How It Works

Jira (Issue Created) ──▶ Your Webhook Endpoint ──▶ Credo AI (Use Case)

The Webhook Handler

When Jira creates an issue, it sends a POST request with the issue data. Your handler extracts the relevant fields and creates a use case:

from fastapi import FastAPI, Request
from credoai import CredoAI, UseCaseCreate

app = FastAPI()

@app.post("/webhooks/jira")
async def jira_webhook(request: Request):
payload = await request.json()

# Only handle issue_created events
if payload.get("webhookEvent") != "jira:issue_created":
return {"message": "ignored"}

# Extract issue data
issue = payload["issue"]
jira_key = issue["key"]
summary = issue["fields"]["summary"]
description = issue["fields"].get("description", "")

# Create use case in Credo AI
client = CredoAI()
use_case = client.use_cases.create(
data=UseCaseCreate(
name=f"[{jira_key}] {summary}",
description=description,
)
)

return {"use_case_id": use_case.id}

Testing Locally

  1. Run your app:

    pip install fastapi uvicorn pycredoai
    uvicorn main:app --port 5000
  2. Expose with ngrok:

    ngrok http 5000
  3. Test with curl:

    curl -X POST http://localhost:5000/webhooks/jira \
    -H "Content-Type: application/json" \
    -d '{"webhookEvent":"jira:issue_created","issue":{"key":"TEST-1","fields":{"summary":"Test"}}}'

Configure Jira

  1. Go to Jira Settings > System > Webhooks
  2. Create webhook with URL: https://your-domain.com/webhooks/jira
  3. Select Issue created event

Production

Deploy your FastAPI app to any hosting platform (Railway, Render, etc.) and point your Jira webhook to the public URL.

You can also deploy a webhook handler to AWS Lambda, Cloud Run, etc. and point your Jira webhook to the public URL.

For security, verify the webhook signature and use environment variables for credentials.