@oneuptime/common 7.0.3652 → 7.0.3668

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/Models/DatabaseModels/Alert.ts +19 -0
  2. package/Models/DatabaseModels/Incident.ts +19 -0
  3. package/Models/DatabaseModels/ScheduledMaintenance.ts +19 -0
  4. package/Server/API/BaseAPI.ts +48 -0
  5. package/Server/Infrastructure/Postgres/SchemaMigrations/1739282331053-MigrationName.ts +29 -0
  6. package/Server/Infrastructure/Postgres/SchemaMigrations/1739374537088-MigrationName.ts +29 -0
  7. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  8. package/Server/Services/IncidentService.ts +101 -0
  9. package/Server/Services/MonitorService.ts +43 -0
  10. package/Server/Services/ProjectService.ts +3 -3
  11. package/Server/Services/TeamMemberService.ts +1 -0
  12. package/Server/Services/UserService.ts +6 -1
  13. package/Server/Services/WorkspaceNotificationRuleService.ts +442 -7
  14. package/Server/Services/WorkspaceProjectAuthTokenService.ts +43 -15
  15. package/Server/Types/Workflow/Components/Slack/SendMessageToChannel.ts +1 -1
  16. package/Server/Utils/Slack/Slack.ts +361 -26
  17. package/Types/Workspace/NotificationRules/BaseNotificationRule.ts +9 -0
  18. package/Types/Workspace/NotificationRules/NotificationRuleCondition.ts +23 -32
  19. package/Types/Workspace/NotificationRules/NotificationRuleTypes/AlertNotificationRule.ts +15 -0
  20. package/Types/Workspace/NotificationRules/NotificationRuleTypes/IncidentNotificationRule.ts +15 -0
  21. package/Types/Workspace/NotificationRules/NotificationRuleTypes/MonitorStatusNotificationRule.ts +7 -0
  22. package/Types/Workspace/NotificationRules/NotificationRuleTypes/ScheduledMaintenanceNotificationRule.ts +14 -0
  23. package/Types/Workspace/NotificationRules/NotificationRuleUtil.ts +261 -0
  24. package/Types/Workspace/WorkspaceChannelInvitationPayload.ts +4 -0
  25. package/Types/Workspace/WorkspaceMessagePayload.ts +30 -0
  26. package/build/dist/Models/DatabaseModels/Alert.js +21 -0
  27. package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
  28. package/build/dist/Models/DatabaseModels/Incident.js +21 -0
  29. package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
  30. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +21 -0
  31. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
  32. package/build/dist/Server/API/BaseAPI.js +34 -2
  33. package/build/dist/Server/API/BaseAPI.js.map +1 -1
  34. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739282331053-MigrationName.js +16 -0
  35. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739282331053-MigrationName.js.map +1 -0
  36. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739374537088-MigrationName.js +16 -0
  37. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739374537088-MigrationName.js.map +1 -0
  38. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  39. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  40. package/build/dist/Server/Services/IncidentService.js +84 -0
  41. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  42. package/build/dist/Server/Services/MonitorService.js +34 -0
  43. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  44. package/build/dist/Server/Services/ProjectService.js +3 -3
  45. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  46. package/build/dist/Server/Services/TeamMemberService.js +1 -0
  47. package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
  48. package/build/dist/Server/Services/UserService.js +4 -1
  49. package/build/dist/Server/Services/UserService.js.map +1 -1
  50. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +316 -4
  51. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  52. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js +29 -4
  53. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js.map +1 -1
  54. package/build/dist/Server/Types/Workflow/Components/Slack/SendMessageToChannel.js +1 -1
  55. package/build/dist/Server/Types/Workflow/Components/Slack/SendMessageToChannel.js.map +1 -1
  56. package/build/dist/Server/Utils/Slack/Slack.js +227 -18
  57. package/build/dist/Server/Utils/Slack/Slack.js.map +1 -1
  58. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js +20 -21
  59. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js.map +1 -1
  60. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleTypes/AlertNotificationRule.js +2 -0
  61. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleTypes/AlertNotificationRule.js.map +1 -0
  62. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleTypes/IncidentNotificationRule.js +2 -0
  63. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleTypes/IncidentNotificationRule.js.map +1 -0
  64. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleTypes/MonitorStatusNotificationRule.js +2 -0
  65. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleTypes/MonitorStatusNotificationRule.js.map +1 -0
  66. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleTypes/ScheduledMaintenanceNotificationRule.js +2 -0
  67. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleTypes/ScheduledMaintenanceNotificationRule.js.map +1 -0
  68. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleUtil.js +216 -0
  69. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleUtil.js.map +1 -0
  70. package/build/dist/Types/Workspace/WorkspaceChannelInvitationPayload.js +2 -0
  71. package/build/dist/Types/Workspace/WorkspaceChannelInvitationPayload.js.map +1 -0
  72. package/build/dist/Types/Workspace/WorkspaceMessagePayload.js +2 -0
  73. package/build/dist/Types/Workspace/WorkspaceMessagePayload.js.map +1 -0
  74. package/package.json +2 -2
  75. package/Types/Workspace/NotificationRules/SlackNotificationRule.ts +0 -19
  76. package/Types/Workspace/WorkspaceNotificationPayload.ts +0 -3
  77. package/build/dist/Types/Workspace/NotificationRules/SlackNotificationRule.js +0 -2
  78. package/build/dist/Types/Workspace/NotificationRules/SlackNotificationRule.js.map +0 -1
  79. package/build/dist/Types/Workspace/WorkspaceNotificationPayload.js +0 -2
  80. package/build/dist/Types/Workspace/WorkspaceNotificationPayload.js.map +0 -1
