diff --git a/packages/app-store/intercom/api/configure.ts b/packages/app-store/intercom/api/configure.ts
index 28d935ad2d..1bd0d65bf3 100644
--- a/packages/app-store/intercom/api/configure.ts
+++ b/packages/app-store/intercom/api/configure.ts
@@ -1,6 +1,6 @@
import type { NextApiRequest, NextApiResponse } from "next";
-import { WEBSITE_URL } from "@calcom/lib/constants";
+import { WEBAPP_URL } from "@calcom/lib/constants";
import prisma from "@calcom/prisma";
import type {
@@ -94,7 +94,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
return {
- id: `${WEBSITE_URL}/${slug}/${eventType.slug}`,
+ id: `${WEBAPP_URL}/${slug}/${eventType.slug}`,
type: "item",
title: eventType.title,
subtitle: `${slug}/${eventType.slug}`,
diff --git a/packages/app-store/intercom/api/get.ts b/packages/app-store/intercom/api/get.ts
new file mode 100644
index 0000000000..ba0a018513
--- /dev/null
+++ b/packages/app-store/intercom/api/get.ts
@@ -0,0 +1,84 @@
+import type { NextApiRequest, NextApiResponse } from "next";
+
+import { WEBAPP_URL } from "@calcom/lib/constants";
+
+export default async function handler(req: NextApiRequest, res: NextApiResponse) {
+ if (req.method === "POST") {
+ // Set Content-Type header to text/html
+ res.setHeader("Content-Type", "text/html");
+
+ const url = req.query.url as string;
+
+ if (!url) return res.status(400).json({ message: "Missing URL in query parameters" });
+
+ res.setHeader("Content-Type", "text/html");
+
+ // Generate HTML with embedded Cal component
+ const htmlResponse = `
+
+
+
+ Cal.com
+
+
+
+
+
+
+
+
+
+
+
+ `;
+
+ res.status(200).send(htmlResponse);
+ } else {
+ res.status(405).end(); // Method Not Allowed
+ }
+}
diff --git a/packages/app-store/intercom/api/index.ts b/packages/app-store/intercom/api/index.ts
index 11e6b47870..a06372443d 100644
--- a/packages/app-store/intercom/api/index.ts
+++ b/packages/app-store/intercom/api/index.ts
@@ -2,3 +2,4 @@ export { default as add } from "./add";
export { default as callback } from "./callback";
export { default as initialize } from "./initialize";
export { default as configure } from "./configure";
+export { default as get } from "./get";
diff --git a/packages/app-store/intercom/api/initialize.ts b/packages/app-store/intercom/api/initialize.ts
index a5480c1209..600a4095ec 100644
--- a/packages/app-store/intercom/api/initialize.ts
+++ b/packages/app-store/intercom/api/initialize.ts
@@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from "next";
-
+import { WEBAPP_URL } from "@calcom/lib/constants";
import type { NewCanvas } from "../lib";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
@@ -7,7 +7,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
if (!card_creation_options) return res.status(400).json({ message: "Missing card_creation_options" });
- const URL = card_creation_options.submit_booking_url;
+ const URL = `${WEBAPP_URL}/api/integrations/intercom/get?url=${card_creation_options.submit_booking_url}`;
const canvasData: NewCanvas = {
canvas: {
diff --git a/packages/app-store/intercom/lib/index.ts b/packages/app-store/intercom/lib/index.ts
index c4986b9075..21f4326a5f 100644
--- a/packages/app-store/intercom/lib/index.ts
+++ b/packages/app-store/intercom/lib/index.ts
@@ -34,7 +34,7 @@ export interface SpacerComponent extends CanvasComponent {
export interface TextComponent extends CanvasComponent {
type: "text";
text: string;
- style: "header" | "body" | "error" | "muted";
+ style: "header" | "paragraph" | "error" | "muted";
align: "left" | "center" | "right";
}
diff --git a/packages/app-store/intercom/lib/isValidCalURL.ts b/packages/app-store/intercom/lib/isValidCalURL.ts
index e370b2f2ee..3589c260d4 100644
--- a/packages/app-store/intercom/lib/isValidCalURL.ts
+++ b/packages/app-store/intercom/lib/isValidCalURL.ts
@@ -1,4 +1,4 @@
-import { WEBSITE_URL } from "@calcom/lib/constants";
+import { WEBAPP_URL } from "@calcom/lib/constants";
import prisma from "@calcom/prisma";
import type { TextComponent } from "../lib";
@@ -9,11 +9,11 @@ import type { TextComponent } from "../lib";
* @returns boolean
*/
export async function isValidCalURL(url: string) {
- const regex = new RegExp(`^${WEBSITE_URL}/`, `i`);
+ const regex = new RegExp(`^${WEBAPP_URL}/`, `i`);
const error: TextComponent = {
type: "text",
- text: `This is not a valid ${WEBSITE_URL.replace("https://", "")} link`,
+ text: `This is not a valid ${WEBAPP_URL.replace("https://", "")} link`,
style: "error",
align: "left",
};