MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

How to Work with Rundeck Webhooks?

A Rundeck webhook is a project-level HTTP endpoint. When it receives a POST request, a handler plugin runs, usually one that starts a job and passes values from the JSON payload into job options. This page walks through the setup screenshots below, then explains how authentication really works, fixes the curl command in the original post, and shows how to map payload fields to job options and connect a Git provider such as GitHub.

Step 1 – Create a Project and Job with Node Steps

Rundeck Create New Job Webhook workflow tab with an echo Welcome to Webhook command step

Step 2 – Go to Webhooks under project Menu

Rundeck WorkflowDemo project with Webhooks selected in the left menu, showing an empty webhook list

Step 3 – Create Webhook

Rundeck Create Webhook form with a new webhook named hook1 on the General tab

Step 4 – Add Webhook Handlers Configurations

Rundeck hook1 Handler Configuration tab with Run Job chosen from the Choose Webhook Plugin menu
Rundeck Run Job handler settings for hook1 with the Choose A Job button highlighted
Rundeck hook1 handler set to run the Webhook job in WorkflowDemo, with the Save button highlighted

Step 5 – Validate the webhook url

Rundeck hook1 General tab showing the generated webhook Post URL on localhost:4440

Step 6 – Get a User API Token

Rundeck Profile page opened from the user menu, with the add button for User API Tokens highlighted
Rundeck Generate New Token dialog for user admin with the Generate New Token button circled
Rundeck Save Your new Token dialog showing the newly generated API token

Step 6 – Generate a CURL command and Run using Gitbash


ENCODED_API_TOKEN=$(echo -n "6BnnOqW7EicQix9lDAn9MceNtSIQ2LBN" | base64)

curl -X POST \
  -H "Authorization: Basic $ENCODED_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook_id": "c6lMILXGYTvR6uaY59ZxhgsWybEfF5uF#hook1",
    "payload": {
      "key1": "value1",
      "key2": "value2"
    }
  }' \
  http://localhost:4440/api/45/webhook/c6lMILXGYTvR6uaY59ZxhgsWybEfF5uF#hook1Code language: PHP (php)

Curl command with a base64 encoded API token, with the webhook ID and Rundeck webhook URL highlighted
Git Bash curl POST to the Rundeck webhook returning a jobId and executionId 66
Rundeck Webhook job stats showing 1 execution and a 100% success rate

How Rundeck webhooks work

Each webhook belongs to a project and has a unique URL like http://<host>:4440/api/<version>/webhook/<token>#<name>. The long random string is the webhook's own auth token, and it is the credential. Anyone who has the full URL can trigger the webhook. The #<name> part at the end is only a readable label. It is a URL fragment, so HTTP clients like curl never send it to the server.

When a request arrives, Rundeck passes the request body to the configured handler plugin. The open-source edition includes a Run Job handler, which starts a chosen job, and a Log Events handler, which writes the payload to the server log. The Log Events handler is useful for checking what a sender actually posts. Commercial editions add more handlers, such as ones that can filter or route events by conditions.

Webhook fieldPurpose
NameLabel shown in the UI and appended to the URL after #
UserThe Rundeck user that triggered executions run as
RolesThe roles used to check ACL permissions when the handler runs the job
EnabledTurns the endpoint on or off without deleting it
HandlerThe plugin that processes the payload, for example Run Job

Prepare the job to accept webhook data

The webhook can only pass data into a job if the job defines options to receive it. In the job from Step 1, open Edit Job โ†’ Workflow โ†’ Options and add an option for each value you expect, for example key1 and key2. Then reference those options in the node steps:

# Command step
echo "key1 is ${option.key1}"

# Inline script step (token replaced before the script runs)
echo "key1 is @option.key1@"

# Inside any script on the node, options are also exported as environment variables
echo "key2 is $RD_OPTION_KEY2"Code language: PHP (php)

Note: If an option is marked Required and the payload does not include a value for it, the job will not start. During testing, give options default values or leave them optional.

Map payload fields in the Run Job handler

In the handler configuration from Step 4, the Job Options field takes option arguments. Use ${data.<field>} to pull values from the JSON body. For nested objects, use dot notation.

-key1 ${data.key1} -key2 ${data.key2}

With this mapping, a body of {"key1":"value1","key2":"value2"} sets key1=value1 and key2=value2. If a field is nested, for example {"build":{"version":"1.4.2"}}, reference it as ${data.build.version}. The handler's optional Node Filter field accepts the same ${data...} references, so the payload can also decide which nodes the job runs on.

Corrected curl command

The command in the example above works only because Rundeck ignores the Authorization header it sends. It also wraps the data so that the mapping shown earlier will not find the fields. Here is the corrected request, which runs as-is in Git Bash, Linux or macOS:

curl -i -X POST \
  -H "Content-Type: application/json" \
  -d '{"key1":"value1","key2":"value2"}' \
  "http://localhost:4440/api/45/webhook/<WEBHOOK_TOKEN>#hook1"Code language: JavaScript (javascript)
  • No API token or Basic auth header. The token in the URL authenticates the request. Rundeck user API tokens are never sent as base64 Basic credentials anyway.
  • A flat JSON body. Fields at the top level match ${data.key1}. In the original body the value would sit at ${data.payload.key1}, and the webhook_id field does nothing.
  • A quoted URL. Quoting stops the shell from interpreting special characters. -i prints the HTTP status so you can confirm success.
  • The API version from the UI. Copy the full URL that Rundeck shows on the webhook page instead of typing 45 yourself.

