Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Capture all signups for Infisical Cloud

Carlos Monastyrski58a079060daa
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts
index 65057f4593..8351beb41c 100644
--- a/backend/src/lib/config/env.ts
+++ b/backend/src/lib/config/env.ts
@@ -210,6 +210,9 @@ const envSchema = z
POSTHOG_HOST: zpStr(z.string().optional().default("https://app.posthog.com")),
POSTHOG_PROJECT_API_KEY: zpStr(z.string().optional().default("phc_nSin8j5q2zdhpFDI1ETmFNUIuTG4DwKVyIigrY10XiE")),
LOOPS_API_KEY: zpStr(z.string().optional()),
+ // HubSpot Forms API for capturing signups
+ HUBSPOT_PORTAL_ID: zpStr(z.string().optional()),
+ HUBSPOT_SIGNUP_FORM_ID: zpStr(z.string().optional()),
// GitHub API token for upgrade path tool
GITHUB_API_TOKEN: zpStr(z.string().optional()),
// jwt options
diff --git a/backend/src/server/routes/v3/signup-router.ts b/backend/src/server/routes/v3/signup-router.ts
index 1b6ad4b4a1..ab3431ae6a 100644
--- a/backend/src/server/routes/v3/signup-router.ts
+++ b/backend/src/server/routes/v3/signup-router.ts
@@ -136,7 +136,7 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
if (!userAgent) throw new Error("user agent header is required");
const appCfg = getConfig();
- const { user, accessToken, refreshToken, organizationId } =
+ const { user, accessToken, refreshToken, organizationId, authMethod } =
await server.services.signup.completeEmailAccountSignup({
...req.body,
ip: req.realIp,
@@ -146,6 +146,12 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
if (user.email) {
void server.services.telemetry.sendLoopsEvent(user.email, user.firstName || "", user.lastName || "");
+ void server.services.telemetry.sendHubSpotSignupEvent(
+ user.email,
+ authMethod,
+ user.firstName || "",
+ user.lastName || ""
+ );
}
void server.services.telemetry.sendPostHogEvents({
@@ -226,6 +232,12 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
if (user.email) {
void server.services.telemetry.sendLoopsEvent(user.email, user.firstName || "", user.lastName || "");
+ void server.services.telemetry.sendHubSpotSignupEvent(
+ user.email,
+ "invite",
+ user.firstName || "",
+ user.lastName || ""
+ );
}
void server.services.telemetry.sendPostHogEvents({
diff --git a/backend/src/services/auth/auth-signup-service.ts b/backend/src/services/auth/auth-signup-service.ts
index 545e623b23..5ec6146b09 100644
--- a/backend/src/services/auth/auth-signup-service.ts
+++ b/backend/src/services/auth/auth-signup-service.ts
@@ -337,7 +337,13 @@ export const authSignupServiceFactory = ({
{ expiresIn: refreshTokenExpiresIn }
);
- return { user: updateduser.info, accessToken, refreshToken, organizationId };
+ return {
+ user: updateduser.info,
+ accessToken,
+ refreshToken,
+ organizationId,
+ authMethod: authMethod || AuthMethod.EMAIL
+ };
};
/*
diff --git a/backend/src/services/telemetry/telemetry-service.ts b/backend/src/services/telemetry/telemetry-service.ts
index 644e2d863e..14dad062a1 100644
--- a/backend/src/services/telemetry/telemetry-service.ts
+++ b/backend/src/services/telemetry/telemetry-service.ts
@@ -102,6 +102,36 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
}
};
+ const sendHubSpotSignupEvent = async (email: string, signupMethod: string, firstName?: string, lastName?: string) => {
+ const instanceType = licenseService.getInstanceType();
+ if (instanceType === InstanceType.Cloud && appCfg.HUBSPOT_PORTAL_ID && appCfg.HUBSPOT_SIGNUP_FORM_ID) {
+ try {
+ await request.post(
+ `https://api.hsforms.com/submissions/v3/integration/submit/${appCfg.HUBSPOT_PORTAL_ID}/${appCfg.HUBSPOT_SIGNUP_FORM_ID}`,
+ {
+ fields: [
+ { name: "email", value: email },
+ { name: "signup_method", value: signupMethod },
+ ...(firstName ? [{ name: "firstname", value: firstName }] : []),
+ ...(lastName ? [{ name: "lastname", value: lastName }] : [])
+ ],
+ context: {
+ pageUri: `${appCfg.SITE_URL || "https://app.infisical.com"}/signup`,
+ pageName: "App Signup"
+ }
+ },
+ {
+ headers: {
+ "Content-Type": "application/json"
+ }
+ }
+ );
+ } catch (error) {
+ logger.error(error, "Failed to send HubSpot signup event");
+ }
+ }
+ };
+
const getOrgGroupProperties = async (orgId: string, orgName?: string): Promise<Record<string, unknown>> => {
const properties: Record<string, unknown> = {};
if (orgName) {
@@ -480,6 +510,7 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
return {
sendLoopsEvent,
+ sendHubSpotSignupEvent,
sendPostHogEvents,
identifyUser,
identifyIdentity,