Webhook map
issuesnewIssue(issues.newIssue)updatedIssue(issues.updatedIssue)
projectsnewProject(projects.newProject)
HTTP handler setup
app/api/webhook/route.ts
import { processWebhook } from "corsair";
import { corsair } from "@/server/corsair";
export async function POST(request: Request) {
const headers = Object.fromEntries(request.headers);
const body = await request.json();
const result = await processWebhook(corsair, headers, body);
return result.response;
}
Events
Issues
New Issue
issues.newIssue
Triggered when a new issue is created in Jira
Payload
| Name | Type | Required | Description |
|---|---|---|---|
webhookEvent | jira:issue_created | Yes | — |
timestamp | number | No | — |
issue | object | No | — |
user | object | No | — |
issue full type
issue full type
{
id?: string,
key?: string,
self?: string,
fields?: {
summary?: string,
status?: {
id?: string,
name?: string,
statusCategory?: {
key?: string,
name?: string
}
},
assignee?: {
accountId?: string,
displayName?: string,
emailAddress?: string
} | null,
reporter?: {
accountId?: string,
displayName?: string,
emailAddress?: string
},
priority?: {
id?: string,
name?: string
} | null,
issuetype?: {
id?: string,
name?: string,
subtask?: boolean
},
project?: {
id?: string,
key?: string,
name?: string
},
labels?: string[],
created?: string,
updated?: string
}
}
user full type
user full type
{
accountId?: string,
displayName?: string,
emailAddress?: string
}
Response data full type
Response data full type
{
webhookEvent: jira:issue_created,
timestamp?: number,
issue?: {
id?: string,
key?: string,
self?: string,
fields?: {
summary?: string,
status?: {
id?: string,
name?: string,
statusCategory?: {
key?: string,
name?: string
}
},
assignee?: {
accountId?: string,
displayName?: string,
emailAddress?: string
} | null,
reporter?: {
accountId?: string,
displayName?: string,
emailAddress?: string
},
priority?: {
id?: string,
name?: string
} | null,
issuetype?: {
id?: string,
name?: string,
subtask?: boolean
},
project?: {
id?: string,
key?: string,
name?: string
},
labels?: string[],
created?: string,
updated?: string
}
},
user?: {
accountId?: string,
displayName?: string,
emailAddress?: string
}
}
webhookHooks example
jira({
webhookHooks: {
issues: {
newIssue: {
before(ctx, args) {
return { ctx, args };
},
after(ctx, response) {
},
},
},
},
})
Updated Issue
issues.updatedIssue
Triggered when an issue is updated in Jira
Payload
| Name | Type | Required | Description |
|---|---|---|---|
webhookEvent | jira:issue_updated | Yes | — |
timestamp | number | No | — |
issue | object | No | — |
user | object | No | — |
changelog | object | No | — |
issue full type
issue full type
{
id?: string,
key?: string,
self?: string,
fields?: {
summary?: string,
status?: {
id?: string,
name?: string,
statusCategory?: {
key?: string,
name?: string
}
},
assignee?: {
accountId?: string,
displayName?: string,
emailAddress?: string
} | null,
reporter?: {
accountId?: string,
displayName?: string,
emailAddress?: string
},
priority?: {
id?: string,
name?: string
} | null,
issuetype?: {
id?: string,
name?: string,
subtask?: boolean
},
project?: {
id?: string,
key?: string,
name?: string
},
labels?: string[],
updated?: string
}
}
user full type
user full type
{
accountId?: string,
displayName?: string,
emailAddress?: string
}
changelog full type
changelog full type
{
id?: string,
items?: {
field?: string,
fieldtype?: string,
from?: string | null,
fromString?: string | null,
to?: string | null,
toString?: string | null
}[]
}
Response data full type
Response data full type
{
webhookEvent: jira:issue_updated,
timestamp?: number,
issue?: {
id?: string,
key?: string,
self?: string,
fields?: {
summary?: string,
status?: {
id?: string,
name?: string,
statusCategory?: {
key?: string,
name?: string
}
},
assignee?: {
accountId?: string,
displayName?: string,
emailAddress?: string
} | null,
reporter?: {
accountId?: string,
displayName?: string,
emailAddress?: string
},
priority?: {
id?: string,
name?: string
} | null,
issuetype?: {
id?: string,
name?: string,
subtask?: boolean
},
project?: {
id?: string,
key?: string,
name?: string
},
labels?: string[],
updated?: string
}
},
user?: {
accountId?: string,
displayName?: string,
emailAddress?: string
},
changelog?: {
id?: string,
items?: {
field?: string,
fieldtype?: string,
from?: string | null,
fromString?: string | null,
to?: string | null,
toString?: string | null
}[]
}
}
webhookHooks example
jira({
webhookHooks: {
issues: {
updatedIssue: {
before(ctx, args) {
return { ctx, args };
},
after(ctx, response) {
},
},
},
},
})
Projects
New Project
projects.newProject
Triggered when a new project is created in Jira
Payload
| Name | Type | Required | Description |
|---|---|---|---|
webhookEvent | project_created | Yes | — |
timestamp | number | No | — |
project | object | No | — |
project full type
project full type
{
id?: string,
key?: string,
name?: string,
description?: string,
projectTypeKey?: string,
lead?: {
accountId?: string,
displayName?: string,
emailAddress?: string
},
self?: string
}
Response data full type
Response data full type
{
webhookEvent: project_created,
timestamp?: number,
project?: {
id?: string,
key?: string,
name?: string,
description?: string,
projectTypeKey?: string,
lead?: {
accountId?: string,
displayName?: string,
emailAddress?: string
},
self?: string
}
}
webhookHooks example
jira({
webhookHooks: {
projects: {
newProject: {
before(ctx, args) {
return { ctx, args };
},
after(ctx, response) {
},
},
},
},
})