Each dash begins with a board stuffed with tickets and a group that wishes someplace blank to paintings. For businesses working shopper WordPress tasks on two-week cycles, this implies making a staging setting in MyKinsta sooner than the primary price ticket is picked up.
This takes a couple of mins, but it surely’s the type of job that falls during the cracks as it appears to be like trivial.
The Kinsta API can take away that step. When a dash begins in Jira, you’ll arrange a webhook that triggers an match in middleware, which then reads the payload, maps it to a Kinsta web site, and calls the API to create a brand new staging setting.
Contents
- 1 Why businesses will have to automate setting provisioning
- 2 What you want sooner than you get started
- 3 Easy methods to automate dash setting provisioning with Jira and the Kinsta API
- 4 Stay your company forward of the dash
Why businesses will have to automate setting provisioning
Growing an atmosphere after you propose a dash manner opening MyKinsta, discovering the appropriate shopper web site from a listing of dozens, developing and naming an atmosphere, after which returning to Jira. Whilst this isn’t difficult, it does need to occur on the correct time, each time, and for each shopper challenge working.
Skipping it manner a group begins paintings within the final dash’s setting. From there, adjustments collect on best of one another, and when there’s a trojan horse, keeping apart it’s extra like archaeology than debugging.
What you want sooner than you get started
To glue the Kinsta API and Jira, you want a Kinsta account with no less than one WordPress web site in an current setting, a Jira Cloud account with administrator get admission to to configure webhooks, and Node.js put in in the community.
To authenticate with the Kinsta API, navigate to [Your company] > Corporate settings > API Keys in MyKinsta and click on Create API Key.

Subsequent, give the important thing a reputation, set an expiry period, and click on Generate. The bottom line is a one-time show, so be aware it down sooner than you progress on.
You place this in a .env record on the challenge root along your Kinsta corporate ID, which you’ll in finding beneath Corporate settings > Billing Main points:
KINSTA_API_KEY=your_api_key_here
KINSTA_COMPANY_ID=your_company_id_here
Get your Jira and Kinsta web site IDs
You wish to have the Kinsta web site ID for every shopper challenge within the automation. This can be a UUID that Kinsta assigns at web site advent. It sounds as if within the MyKinsta URL while you open a web site or by means of polling GET /websites name as soon as your API key’s in position:
https://my.kinsta.com/websites/main points/fbab4927-e354-4044-b226-29ac0fbd20ca/…
At the Jira aspect, you want the numerical board ID for every challenge you need to attach. It sounds as if within the URL (right here as 2):
https://your-domain.atlassian.web/jira/device/tasks/SCRUM/forums/2
This is identical worth Jira contains within the sprint_started webhook payload as originBoardId. The mapping of board IDs to web site IDs lives on your .env record:
BOARD_ID_CLIENT_A=2
SITE_ID_CLIENT_A=fbab4927-e354-4044-b226-29ac0fbd20ca
BOARD_ID_CLIENT_B=5
SITE_ID_CLIENT_B=44b5a6d1-c83f-4b0e-9a1c-2e7dbc903fa1
Additionally, for native construction, Jira can’t achieve localhost immediately. Ngrok can be utilized to reveal a neighborhood port to the web with a brief public URL, which you’ll use as your webhook endpoint all over construction. After you have a deployed middleware cope with, you’ll exchange it.
Easy methods to automate dash setting provisioning with Jira and the Kinsta API
This integration runs throughout two techniques. In Jira, a webhook fires when a dash begins and delivers the development payload on your middleware. For Kinsta, the middleware reads the board ID from the payload, resolves it to a web site ID the use of the config map, and calls the Kinsta API to create a simple staging setting named after the dash.
1. Check in a Jira webhook for dash occasions
Jira Cloud will provide you with two tactics to check in a webhook. The better choice for many groups is during the Jira UI. The Settings > Machine choice is throughout the best right-hand menu:

From there, make a selection Complex > WebHooks, then click on Create a WebHook:

Right here, input a reputation, paste in a middleware URL with /dash appended (a dummy choice is okay for now), and beneath Occasions make a selection Dash > began. This creates an admin webhook, which fires for each sprint_started match throughout all your Jira example.