@@ -1035,4 +1035,23 @@ export default class Alert extends BaseModel {
1035
1035
  nullable: true,
1036
1036
  })
1037
1037
  public alertNumber?: number = undefined;
1038
+
1039
+ @ColumnAccessControl({
1040
+ create: [],
1041
+ read: [],
1042
+ update: [],
1043
+ })
1044
+ @TableColumn({
1045
+ isDefaultValueColumn: false,
1046
+ required: false,
1047
+ type: TableColumnType.ShortText,
1048
+ title: "Post Updates To Workspace Channel Name",
1049
+ description: "Post Updates To Workspace Channel Name",
1050
+ })
1051
+ @Column({
1052
+ type: ColumnType.ShortText,
1053
+ length: ColumnLength.ShortText,
1054
+ nullable: true,
1055
+ })
1056
+ public postUpdatesToWorkspaceChannelName?: number = undefined;
1038
1057
  }
@@ -1120,4 +1120,23 @@ export default class Incident extends BaseModel {
1120
1120
  nullable: true,
1121
1121
  })
1122
1122
  public incidentNumber?: number = undefined;
1123
+
1124
+ @ColumnAccessControl({
1125
+ create: [],
1126
+ read: [],
1127
+ update: [],
1128
+ })
1129
+ @TableColumn({
1130
+ isDefaultValueColumn: false,
1131
+ required: false,
1132
+ type: TableColumnType.ShortText,
1133
+ title: "Post Updates To Workspace Channel Name",
1134
+ description: "Post Updates To Workspace Channel Name",
1135
+ })
1136
+ @Column({
1137
+ type: ColumnType.ShortText,
1138
+ length: ColumnLength.ShortText,
1139
+ nullable: true,
1140
+ })
1141
+ public postUpdatesToWorkspaceChannelName?: number = undefined;
1123
1142
  }
@@ -979,4 +979,23 @@ export default class ScheduledMaintenance extends BaseModel {
979
979
  nullable: true,
980
980
  })
981
981
  public scheduledMaintenanceNumber?: number = undefined;
