We build custom applications 5x faster and cheaper 🚀
Book a Free Consultation
Stuck on an error? Book a 30-minute call with an engineer and get a direct fix + next steps. No pressure, no commitment.
Replit can integrate with Kentico (both Kentico Xperience and Kentico Kontent) using their official REST APIs or SDKs. The integration works by running a Node.js (or other backend) process in a Repl that calls Kentico’s APIs using API keys stored as Replit Secrets. You can call these APIs to fetch or send content, build webhooks so Kentico can notify your Repl of content updates, and even serve a dynamic website pulling content directly from Kentico. The main connection method is over HTTPS — your Repl acts as a client consuming Kentico’s online API endpoints.
Kentico has two main platforms:
Both platforms let you connect as an external app using an API key (for data access) or Webhooks (to push notifications to your app running in Replit).
Here’s a practical flow for integrating Kentico Kontent (the headless CMS) into a Node.js Repl.
@kontent-ai/delivery-sdk for fetching data.0.0.0.0 and a port taken from process.env.PORT.
// Installing Kentico Kontent (Kontent.ai) Delivery SDK
npm install @kontent-ai/delivery-sdk express
import express from "express";
import { createDeliveryClient } from "@kontent-ai/delivery-sdk";
const app = express();
const port = process.env.PORT || 3000;
// Use Replit Secrets for these values
const projectId = process.env.KONTENT_PROJECT_ID;
const previewApiKey = process.env.KONTENT_PREVIEW_API_KEY;
// Initialize Kentico Delivery client
const client = createDeliveryClient({
projectId: projectId,
previewApiKey: previewApiKey, // Optional – only needed for preview mode
});
// Simple API route fetching content from Kentico
app.get("/articles", async (req, res) => {
try {
const response = await client.items().type("article").toPromise();
res.json(response.data.items);
} catch (err) {
console.error(err);
res.status(500).send("Error fetching data from Kentico");
}
});
app.listen(port, "0.0.0.0", () => {
console.log(`Server running on port ${port}`);
});
process.env.
If your Repl needs to respond to content updates (e.g., rebuild when an article changes), set up a Kentico Webhook pointing to your Repl’s public URL (you get that when the Repl runs). In your Express app, define a POST route to receive the webhook payload.
app.post("/webhook", express.json(), (req, res) => {
console.log("Webhook received:", req.body);
res.status(200).send("OK");
});
Integrating Replit with Kentico mainly means connecting your Replit-hosted Node.js app to Kentico’s REST or GraphQL APIs using secure environment variables. Replit hosts your integration code or webhook endpoints, and Kentico serves as the content source. Everything is done over HTTPS APIs — no special Replit plugin or connector is needed. Keep everything explicit: API keys, secret management, real URLs, and proper server binding.
1
Use Kentico’s Content Delivery REST API to serve CMS-managed content dynamically into a Replit-hosted web app. This setup lets a Replit app pull structured content—like blog posts, product data, or landing page text—directly from Kentico’s cloud service instead of hardcoding it. The Replit server (for example, Node.js + Express) can call Kentico endpoints at runtime, render results, or cache updates as needed. You’ll store the Kentico API key safely in Replit Secrets and access it through process.env. A typical flow: the Repl receives a visitor’s request, makes a REST call to Kentico to fetch content by codename, and renders that into its frontend template.
0.0.0.0 and expose the port (e.g., 3000) explicitly through the Replit config.KENTICO_API_KEY.// server.js
import express from "express";
import fetch from "node-fetch";
const app = express();
app.get("/", async (req, res) => {
const projectId = process.env.KENTICO_PROJECT_ID;
const url = `https://deliver.kontent.ai/${projectId}/items`;
const response = await fetch(url);
const data = await response.json();
res.send(data);
});
app.listen(3000, "0.0.0.0", () => console.log("Server running on port 3000"));
2
Kentico can notify your app when editors publish or update content by sending an HTTP POST request (webhook) to your Replit server. You can run a Repl with an Express API endpoint that listens for these updates and automatically refreshes cached data, triggers previews, or posts deployment hooks. You’ll set the public Repl URL as the webhook target in Kentico. Because Replit hosting provides a live endpoint during runtime, you can test and debug the webhook flow easily. Always verify Kentico’s signature headers to ensure authenticity, and log payloads for traceability during development.
// webhook.js
import express from "express";
const app = express();
app.use(express.json());
app.post("/kentico-webhook", (req, res) => {
const event = req.body;
console.log("Received webhook:", event);
// Example: trigger rebuild logic or refresh cache here
res.status(200).send("OK");
});
app.listen(3000, "0.0.0.0", () => console.log("Webhook listener active"));
3
You can build custom lightweight tools on Replit that communicate via Kentico’s Management API (authenticated with an API key) for editorial operations like creating or validating items. For instance, an editor-facing panel running on Replit could allow quick draft creation, automated SEO checks, or consistency auditing. Use fetch from the Replit backend to the Kentico Management endpoint, handling content-type creation or updates programmatically. This makes it ideal for smaller teams wanting utility scripts or dashboards without deploying a full backend infrastructure elsewhere. Always store credentials as environment variables to protect access keys.
// management.js
import fetch from "node-fetch";
const projectId = process.env.KENTICO_PROJECT_ID;
const apiKey = process.env.KENTICO_MANAGEMENT_API_KEY;
async function createItem() {
const response = await fetch(`https://manage.kontent.ai/v2/projects/${projectId}/items`, {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
name: "New Article",
type: { codename: "article" },
sitemap_locations: []
})
});
const result = await response.json();
console.log(result);
}
createItem();
Speak one‑on‑one with a senior engineer about your no‑code app, migration goals, and budget. In just half an hour you’ll leave with clear, actionable next steps—no strings attached.
1
If Kentico API requests fail inside Replit, you’re likely hitting two separate but common issues: HTTPS restrictions from Node’s runtime, or CORS blocking by the browser when calling Kentico directly from the frontend. Inside Replit, always call external HTTPS APIs from your backend (server.js, Python Flask, etc.), not from client-side code, so you avoid browser CORS limits. Ensure API URLs start with https://, not http, since Replit blocks outgoing insecure requests.
// Example: server.js running inside Replit
import express from "express"
import fetch from "node-fetch"
const app = express()
app.get("/api/kentico", async (req, res) => {
const r = await fetch("https://deliver.kontent.ai/YOUR_PROJECT_ID/items")
const data = await r.json()
res.json(data)
})
app.listen(3000, "0.0.0.0") // Port mapped via Replit
2
Replit Secrets become environment variables only when your Repl is running — they aren’t “magically” visible to Kentico or any other external integration. The correct setup: add credentials in the Replit Secrets tab, reference them through process.env.VARIABLE\_NAME inside your Node.js or Python code, and pass those values explicitly to your Kentico SDK or API configuration. Never hardcode or expose the values in client-side code. If the integration runs during a Workflow or Deployment, ensure that environment variables are defined in that environment too.
// Example: passing Replit Secrets into Kentico Delivery SDK
import { createDeliveryClient } from '@kentico/kontent-delivery'
const client = createDeliveryClient({
projectId: process.env.KENTICO_PROJECT_ID, // pulled from Replit Secrets
apiKey: process.env.KENTICO_API_KEY // pulled from Replit Secrets
})
3
If the Kentico SDK fails to build in Replit, it usually means the build environment doesn’t have required dependencies (like Node modules or .NET tools) or the runtime image isn’t matching the SDK’s expectations. In Replit, you must explicitly install dependencies through your package manager (npm, pip, dotnet), ensure proper runtime selection in the Replit configuration (replit.nix or .replit), and define all needed environment variables using Replit Secrets.
// Example for JavaScript SDK
npm install @kentico/kontent-delivery
// Example for .NET SDK
dotnet add package Kentico.Kontent.Management
After installing, use the Replit shell to confirm successful builds. If the runtime still breaks, open the replit.nix file, add missing packages (like nodejs, dotnet-sdk), and then click “Rebuild Environment.” That restores the toolchain required by Kentico’s libraries and resolves most build issues.
Many developers forget to verify incoming Kentico webhooks inside their Replit app. This means your API endpoint could accept fake webhook calls. Kentico sends a signature header (for example X-KC-Signature), which you must check against a secret value stored in Replit Secrets. Always compare this signature using your environment variable, not hardcoded text.
KENTICO_WEBHOOK_SECRET).import crypto from "crypto"
import express from "express"
const app = express()
app.use(express.json())
app.post("/kentico-webhook", (req, res) => {
const signature = req.headers["x-kc-signature"]
const expected = crypto
.createHmac("sha256", process.env.KENTICO_WEBHOOK_SECRET)
.update(JSON.stringify(req.body))
.digest("hex")
if (signature !== expected) return res.status(401).send("Invalid signature")
res.send("ok")
})
Replit apps run inside containers. If you bind your web server to localhost (127.0.0.1), Kentico can’t reach it. You must bind to 0.0.0.0 and use the port that Replit assigns to your server. This port is automatically exposed via your Repl’s URL once running. Forgetting this makes your webhook endpoint unreachable from Kentico.
process.env.PORT provided by Replit.import express from "express"
const app = express()
app.get("/", (req, res) => res.send("Server reachable"))
app.listen(process.env.PORT || 3000, "0.0.0.0", () => {
console.log("Listening on", process.env.PORT)
})
Placing Kentico API keys directly in your code commits them to your Repl’s history and exposes them publicly. You should instead use Replit Secrets to store sensitive values. This keeps your credentials encrypted and accessible only inside your running instance, preventing leaks or misuse when the code is shared or forked.
process.env.import fetch from "node-fetch"
const PROJECT_ID = process.env.KENTICO_PROJECT_ID
const API_KEY = process.env.KENTICO_API_KEY
async function getItems() {
const res = await fetch(`https://deliver.kontent.ai/${PROJECT_ID}/items`, {
headers: { Authorization: `Bearer ${API_KEY}` }
})
return res.json()
}
Replit’s filesystem resets on restarts, so saving Kentico sync data or cached responses locally will vanish. Don’t depend on local JSON files or SQLite databases. Instead use Kentico’s Delivery API for content or plug in an external persistent store (like Replit’s built-in Database, or hosted PostgreSQL). Keep Replit for stateless logic, not data persistence.
/home/runner/ for permanent data.// Example: caching content in Replit Database instead of local file
import Database from "@replit/database"
const db = new Database()
await db.set("kenticoCache", { lastSync: Date.now() })
const cache = await db.get("kenticoCache")
console.log(cache)
This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.
From startups to enterprises and everything in between, see for yourself our incredible impact.
Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We’ll discuss your project and provide a custom quote at no cost.Â