Webhooks
Webhooks
Section titled “Webhooks”Receive Jira events on a local server, and register webhooks with Jira Cloud.
Prerequisites
Section titled “Prerequisites”- Authenticated profile (
atlcli auth login) - Jira permission: Administer Jira, to create webhooks in the Jira admin UI (Settings → System → WebHooks) that point at
serve list,register,deleteandrefreshuse Jira Cloud’s dynamic webhook API. Jira allows it only for Connect and OAuth 2.0 apps: with an API token it answers 403. With an API token, create the webhook in the admin UI instead- Publicly accessible URL (use ngrok, a Cloudflare tunnel or similar for local development)
Start Server
Section titled “Start Server”atlcli jira webhook serveatlcli jira webhook serve --port 3000 --projects PROJ,TEAM --events jira:issue_created,comment_createdThe server listens on 127.0.0.1 and accepts POST requests with Content-Type: application/json on --path. It answers GET /health. Each received event is printed as one line, with control characters removed from the text Jira sent:
[2025-01-14T10:00:00.000Z] CREATED: PROJ-123 - Fix login bug[2025-01-14T10:05:00.000Z] UPDATED: PROJ-123 - Fix login bug (status: To Do → In Progress)[2025-01-14T10:07:00.000Z] COMMENT: PROJ-123 - New comment by Alice LeeOptions:
| Flag | Default | Description |
|---|---|---|
--port |
8080 |
Server port |
--host |
127.0.0.1 |
Interface to bind. Any address that is not loopback (0.0.0.0, ::, a LAN address) requires a secret |
--path |
/webhook |
Endpoint path |
--secret |
none | Shared secret; requests without a valid X-Hub-Signature: sha256=<hmac> header are rejected with 401. Prefer the environment variable, which keeps the secret out of the shell history and the process list |
--projects |
all | Comma-separated project keys to accept |
--events |
all | Comma-separated event types to accept |
| Environment variable | Description |
|---|---|
ATLCLI_WEBHOOK_SECRET |
The shared secret. --secret wins when both are set |
Stop the server with Ctrl+C.
Authentication and bind address
Section titled “Authentication and bind address”Set a secret whenever events come from another machine, and enter the same secret in the Jira webhook:
export ATLCLI_WEBHOOK_SECRET="$(openssl rand -hex 32)"atlcli jira webhook serve --port 3000| Secret | --host |
Result |
|---|---|---|
| not set | not set or loopback | Listens on loopback only and prints a warning. Any local process can post events |
| not set | any other address | Usage error, the server does not start |
| set | not set | Listens on 127.0.0.1 |
| set | 0.0.0.0 or another address |
Listens there |
A tunnel client or reverse proxy on the same machine connects through loopback and needs no --host. A tunnel forwards requests from the internet to loopback, so set a secret for tunnels as well.
A request body may be at most 1 MiB; a larger one is answered with 413.
Events
Section titled “Events”| Area | Event types |
|---|---|
| Issues | jira:issue_created, jira:issue_updated, jira:issue_deleted |
| Comments | comment_created, comment_updated, comment_deleted |
| Attachments | attachment_created, attachment_deleted |
| Issue links | issuelink_created, issuelink_deleted |
| Worklogs | worklog_created, worklog_updated, worklog_deleted |
| Sprints | sprint_created, sprint_updated, sprint_started, sprint_closed, sprint_deleted |
| Boards | board_created, board_updated, board_deleted |
Process Events in a Script
Section titled “Process Events in a Script”atlcli has no handler configuration. With --json, serve prints a {"type": "started", …} object, then one {"schemaVersion": "1", "type": "event", "payload": {…}} object per event; pipe that stream into your own script:
atlcli jira webhook serve --json --events jira:issue_created | \ jq -c --unbuffered 'select(.type == "event") | .payload.issue.key' | \ while read -r key; do ./scripts/notify-slack.sh "$key" doneWebhook Setup
Section titled “Webhook Setup”- Start the server:
atlcli jira webhook serve - Expose it:
ngrok http 8080 - Add a webhook in Jira (Settings → System → WebHooks) with the public URL plus
/webhook, or register it withwebhook register
Manage Registered Webhooks (Cloud)
Section titled “Manage Registered Webhooks (Cloud)”# Register; --jql limits the issues (default: all issues)atlcli jira webhook register --url https://abc.ngrok.io/webhook \ --events jira:issue_updated,comment_created --jql "project = PROJ"
# Listatlcli jira webhook list
# Extend the expiration (registered webhooks expire after 30 days)atlcli jira webhook refresh 12345
# Delete (comma-separated IDs work for refresh and delete)atlcli jira webhook delete 12345| Command | Options | Prints |
|---|---|---|
register |
--url (required), --events (required), --jql |
registered, webhookId, url, jqlFilter, events |
list |
webhooks (id, jqlFilter, events, expirationDate), total |
|
refresh <id> |
refreshed, expirationDate |
|
delete <id> |
deleted |
Troubleshooting
Section titled “Troubleshooting”- 401 Invalid signature: the sender’s secret differs from
--secret, or it sends noX-Hub-Signatureheader. Drop--secretto test. - 415 Unsupported media type: the request has no
Content-Type: application/jsonheader. Jira sends it; add-H 'Content-Type: application/json'to a hand-writtencurltest. - 413: the request body is larger than 1 MiB.
--host ... needs a webhook secret: the server was asked to bind a non-loopback address without a secret. SetATLCLI_WEBHOOK_SECRET, or drop--hostand reach the server through loopback.- 400 Invalid JSON: the request body is not a JSON object. Jira always sends one; check a hand-written test request.
- Events arrive but nothing prints: check
--projectsand--events; filtered events are acknowledged but not printed. - 403 “Only Connect and OAuth 2.0 apps can use this operation” on
list,register,deleteorrefresh: the profile uses an API token. Create the webhook in the Jira admin UI and runserveto receive it.
Related Topics
Section titled “Related Topics”- Issues - Issue events and lifecycle
- Boards & Sprints - Sprint events
- Confluence webhooks - the sync daemon’s webhook server