982
+
983
+ @ColumnAccessControl({
984
+ create: [],
985
+ read: [],
986
+ update: [],
987
+ })
988
+ @TableColumn({
989
+ isDefaultValueColumn: false,
990
+ required: false,
991
+ type: TableColumnType.ShortText,
992
+ title: "Post Updates To Workspace Channel Name",
993
+ description: "Post Updates To Workspace Channel Name",
994
+ })
995
+ @Column({
996
+ type: ColumnType.ShortText,
997
+ length: ColumnLength.ShortText,
998
+ nullable: true,
999
+ })
1000
+ public postUpdatesToWorkspaceChannelName?: number = undefined;
982
1001
  }
@@ -131,6 +131,30 @@ export default class BaseAPI<
131
131
  },
132
132
  );
133
133
 
134
+ router.post(
135
+ `${new this.entityType().getCrudApiPath()?.toString()}/:id/update-item`,
136
+ UserMiddleware.getUserMiddleware,
137
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
138
+ try {
139
+ await this.updateItem(req, res);
140
+ } catch (err) {
141
+ next(err);
142
+ }
143
+ },
144
+ );
145
+
146
+ router.get(
147
+ `${new this.entityType().getCrudApiPath()?.toString()}/:id/update-item`,
148
+ UserMiddleware.getUserMiddleware,
149
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
150
+ try {
151
+ await this.updateItem(req, res);
152
+ } catch (err) {
153
+ next(err);
154
+ }
155
+ },
156
+ );
157
+
134
158
  // Delete
135
159
  router.delete(
136
160
  `${new this.entityType().getCrudApiPath()?.toString()}/:id`,
@@ -144,6 +168,30 @@ export default class BaseAPI<
144
168
  },
145
169
  );
146
170
 
171
+ router.post(
172
+ `${new this.entityType().getCrudApiPath()?.toString()}/:id/delete-item`,
173
+ UserMiddleware.getUserMiddleware,
174
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
175
+ try {
176
+ await this.deleteItem(req, res);
177
+ } catch (err) {
178
+ next(err);
179
+ }
180
+ },
181
+ );
182
+
183
+ router.get(
184
+ `${new this.entityType().getCrudApiPath()?.toString()}/:id/delete-item`,
185
+ UserMiddleware.getUserMiddleware,
186
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
187
+ try {
188
+ await this.deleteItem(req, res);
189
+ } catch (err) {
190
+ next(err);
191
+ }
192
+ },
193
+ );
194
+
147
195
  this.router = router;
148
196
  this.service = service;
149
197
  }
@@ -0,0 +1,29 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1739282331053 implements MigrationInterface {
4
+ public name = "MigrationName1739282331053";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "Incident" ADD "postUpdatesToSlackChannelId" character varying(100)`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "Alert" ADD "postUpdatesToSlackChannelId" character varying(100)`,
12
+ );
13
+ await queryRunner.query(
14
+ `ALTER TABLE "ScheduledMaintenance" ADD "postUpdatesToSlackChannelId" character varying(100)`,
15
+ );
16
+ }
17
+
18
+ public async down(queryRunner: QueryRunner): Promise<void> {
19
+ await queryRunner.query(
20
+ `ALTER TABLE "ScheduledMaintenance" DROP COLUMN "postUpdatesToSlackChannelId"`,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "Alert" DROP COLUMN "postUpdatesToSlackChannelId"`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "Incident" DROP COLUMN "postUpdatesToSlackChannelId"`,
27
+ );
28
+ }
29
+ }
@@ -0,0 +1,29 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1739374537088 implements MigrationInterface {
4
+ public name = "MigrationName1739374537088";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "Incident" RENAME COLUMN "postUpdatesToSlackChannelId" TO "postUpdatesToWorkspaceChannelName"`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "Alert" RENAME COLUMN "postUpdatesToSlackChannelId" TO "postUpdatesToWorkspaceChannelName"`,
12
+ );
13
+ await queryRunner.query(
14
+ `ALTER TABLE "ScheduledMaintenance" RENAME COLUMN "postUpdatesToSlackChannelId" TO "postUpdatesToWorkspaceChannelName"`,
15
+ );
16
+ }
17
+
18
+ public async down(queryRunner: QueryRunner): Promise<void> {
19
+ await queryRunner.query(
20
+ `ALTER TABLE "ScheduledMaintenance" RENAME COLUMN "postUpdatesToWorkspaceChannelName" TO "postUpdatesToSlackChannelId"`,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "Alert" RENAME COLUMN "postUpdatesToWorkspaceChannelName" TO "postUpdatesToSlackChannelId"`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "Incident" RENAME COLUMN "postUpdatesToWorkspaceChannelName" TO "postUpdatesToSlackChannelId"`,
27
+ );
28
+ }
29
+ }
@@ -102,6 +102,8 @@ import { MigrationName1737997557974 } from "./1737997557974-MigrationName";
102
102
  import { MigrationName1739209832500 } from "./1739209832500-MigrationName";
