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.
To integrate Replit with Intercom, you treat Intercom exactly like any other external SaaS: you call its REST APIs using your Intercom Access Token, and you expose a webhook endpoint from your Repl for Intercom to POST data to. Replit doesn’t provide any special Intercom plugin, so everything is done with normal HTTP, environment variables, and a small server you run inside the Repl. In practice, you store your Intercom access token in Replit Secrets, write a small backend (Node or Python) to talk to Intercom's REST API, and expose an endpoint that Intercom can call for events such as user-created, conversation-created, or message-replied.
The real, working way to integrate Replit with Intercom is: store your Intercom Access Token in Replit Secrets, create a backend service in your Repl (for example Node.js with Express), call Intercom’s REST API to send messages or fetch conversations, and expose a webhook route (for example /intercom/webhook) so Intercom can send event notifications back into your Repl. You must keep your Repl running during testing so Intercom can reach it, and you map a public port exactly as Replit provides it (usually through the main web server). Everything is explicit HTTP.
INTERCOM\_TOKEN).
This is the cleanest, most reliable workflow for beginners and junior devs.
INTERCOM\_TOKEN
/intercom/webhook.
// index.js
import express from "express";
import axios from "axios";
const app = express();
app.use(express.json()); // Parse JSON bodies
const INTERCOM_TOKEN = process.env.INTERCOM_TOKEN; // Loaded from Replit Secrets
// Helper: call Intercom REST API
async function intercomRequest(method, url, data) {
return axios({
method,
url: "https://api.intercom.io" + url,
data,
headers: {
Authorization: `Bearer ${INTERCOM_TOKEN}`,
"Content-Type": "application/json",
Accept: "application/json"
}
});
}
// Basic sanity check
app.get("/", (req, res) => {
res.send("Intercom integration is running.");
});
// Example: Send a message to a user
app.post("/send-message", async (req, res) => {
try {
const { email, message } = req.body;
const response = await intercomRequest("post", "/messages", {
message_type: "inapp",
body: message,
from: { type: "admin", id: "YOUR_ADMIN_ID" }, // Replace with real admin ID from Intercom
to: { type: "user", email: email }
});
res.json({ ok: true, intercomResponse: response.data });
} catch (err) {
console.error(err);
res.status(500).json({ error: "Failed to send message" });
}
});
// Webhook endpoint for Intercom
app.post("/intercom/webhook", (req, res) => {
console.log("Received Intercom webhook:", req.body);
// IMPORTANT: Intercom expects 200 OK quickly.
res.status(200).send("OK");
// You can add any logic you want here — logging, replying, storing data, etc.
});
// Start server — must bind to 0.0.0.0 for Replit
app.listen(3000, "0.0.0.0", () => {
console.log("Server running on port 3000");
});
Intercom needs your server’s public URL. When your Repl is running, Replit gives you something like:
https://your‑repl‑name.username.repl.co
In Intercom’s dashboard:
Intercom will immediately try POST requests. Watch your Repl console to see them arrive.
That’s the real, production-valid way to integrate Replit with Intercom — explicit REST calls, explicit webhook routes, env vars in Secrets, and a small server running on 0.0.0.0.
1
An app running on Replit can receive lead data from an Intercom Messenger widget embedded in your frontend. When a visitor submits info, your JavaScript app sends it to your Replit backend, which then calls the Intercom REST API using your Intercom Access Token stored in Replit Secrets. This creates or updates a contact inside Intercom. It’s a simple flow that turns website activity into structured CRM data.
// Express server running inside Replit
import express from "express"
import fetch from "node-fetch"
const app = express()
app.use(express.json())
app.post("/lead", async (req, res) => {
const token = process.env.INTERCOM_ACCESS_TOKEN
const { email, name } = req.body
const resp = await fetch("https://api.intercom.io/contacts", {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({ email, name })
})
res.json(await resp.json())
})
app.listen(3000, "0.0.0.0")
2
Intercom can send webhooks to your Replit backend whenever a user starts a conversation, replies, or gets tagged by support. Your Replit service listens on a public URL, verifies the webhook signature, and triggers internal automations like updating your database, posting into Slack, or running a Replit Workflow. This turns Intercom events into backend actions without manual effort.
// Basic webhook listener
app.post("/intercom/webhook", (req, res) => {
// Normally you'd verify signature here
const event = req.body
console.log("Intercom event received:", event.type)
// Trigger custom automation...
res.status(200).send("ok")
})
3
You can build an internal dashboard hosted on Replit that fetches live Intercom data via the Intercom REST API. Support agents log into your tool (simple session auth or OAuth), and the dashboard displays users, conversations, and tags. Since Intercom has a stable JSON API, your Replit server fetches data on demand and renders it in your frontend, acting as a lightweight internal CRM layer.
// Fetch recent conversations
async function getConversations() {
const token = process.env.INTERCOM_ACCESS_TOKEN
const r = await fetch("https://api.intercom.io/conversations", {
headers: { "Authorization": `Bearer ${token}", "Accept": "application/json" }
})
return r.json()
}
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
The Intercom widget usually fails on Replit because the deployed app runs on a repl.co domain using an iframe‑based preview, and Intercom blocks loading when the domain isn’t added to your Intercom Allowed Domains. Intercom also refuses to run inside frames for security, so the widget only loads when you open the Deployment’s public URL directly, not the Replit editor preview.
Intercom validates the page’s origin. If your Replit URL (for example, https://yourapp.repl.co) isn’t listed in your Intercom settings, the widget silently aborts. Inside the Replit editor, your app is inside a sandboxed frame, which Intercom intentionally blocks. You must open the live Deployment URL in a new browser tab.
<script>
window.intercomSettings = { app_id: "YOUR_APP_ID" };
</script>
<script src="https://widget.intercom.io/widget/YOUR_APP_ID"></script>
2
You set Intercom environment variables in Replit by opening the Secrets panel and creating keys that match the variable names your code expects, such as INTERCOM_ACCESS_TOKEN. Replit then injects them into process.env at runtime, so your app can read them without hard‑coding sensitive data.
In the Replit workspace, open Tools → Secrets. Add each Intercom value as a separate key. Keep names simple and uppercase, because your backend will read them exactly as typed. Intercom typically gives you an access token or client credentials depending on your API flow.
const intercomToken = process.env.INTERCOM_ACCESS_TOKEN // pulled from Replit Secrets
This keeps your Intercom credentials safe, avoids committing them to Git, and works reliably across Repls and Deployments.
3
Your Intercom script fails in the basic Replit HTML/CSS/JS template because that template is a static file preview, not a real server. Intercom loads through remote scripts, cookies, and dynamic DOM injection, and the preview isolation blocks or delays these behaviors, so the widget never initializes.
The HTML/JS Repl serves files from a sandboxed iframe, so third‑party scripts cannot freely set cookies or run cross‑origin requests. Intercom’s loader expects a normal browser context, but Replit’s preview wraps your page, causing blocked requests and missing global window events.
<script>
window.intercomSettings={app_id:"xyz"} // Loads but can't initialize inside iframe
</script>
Intercom signs every webhook, but many Replit apps skip verifying the signature. Without checking the X-Hub-Signature header using your Intercom secret (stored in Replit Secrets), your endpoint accepts forged requests. Replit restarts also mean your server must re‑bind on port 0.0.0.0 and still verify signatures on every request.
// Example verification in Express
import crypto from "crypto";
import express from "express";
const app = express();
app.use(express.raw({ type: "*/*" })); // Webhooks must use raw body
app.post("/intercom/webhook", (req, res) => {
const secret = process.env.INTERCOM_SECRET; // stored in Replit Secrets
const sig = req.headers["x-hub-signature"];
const expected = "sha1=" + crypto
.createHmac("sha1", secret)
.update(req.body)
.digest("hex");
if (sig !== expected) return res.status(401).send("invalid signature");
res.send("ok");
});
app.listen(3000, "0.0.0.0");
Intercom webhooks need a stable public HTTPS URL, but the default Repl preview URL changes and sleeps. That breaks delivery. Developers accidentally register this temporary URL in Intercom, causing silent webhook failures. You must deploy or use an Always‑On Deployment so your endpoint stays reachable.
Intercom OAuth tokens must survive Replit restarts. Storing them in files within the Repl’s ephemeral filesystem or global variables causes token loss. Replit resets these on rebuild. Instead, store the client secret in Replit Secrets and persist user‑level OAuth tokens in an external DB (Supabase, Postgres, or KV) you control.
Intercom applies strict API rate limits, but many Replit integrations fire API calls synchronously in request handlers. Under traffic or webhook bursts, this triggers 429 errors. Replit’s single-process runtime amplifies this. Queue calls or add retry/backoff logic to avoid dropping messages or user events.
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.Â