|
2 | 2 | // import { Client } from "intercom-client";
|
3 | 3 | import { createUser, hashPassword } from "@/features/auth";
|
4 | 4 | // import { intercomAccessToken } from "@/lib/services";
|
| 5 | +import { isString } from "lodash" |
5 | 6 | import { schema } from "@/features/auth/signupSchema";
|
6 | 7 | import { serverSegment } from "@/lib/track";
|
| 8 | +import { slackGrowthChannelWebhook } from "@/lib/services" |
7 | 9 | import { withMiddlewares } from "@/features/api/middleware";
|
8 | 10 | import ApiResponse from "@/features/api/ApiResponse";
|
9 | 11 | import email from "@/lib/email";
|
@@ -72,6 +74,30 @@ const handler = async (
|
72 | 74 | // } as any);
|
73 | 75 | // }
|
74 | 76 |
|
| 77 | + let identifier = payload.email |
| 78 | + |
| 79 | + if (payload.firstName || payload.lastName) { |
| 80 | + identifier += ` ${payload.firstName} ${payload.lastName}` |
| 81 | + } |
| 82 | + |
| 83 | + if (payload.organization) { |
| 84 | + identifier += ` - ${payload.organization}` |
| 85 | + } |
| 86 | + |
| 87 | + if (payload.lastKnownTimezone) { |
| 88 | + identifier += ` (${payload.lastKnownTimezone})` |
| 89 | + } |
| 90 | + |
| 91 | + if (isString(slackGrowthChannelWebhook)) { |
| 92 | + await fetch(slackGrowthChannelWebhook, { |
| 93 | + method: 'POST', |
| 94 | + body: JSON.stringify({ |
| 95 | + text: `${identifier} signed up as a new user on basetool.io`, |
| 96 | + }), |
| 97 | + headers: { "Content-Type": "application/json" }, |
| 98 | + }) |
| 99 | + } |
| 100 | + |
75 | 101 | await email.send({
|
76 | 102 |
|
77 | 103 | subject: "New user signup",
|
|
0 commit comments