An HTTP 200 response means Rundeck accepted the request. To confirm the job ran and received the options, open the project's Activity page and check the execution log.

Note: The original post publishes what looks like a real user API token and webhook token. Treat any token that has appeared in a document, screenshot or chat as compromised: delete it under Profile โ†’ User API Tokens, and regenerate the webhook token or recreate the webhook.

Webhook vs the job run API

Step 6 in the example above creates a user API token, but webhooks do not need one. You need a user token when you call the regular Rundeck API directly, for example to run a job by ID with explicit options. In that case, send the token in the X-Rundeck-Auth-Token header:

curl -X POST \
  -H "X-Rundeck-Auth-Token: $RD_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"options":{"key1":"value1","key2":"value2"}}' \
  "http://localhost:4440/api/45/job/<JOB_UUID>/run"Code language: JavaScript (javascript)

Use a webhook when an outside system sends its own fixed JSON format, such as GitHub, GitLab, a monitoring tool or a ticketing system. Use the job run API when you control the client and want the response to include execution details.

Triggering a job from a GitHub push

  1. Make sure Rundeck is reachable from the internet over HTTPS, for example through a reverse proxy. GitHub cannot reach localhost:4440.
  2. Create a Run Job webhook and set Job Options to -repo ${data.repository.full_name} -ref ${data.ref} -commit ${data.head_commit.id}.
  3. In GitHub, go to Settings โ†’ Webhooks โ†’ Add webhook. Paste the Rundeck webhook URL without the #name part and set Content type to application/json.
  4. Push a commit, then check Recent Deliveries in GitHub and the Activity page in Rundeck.

Every push to any branch triggers the job. If you only want some branches, check the ref option inside the job, for example exit early unless it equals refs/heads/main, or use a commercial handler that supports conditions. For broader Git automation patterns, see GitOps concepts.

Troubleshooting

SymptomLikely causeFix
404 or not foundWrong token, webhook deleted, or wrong host or portCopy the URL again from the project's Webhooks page
Request accepted but no executionWebhook disabled, the webhook user or roles lack run permission on the job, or a required option is emptyEnable the webhook, review ACLs for the configured roles, and check the server log
Job runs but options are blankPayload fields don't match the ${data...} pathsTemporarily switch to the Log Events handler to see the exact payload
Job runs but options are blank (GitHub)GitHub content type set to form-encodedSet the content type to application/json
Authorization errorThe webhook has an authorization header secret enabledSend the configured secret in the Authorization header

Security best practices

  • Expose Rundeck only over HTTPS, because the token travels in the URL.
  • Run webhooks as a dedicated low-privilege user and roles that can run only the target jobs.
  • Where your Rundeck version supports it, turn on the webhook's authorization header secret so that the URL alone is not enough to trigger it.
  • Validate option values inside the job, using allowed values or regex rules, because payload content comes from outside Rundeck.
  • Regenerate the webhook token if the URL leaks, and disable webhooks you no longer use.

Frequently asked questions

Do Rundeck webhooks need an API token?

No. The random token in the webhook URL authenticates the request, so a plain POST with a JSON body is enough. User API tokens are only needed for regular API endpoints, and they go in the X-Rundeck-Auth-Token header.

How do I pass webhook payload values into a Rundeck job?

Define options on the job, then fill them in the Run Job handler's Job Options field with ${data.field} references, for example -key1 ${data.key1}. Nested fields use dot notation, such as ${data.repository.full_name}.

What does the #name at the end of a Rundeck webhook URL do?

It is only a label. As a URL fragment, it is never sent to the server, and the token before it identifies the webhook.

Why does my webhook return success but no job runs?

Usually the webhook user or roles lack permission to run the job, the webhook is disabled, or a required option got no value. Check the Rundeck server log and the ACL policy for the configured roles.

Can GitHub trigger a Rundeck job directly?

Yes. Add the Rundeck webhook URL as a GitHub webhook with content type application/json, and make sure GitHub can reach Rundeck over the internet, ideally over HTTPS.

Related tutorials

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Rundeck Database Migration From H2 to MySql and postgresql

This guide moves Rundeck off its embedded H2 database and onto MySQL or PostgreSQL, which is what you should use in production. The steps above set up…

Read More

Top 10 Runbook Automation Tools: Features, Pros, Cons & Comparison

Introduction Runbook Automation Tools are purpose-built platforms that automate repetitive operational procedures, commonly known as runbooks. Traditionally, runbooks were static documents describing step-by-step actions engineers should take…

Read More

Complete Beginner-to-Advanced Guide on Auto Remediation in SRE & IT Operations

What is Auto Remediation? Auto Remediation refers to the automatic detection and resolution of incidents in IT systems without manual intervention. It bridges the gap between monitoring,…

Read More

How to Configure Rundeck with postgresql

Step 1 – Setup PostgreSQL server Step 2 – Login to PostgreSQL server & create user/db & grant perm Step 3 – Download PostgreSQL driver cd /var/lib/rundeck/libextsudo…

Read More

Guide to add and use a Windows node in Rundeck installed on a Linux server

Hereโ€™s a step-by-step guide to add and use a Windows node in Rundeck installed on a Linux server, using WinRM (Windows Remote Management), which is the most…

Read More

Rundeck Configuration Options – rundeck-config.properties

๐Ÿ”ง Rundeck Configuration Options 1. General Settings Property Description Example loglevel.default Sets the default log level for jobs. Options: ERROR, WARN, INFO, VERBOSE, DEBUG. INFO rdeck.base Specifies…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x