The second one choice is the REST API, the use of POST /relaxation/webhooks/1.0/webhook. This works neatly when webhook registration is a part of a deployment script:
curl -X POST
https://your-domain.atlassian.web/relaxation/webhooks/1.0/webhook
-u [email protected]:your-api-token
-H 'Content material-Kind: software/json'
-d '{
"title": "Dash provisioning webhook",
"url": "https://your-middleware-url.com/dash",
"occasions": ["sprint_started"],
"filters": {},
"excludeBody": false
}'
Calling PUT /relaxation/webhooks/1.0/webhook/refresh provides an extension to the 30-day time to run out for the webhook. When Jira fires sprint_started, the payload arrives at your endpoint as a JSON POST with the next construction:
{
"timestamp": 1705431600000,
"webhookEvent": "sprint_started",
"dash": {
"identification": 15,
"self": "https://your-domain.atlassian.web/relaxation/agile/1.0/dash/15",
"state": "energetic",
"title": "Dash 12",
"startDate": "2026-02-02T00:00:00.000Z",
"endDate": "2026-02-27T00:00:00.000Z",
"originBoardId": 2,
"objective": "Whole fee processing enhancements"
}
}
The middleware makes use of dash.originBoardId to appear up the Kinsta web site ID and dash.title to call the brand new setting: each sprint_started match inside of your Jira example reaches the endpoint. The board ID look up within the config map is what scopes the automation to the appropriate shopper challenge and ignores the whole lot else.
2. Construct the middleware endpoint
With the webhook in position, you will have to subsequent initialize a brand new Node.js challenge and set up Categorical.js along dotenv:
npm init -y
npm set up categorical dotenv
categorical handles the routing and request parsing, whilst dotenv a lot your .env record. You wish to have to create app.js to arrange the server. Right here’s the entire record:
// app.js
const categorical = require('categorical');
const crypto = require('crypto');
require('dotenv').config();
const app = categorical();
// Uncooked frame parser at the /dash course permits HMAC signature verification
app.use('/dash', categorical.uncooked({ kind: 'software/json' }));
app.use(categorical.json());
const KinstaAPIUrl = 'https://api.kinsta.com/v2';
const headers = {
'Content material-Kind': 'software/json',
Authorization: `Bearer ${procedure.env.KINSTA_API_KEY}`
};
// Board ID to Kinsta web site ID config map
const siteConfig = {
[process.env.BOARD_ID_CLIENT_A]: procedure.env.SITE_ID_CLIENT_A,
[process.env.BOARD_ID_CLIENT_B]: procedure.env.SITE_ID_CLIENT_B,
};
serve as verifyJiraSignature(req)
app.put up('/dash', async (req, res) => {
if (!verifyJiraSignature(req)) {
go back res.standing(401).json({ message: 'Invalid signature' });
}
const frame = JSON.parse(req.frame);
const { webhookEvent, dash } = frame;
if (webhookEvent !== 'sprint_started') {
go back res.standing(200).json({ message: 'Match left out' });
}
const boardId = String(dash.originBoardId);
const siteId = siteConfig[boardId];
if (!siteId) {
console.log(`No web site configured for board ${boardId}`);
go back res.standing(200).json({ message: 'Board no longer mapped' });
}
// Kinsta API calls added within the steps underneath
res.standing(200).json({ message: 'Won' });
});
app.concentrate(3000, () => console.log('Middleware working on port 3000'));
To offer protection to the endpoint, you generate a secret key all over the webhook setup. Jira makes this non-compulsory all over setup, but it surely’s almost crucial for a protected example.
Endpoint safety
Jira indicators every payload and contains the end result within the X-Hub-Signature header as sha256=. You upload the name of the game on your .env record along the opposite credentials:
JIRA_WEBHOOK_SECRET=your_webhook_secret_here
The verification serve as lives in app.js and makes use of Node’s integrated crypto module. It reads the signature from the request header, computes the anticipated HMAC in opposition to the uncooked request frame, and makes use of timingSafeEqual to check them in some way that forestalls timing assaults. Right here’s the related portion of app.js:
const crypto = require('crypto');
serve as verifyJiraSignature(req)
This serve as is the very first thing referred to as within the POST /dash course handler. If verification fails, the middleware returns 401 in an instant, and not anything else runs:
app.put up('/dash', async (req, res) => {
if (!verifyJiraSignature(req)) {
go back res.standing(401).json({ message: 'Invalid signature' });
}
const frame = JSON.parse(req.frame);
// …remainder of the handler
});
The course makes use of categorical.uncooked() at the /dash trail as a result of verifyJiraSignature wishes it to compute the HMAC. As soon as verification passes, JSON.parse(req.frame) provides the similar outcome categorical.json() would have.
3. Authenticate with the Kinsta API and retrieve web site environments
All requests to the Kinsta API use Bearer token authentication: the headers consistent in app.js handles that for each request within the software. The require('dotenv').config() line on the best guarantees the important thing a lot from .env sooner than anything runs, so it by no means seems within the supply code itself.
Kinsta makes use of setting IDs moderately than web site IDs for the provisioning endpoint, so that you will have to upload a getEnvironmentId serve as underneath the headers consistent:
const getEnvironmentId = async (siteId) => {
const resp = anticipate fetch(
`${KinstaAPIUrl}/websites/${siteId}/environments`,
{ means: 'GET', headers }
);
const information = anticipate resp.json();
go back information.web site.environments[0].identification;
};
This calls GET /websites/{siteId}/environments and returns the ID of the primary (i.e., reside) setting within the reaction. If a web site makes use of a couple of environments and you want to focus on a selected one, fit in opposition to the surroundings title moderately than taking the primary outcome.
4. Create a simple staging setting the use of the Kinsta API
With the web site and setting IDs resolved, the middleware calls POST /websites/{siteId}/environments/simple to create the dash setting. You do that thru a createSprintEnvironment serve as underneath getEnvironmentId:
const createSprintEnvironment = async (siteId, sprintName) => {
const resp = anticipate fetch(
`${KinstaAPIUrl}/websites/${siteId}/environments/simple`,
{
means: 'POST',
headers,
frame: JSON.stringify({
display_name: sprintName,
is_premium: false
})
}
);
const information = anticipate resp.json();
go back information;
};
display_name seems in MyKinsta, while the use of dash.title from the Jira payload immediately manner every setting within the dashboard suits the dash it belongs to. The is_premium flag determines whether or not Kinsta provisions this as an ordinary or top rate staging setting. Environment it to false creates an ordinary setting.
When the request reaches Kinsta, it returns 202 Permitted with an operation_id moderately than a finished setting:
{
"operation_id": "environments:add-plain-54fb80af-576c-4fdc-ba4f-b596c83f15a1",
"message": "Including simple setting in growth",
"standing": 202
}
Kinsta’s async processing avoids a blocked request thread whilst the provisioning completes. The operation_id is what you move to the endpoint to trace growth. Subsequent, replace the POST /dash course to name each purposes in collection:
app.put up('/dash', async (req, res) => {
if (!verifyJiraSignature(req)) {
go back res.standing(401).json({ message: 'Invalid signature' });
}
const frame = JSON.parse(req.frame);
const { webhookEvent, dash } = frame;
if (webhookEvent !== 'sprint_started') {
go back res.standing(200).json({ message: 'Match left out' });
}
const boardId = String(dash.originBoardId);
const siteId = siteConfig[boardId];
if (!siteId) {
console.log(`No web site configured for board ${boardId}`);
go back res.standing(200).json({ message: 'Board no longer mapped' });
}
check out {
const envId = anticipate getEnvironmentId(siteId);
const outcome = anticipate createSprintEnvironment(siteId, dash.title);
res.standing(200).json(outcome);
} catch (err) {
console.error(err);
res.standing(500).json({ message: 'Atmosphere advent failed' });
}
});
The use of the check out block is cleaner than depending on a couple of if statements. On the other hand, stay the Jira signature verification on the best of the record because it must run sooner than another code.
5. Ballot the operation standing and ensure provisioning
To trace of entirety, ballot GET /operations/{operation_id} till the standing returns as 200 the use of a pollOperation serve as underneath createSprintEnvironment:
const pollOperation = async (operationId, intervalMs = 5000, maxAttempts = 12) => {
for (let strive = 0; strive < maxAttempts; attempt++) {
await new Promise(resolve => setTimeout(get to the bottom of, intervalMs));
const resp = anticipate fetch(
`${KinstaAPIUrl}/operations/${operationId}`,
{ means: 'GET', headers }
);
const information = anticipate resp.json();
if (information.standing === 200) {
console.log(`Atmosphere able: ${operationId}`);
go back information;
}
if (information.standing >= 400) {
throw new Error(`Operation failed: ${information.message}`);
}
}
throw new Error('Operation timed out after most makes an attempt');
};
The loop waits 5 seconds between every strive and covers as much as a minute of provisioning time. Whilst 200 alerts of entirety, any 4xx standing signifies a failure to research.

In the event you run all of this with node app.js and get started a dash in Jira, the surroundings will have to seem in MyKinsta inside of a minute or two.
Stay your company forward of the dash
This integration provisions a blank, named simple staging setting inside of MyKinsta in accordance with beginning a dash in Jira. The webhook fires, the middleware resolves the board ID to a web site, the Kinsta API handles the remaining, and the group selections up their tickets with an atmosphere this is already looking ahead to them.
When the middleware is able to cross reside, Sevalla is an easy deployment goal. You push the challenge to a Git supplier, attach the repo, upload the surroundings variables, and replace the Jira webhook URL to the reside cope with.
What’s extra, Kinsta’s Company Spouse Program is perfect for businesses that organize a couple of shopper tasks. It will provide you with devoted improve, co-marketing alternatives, and the type of infrastructure partnership that helps the automation layer you’re development on best of the Kinsta API.
The put up Easy methods to automate dash setting provisioning with Jira and the Kinsta API gave the impression first on Kinsta®.
WP Hosting
