Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions apps/api/src/handlers/custom-automations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import type {
CustomAutomationScheduleMode,
OptionalAutomationTarget,
} from '@roomote/types';
import { toActivationAutomationDestinationProvider } from '@roomote/telemetry';
import { captureActivationCustomAutomationChanged } from '@roomote/telemetry/server';

import type { Variables } from '../../types';
import type { McpAuth } from '../mcp/middleware';
Expand Down Expand Up @@ -329,6 +331,10 @@ customAutomationsRouter.post('/', async (c) => {
target: buildTarget(parsed.data),
createdByUserId: adminId(c),
});
void captureActivationCustomAutomationChanged(
'created',
parsed.data.targetProvider ?? null,
);
return c.json({ automation, resolution: schedule.resolution }, 201);
} catch (error) {
const known = knownErrorResponse(c, error);
Expand Down Expand Up @@ -415,6 +421,10 @@ customAutomationsRouter.delete('/:id', async (c) => {
if (!existing)
return c.json({ error: 'Custom automation was not found.' }, 404);
await deleteCustomAutomation(existing.id);
void captureActivationCustomAutomationChanged(
'deleted',
toActivationAutomationDestinationProvider(existing.target.provider),
);
return c.json({ deleted: { id: existing.id, name: existing.name } });
});

Expand Down
13 changes: 13 additions & 0 deletions apps/api/src/handlers/slack/events/member-joined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
SlackMemberJoinedChannelEvent,
SlackNotifier,
} from '@roomote/slack';
import { captureActivationAutomationChanged } from '@roomote/telemetry/server';

import { SLACK_WELCOME_MESSAGE_CHANNEL_LIMIT } from '../constants.js';

Expand Down Expand Up @@ -234,4 +235,16 @@ export async function maybePostSlackChannelWelcome(params: {

throw error;
}

if (shouldEnableStarterAutomations) {
for (const [automation, wasEnabled] of [
['suggester', settings.suggesterFrequency !== 'off'],
['announcer', settings.announcerFrequency !== 'off'],
['manager_stats', settings.managerStatsFrequency !== 'off'],
] as const) {
if (!wasEnabled) {
void captureActivationAutomationChanged('enabled', automation);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions apps/web/src/trpc/commands/automations/custom-automations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
type CustomAutomationScheduleMode,
type OptionalAutomationTarget,
} from '@roomote/types';
import { captureActivationCustomAutomationChanged } from '@roomote/telemetry/server';
import { toActivationAutomationDestinationProvider } from '@roomote/telemetry';

import type { UserAuthSuccess } from '@/types';

Expand Down Expand Up @@ -191,6 +193,11 @@ export async function createCustomAutomationCommand(
createdByUserId: auth.userId,
});

void captureActivationCustomAutomationChanged(
'created',
input.targetProvider ?? null,
);

return toListItem(created);
}

Expand Down Expand Up @@ -237,6 +244,10 @@ export async function deleteCustomAutomationCommand(
}

await deleteCustomAutomation(input.id);
void captureActivationCustomAutomationChanged(
'deleted',
toActivationAutomationDestinationProvider(existing.target.provider),
);
return { success: true };
}

Expand Down
Loading
Loading