103
103
  import { MigrationName1739210586538 } from "./1739210586538-MigrationName";
104
104
  import { MigrationName1739217257089 } from "./1739217257089-MigrationName";
105
+ import { MigrationName1739282331053 } from "./1739282331053-MigrationName";
106
+ import { MigrationName1739374537088 } from "./1739374537088-MigrationName";
105
107
 
106
108
  export default [
107
109
  InitialMigration,
@@ -208,4 +210,6 @@ export default [
208
210
  MigrationName1739209832500,
209
211
  MigrationName1739210586538,
210
212
  MigrationName1739217257089,
213
+ MigrationName1739282331053,
214
+ MigrationName1739374537088,
211
215
  ];
@@ -54,6 +54,10 @@ import Label from "../../Models/DatabaseModels/Label";
54
54
  import LabelService from "./LabelService";
55
55
  import IncidentSeverity from "../../Models/DatabaseModels/IncidentSeverity";
56
56
  import IncidentSeverityService from "./IncidentSeverityService";
57
+ import {
58
+ WorkspaceMessageBlock,
59
+ WorkspacePayloadMarkdown,
60
+ } from "../../Types/Workspace/WorkspaceMessagePayload";
57
61
 
58
62
  export class Service extends DatabaseService<Model> {
59
63
  public constructor() {
@@ -1314,5 +1318,102 @@ ${incidentSeverity.name}
1314
1318
  logger.error(err);
1315
1319
  });
1316
1320
  }
1321
+
1322
+ public async getWorkspaceMessageBlocksForIncidentCreate(data: {
1323
+ incidentId: ObjectID;
1324
+ }): Promise<Array<WorkspaceMessageBlock>> {
1325
+ const incident: Model | null = await this.findOneById({
1326
+ id: data.incidentId,
1327
+ select: {
1328
+ projectId: true,
1329
+ incidentNumber: true,
1330
+ title: true,
1331
+ description: true,
1332
+ incidentSeverity: {
1333
+ name: true,
1334
+ },
1335
+ rootCause: true,
1336
+ remediationNotes: true,
1337
+ currentIncidentState: {
1338
+ name: true,
1339
+ },
1340
+ },
1341
+ props: {
1342
+ isRoot: true,
1343
+ },
1344
+ });
1345
+
1346
+ if (!incident) {
1347
+ throw new BadDataException("Incident not found");
1348
+ }
1349
+
1350
+ const blocks: Array<WorkspaceMessageBlock> = [];
1351
+
1352
+ if (incident.incidentNumber) {
1353
+ const markdownBlock1: WorkspacePayloadMarkdown = {
1354
+ _type: "WorkspacePayloadMarkdown",
1355
+ text: `**Incident #${incident.incidentNumber} Created**`,
1356
+ };
1357
+ blocks.push(markdownBlock1);
1358
+ }
1359
+
1360
+ if (incident.title) {
1361
+ const markdownBlock2: WorkspacePayloadMarkdown = {
1362
+ _type: "WorkspacePayloadMarkdown",
1363
+ text: `**Incident Title**:
1364
+ ${incident.title}`,
1365
+ };
1366
+ blocks.push(markdownBlock2);
1367
+ }
1368
+
1369
+ if (incident.description) {
1370
+ const markdownBlock3: WorkspacePayloadMarkdown = {
1371
+ _type: "WorkspacePayloadMarkdown",
1372
+ text: `**Description**:
1373
+ ${incident.description}`,
1374
+ };
1375
+ blocks.push(markdownBlock3);
1376
+ }
1377
+
1378
+ if (incident.incidentSeverity?.name) {
1379
+ const markdownBlock4: WorkspacePayloadMarkdown = {
1380
+ _type: "WorkspacePayloadMarkdown",
1381
+ text: `**Severity**:
1382
+ ${incident.incidentSeverity.name}`,
1383
+ };
1384
+ blocks.push(markdownBlock4);
1385
+ }
1386
+
1387
+ if (incident.rootCause) {
1388
+ const markdownBlock5: WorkspacePayloadMarkdown = {
1389
+ _type: "WorkspacePayloadMarkdown",
1390
+ text: `**Root Cause**:
1391
+ ${incident.rootCause}`,
1392
+ };
1393
+ blocks.push(markdownBlock5);
1394
+ }
1395
+
1396
+ if (incident.remediationNotes) {
1397
+ const markdownBlock6: WorkspacePayloadMarkdown = {
1398
+ _type: "WorkspacePayloadMarkdown",
1399
+ text: `**Remediation Notes**:
1400
+ ${incident.remediationNotes}`,
1401
+ };
1402
+ blocks.push(markdownBlock6);
1403
+ }
1404
+
1405
+ if (incident.currentIncidentState?.name) {
1406
+ const markdownBlock7: WorkspacePayloadMarkdown = {
1407
+ _type: "WorkspacePayloadMarkdown",
1408
+ text: `**Incident State**:
1409
+ ${incident.currentIncidentState.name}`,
1410
+ };
1411
+ blocks.push(markdownBlock7);
1412
+ }
1413
+
1414
+ // TODO: Add buttons to Post Private Note, Ack Incident, Resolve Incident. etc.
1415
+
1416
+ return blocks as Array<WorkspaceMessageBlock>;
1417
+ }
1317
1418
  }
1318
1419
  export default new Service();
@@ -52,6 +52,7 @@ import NotificationSettingEventType from "../../Types/NotificationSetting/Notifi
52
52
  import Query from "../Types/Database/Query";
53
53
  import DeleteBy from "../Types/Database/DeleteBy";
54
54
  import StatusPageResourceService from "./StatusPageResourceService";
55
+ import Label from "../../Models/DatabaseModels/Label";
55
56
 
56
57
  export class Service extends DatabaseService<Model> {
57
58
  public constructor() {
@@ -643,6 +644,48 @@ export class Service extends DatabaseService<Model> {
643
644
  }
644
645
  }
645
646
 
647
+ public async getLabelsForMonitors(data: {
648
+ monitorIds: Array<ObjectID>;
649
+ }): Promise<Array<Label>> {
650
+ if (data.monitorIds.length === 0) {
651
+ return [];
652
+ }
653
+
654
+ const monitors: Array<Model> = await this.findBy({
655
+ query: {
656
+ _id: QueryHelper.any(data.monitorIds),
657
+ },
658
+ select: {
659
+ _id: true,
660
+ name: true,
661
+ labels: true,
662
+ },
663
+ props: {
664
+ isRoot: true,
665
+ },
666
+ skip: 0,
667
+ limit: LIMIT_PER_PROJECT,
668
+ });
669
+
670
+ const labels: Array<Label> = [];
671
+
672
+ for (const monitor of monitors) {
673
+ if (monitor.labels) {
674
+ for (const label of monitor.labels) {
675
+ const isLabelAlreadyAdded: boolean = labels.some((l: Label) => {
676
+ return l.id!.toString() === label.id!.toString();
677
+ });
678
+
679
+ if (!isLabelAlreadyAdded) {
680
+ labels.push(label);
681
+ }
682
+ }
683
+ }
684
+ }
685
+
686
+ return labels;
687
+ }
688
+
646
689
  public async notifyOwnersWhenNoProbeIsEnabled(data: {
647
690
  monitorId: ObjectID;
648
691
  isNoProbesEnabled: boolean;
@@ -465,7 +465,7 @@ export class ProjectService extends DatabaseService<Model> {
465
465
  `;
466
466
  }
467
467
 
468
- SlackUtil.sendMessageToChannel({
468
+ SlackUtil.sendMessageToChannelViaIncomingWebhook({
469
469
  url: URL.fromString(NotificationSlackWebhookOnSubscriptionUpdate),
470
470
  text: slackMessage,
471
471
  }).catch((error: Exception) => {
@@ -668,7 +668,7 @@ export class ProjectService extends DatabaseService<Model> {
668
668
  `;
669
669
  }
670
670
 
671
- SlackUtil.sendMessageToChannel({
671
+ SlackUtil.sendMessageToChannelViaIncomingWebhook({
672
672
  url: URL.fromString(NotificationSlackWebhookOnCreateProject),
673
673
  text: slackMessage,
674
674
  }).catch((error: Exception) => {
@@ -1178,7 +1178,7 @@ export class ProjectService extends DatabaseService<Model> {
1178
1178
  `;
1179
1179
  }
1180
1180
 
1181
- SlackUtil.sendMessageToChannel({
1181
+ SlackUtil.sendMessageToChannelViaIncomingWebhook({
1182
1182
  url: URL.fromString(NotificationSlackWebhookOnDeleteProject),
1183
1183
  text: slackMessage,
1184
1184
  }).catch((err: Error) => {
@@ -90,6 +90,7 @@ export class TeamMemberService extends DatabaseService<TeamMember> {
90
90
  isNewUser = true;
91
91
  user = await UserService.createByEmail({
92
92
  email,
93
+ name: undefined, // name is not required for now.
93
94
  props: {
94
95
  isRoot: true,
95
96
  },
@@ -32,6 +32,7 @@ import SlackUtil from "../Utils/Slack/Slack";
32
32
  import UserTwoFactorAuth from "Common/Models/DatabaseModels/UserTwoFactorAuth";
33
33
  import UserTwoFactorAuthService from "./UserTwoFactorAuthService";
34
34
  import BadDataException from "../../Types/Exception/BadDataException";
35
+ import Name from "../../Types/Name";
35
36
 
36
37
  export class Service extends DatabaseService<Model> {
37
38
  public constructor() {
@@ -43,7 +44,7 @@ export class Service extends DatabaseService<Model> {
43
44
  createdItem: Model,
44
45
  ): Promise<Model> {
45
46
  if (NotificationSlackWebhookOnCreateUser) {
46
- SlackUtil.sendMessageToChannel({
47
+ SlackUtil.sendMessageToChannelViaIncomingWebhook({
47
48
  url: URL.fromString(NotificationSlackWebhookOnCreateUser),
48
49
  text: `*New OneUptime User:*
49
50
  *Email:* ${createdItem.email?.toString() || "N/A"}
@@ -292,6 +293,7 @@ export class Service extends DatabaseService<Model> {
292
293
 
293
294
  public async createByEmail(data: {
294
295
  email: Email;
296
+ name: Name | undefined;
295
297
  isEmailVerified?: boolean;
296
298
  generateRandomPassword?: boolean;
297
299
  props: DatabaseCommonInteractionProps;
@@ -300,6 +302,9 @@ export class Service extends DatabaseService<Model> {
300
302
 
301
303
  const user: Model = new Model();
302
304
  user.email = email;
305
+ if (data.name) {
306
+ user.name = data.name;
307
+ }
303
308
  user.isEmailVerified = data.isEmailVerified || false;
304
309
 
305
310
  if (data.generateRandomPassword) {