Skip to content

Commit c010fed

Browse files
committed
added more triggers, tested
1 parent 6632a5e commit c010fed

File tree

13 files changed

+609
-13
lines changed

13 files changed

+609
-13
lines changed

apps/sim/blocks/blocks/calcom.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@ Return ONLY valid JSON - no explanations.`,
469469
...getTrigger('calcom_booking_created').subBlocks,
470470
...getTrigger('calcom_booking_cancelled').subBlocks,
471471
...getTrigger('calcom_booking_rescheduled').subBlocks,
472+
...getTrigger('calcom_booking_requested').subBlocks,
473+
...getTrigger('calcom_booking_rejected').subBlocks,
474+
...getTrigger('calcom_booking_paid').subBlocks,
475+
...getTrigger('calcom_meeting_ended').subBlocks,
476+
...getTrigger('calcom_recording_ready').subBlocks,
477+
...getTrigger('calcom_webhook').subBlocks,
472478
],
473479
tools: {
474480
access: [
@@ -656,6 +662,16 @@ Return ONLY valid JSON - no explanations.`,
656662
},
657663
triggers: {
658664
enabled: true,
659-
available: ['calcom_booking_created', 'calcom_booking_cancelled', 'calcom_booking_rescheduled'],
665+
available: [
666+
'calcom_booking_created',
667+
'calcom_booking_cancelled',
668+
'calcom_booking_rescheduled',
669+
'calcom_booking_requested',
670+
'calcom_booking_rejected',
671+
'calcom_booking_paid',
672+
'calcom_meeting_ended',
673+
'calcom_recording_ready',
674+
'calcom_webhook',
675+
],
660676
},
661677
}

apps/sim/lib/auth/auth.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2547,7 +2547,6 @@ export const auth = betterAuth({
25472547
{
25482548
providerId: 'calcom',
25492549
clientId: env.CALCOM_CLIENT_ID as string,
2550-
clientSecret: env.CALCOM_CLIENT_SECRET as string,
25512550
authorizationUrl: 'https://app.cal.com/auth/oauth2/authorize',
25522551
tokenUrl: 'https://app.cal.com/api/auth/oauth/token',
25532552
scopes: [],

apps/sim/lib/core/config/env.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ export const env = createEnv({
244244
SPOTIFY_CLIENT_ID: z.string().optional(), // Spotify OAuth client ID
245245
SPOTIFY_CLIENT_SECRET: z.string().optional(), // Spotify OAuth client secret
246246
CALCOM_CLIENT_ID: z.string().optional(), // Cal.com OAuth client ID
247-
CALCOM_CLIENT_SECRET: z.string().optional(), // Cal.com OAuth client secret
248247

249248
// E2B Remote Code Execution
250249
E2B_ENABLED: z.string().optional(), // Enable E2B remote code execution

apps/sim/lib/oauth/oauth.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,14 +878,14 @@ function getProviderAuthConfig(provider: string): ProviderAuthConfig {
878878
}
879879
}
880880
case 'calcom': {
881-
const { clientId, clientSecret } = getCredentials(
882-
env.CALCOM_CLIENT_ID,
883-
env.CALCOM_CLIENT_SECRET
884-
)
881+
const clientId = env.CALCOM_CLIENT_ID
882+
if (!clientId) {
883+
throw new Error('Missing CALCOM_CLIENT_ID')
884+
}
885885
return {
886886
tokenEndpoint: 'https://app.cal.com/api/auth/oauth/refreshToken',
887887
clientId,
888-
clientSecret,
888+
clientSecret: '',
889889
useBasicAuth: false,
890890
supportsRefreshTokenRotation: true,
891891
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { CalComIcon } from '@/components/icons'
2+
import { buildTriggerSubBlocks } from '@/triggers'
3+
import {
4+
buildPaidOutputs,
5+
calcomSetupInstructions,
6+
calcomTriggerOptions,
7+
calcomWebhookSecretField,
8+
} from '@/triggers/calcom/utils'
9+
import type { TriggerConfig } from '@/triggers/types'
10+
11+
export const calcomBookingPaidTrigger: TriggerConfig = {
12+
id: 'calcom_booking_paid',
13+
name: 'CalCom Booking Paid',
14+
provider: 'calcom',
15+
description: 'Trigger workflow when payment is completed for a paid booking',
16+
version: '1.0.0',
17+
icon: CalComIcon,
18+
19+
subBlocks: buildTriggerSubBlocks({
20+
triggerId: 'calcom_booking_paid',
21+
triggerOptions: calcomTriggerOptions,
22+
setupInstructions: calcomSetupInstructions('paid'),
23+
extraFields: [calcomWebhookSecretField('calcom_booking_paid')],
24+
}),
25+
26+
outputs: buildPaidOutputs(),
27+
28+
webhook: {
29+
method: 'POST',
30+
headers: {
31+
'Content-Type': 'application/json',
32+
'X-Cal-Signature-256': 'sha256=...',
33+
},
34+
},
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { CalComIcon } from '@/components/icons'
2+
import { buildTriggerSubBlocks } from '@/triggers'
3+
import {
4+
buildRejectedOutputs,
5+
calcomSetupInstructions,
6+
calcomTriggerOptions,
7+
calcomWebhookSecretField,
8+
} from '@/triggers/calcom/utils'
9+
import type { TriggerConfig } from '@/triggers/types'
10+
11+
export const calcomBookingRejectedTrigger: TriggerConfig = {
12+
id: 'calcom_booking_rejected',
13+
name: 'CalCom Booking Rejected',
14+
provider: 'calcom',
15+
description: 'Trigger workflow when a booking request is rejected by the host',
16+
version: '1.0.0',
17+
icon: CalComIcon,
18+
19+
subBlocks: buildTriggerSubBlocks({
20+
triggerId: 'calcom_booking_rejected',
21+
triggerOptions: calcomTriggerOptions,
22+
setupInstructions: calcomSetupInstructions('rejected'),
23+
extraFields: [calcomWebhookSecretField('calcom_booking_rejected')],
24+
}),
25+
26+
outputs: buildRejectedOutputs(),
27+
28+
webhook: {
29+
method: 'POST',
30+
headers: {
31+
'Content-Type': 'application/json',
32+
'X-Cal-Signature-256': 'sha256=...',
33+
},
34+
},
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { CalComIcon } from '@/components/icons'
2+
import { buildTriggerSubBlocks } from '@/triggers'
3+
import {
4+
buildRequestedOutputs,
5+
calcomSetupInstructions,
6+
calcomTriggerOptions,
7+
calcomWebhookSecretField,
8+
} from '@/triggers/calcom/utils'
9+
import type { TriggerConfig } from '@/triggers/types'
10+
11+
export const calcomBookingRequestedTrigger: TriggerConfig = {
12+
id: 'calcom_booking_requested',
13+
name: 'CalCom Booking Requested',
14+
provider: 'calcom',
15+
description: 'Trigger workflow when a booking request is submitted (pending confirmation)',
16+
version: '1.0.0',
17+
icon: CalComIcon,
18+
19+
subBlocks: buildTriggerSubBlocks({
20+
triggerId: 'calcom_booking_requested',
21+
triggerOptions: calcomTriggerOptions,
22+
setupInstructions: calcomSetupInstructions('requested'),
23+
extraFields: [calcomWebhookSecretField('calcom_booking_requested')],
24+
}),
25+
26+
outputs: buildRequestedOutputs(),
27+
28+
webhook: {
29+
method: 'POST',
30+
headers: {
31+
'Content-Type': 'application/json',
32+
'X-Cal-Signature-256': 'sha256=...',
33+
},
34+
},
35+
}

apps/sim/triggers/calcom/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
export { calcomBookingCancelledTrigger } from './booking_cancelled'
22
export { calcomBookingCreatedTrigger } from './booking_created'
3+
export { calcomBookingPaidTrigger } from './booking_paid'
4+
export { calcomBookingRejectedTrigger } from './booking_rejected'
5+
export { calcomBookingRequestedTrigger } from './booking_requested'
36
export { calcomBookingRescheduledTrigger } from './booking_rescheduled'
7+
export { calcomMeetingEndedTrigger } from './meeting_ended'
8+
export { calcomRecordingReadyTrigger } from './recording_ready'
9+
export { calcomWebhookTrigger } from './webhook'
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { CalComIcon } from '@/components/icons'
2+
import { buildTriggerSubBlocks } from '@/triggers'
3+
import {
4+
buildMeetingEndedOutputs,
5+
calcomSetupInstructions,
6+
calcomTriggerOptions,
7+
calcomWebhookSecretField,
8+
} from '@/triggers/calcom/utils'
9+
import type { TriggerConfig } from '@/triggers/types'
10+
11+
export const calcomMeetingEndedTrigger: TriggerConfig = {
12+
id: 'calcom_meeting_ended',
13+
name: 'CalCom Meeting Ended',
14+
provider: 'calcom',
15+
description: 'Trigger workflow when a Cal.com meeting ends',
16+
version: '1.0.0',
17+
icon: CalComIcon,
18+
19+
subBlocks: buildTriggerSubBlocks({
20+
triggerId: 'calcom_meeting_ended',
21+
triggerOptions: calcomTriggerOptions,
22+
setupInstructions: calcomSetupInstructions('meeting_ended'),
23+
extraFields: [calcomWebhookSecretField('calcom_meeting_ended')],
24+
}),
25+
26+
outputs: buildMeetingEndedOutputs(),
27+
28+
webhook: {
29+
method: 'POST',
30+
headers: {
31+
'Content-Type': 'application/json',
32+
'X-Cal-Signature-256': 'sha256=...',
33+
},
34+
},
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { CalComIcon } from '@/components/icons'
2+
import { buildTriggerSubBlocks } from '@/triggers'
3+
import {
4+
buildRecordingReadyOutputs,
5+
calcomSetupInstructions,
6+
calcomTriggerOptions,
7+
calcomWebhookSecretField,
8+
} from '@/triggers/calcom/utils'
9+
import type { TriggerConfig } from '@/triggers/types'
10+
11+
export const calcomRecordingReadyTrigger: TriggerConfig = {
12+
id: 'calcom_recording_ready',
13+
name: 'CalCom Recording Ready',
14+
provider: 'calcom',
15+
description: 'Trigger workflow when a meeting recording is ready for download',
16+
version: '1.0.0',
17+
icon: CalComIcon,
18+
19+
subBlocks: buildTriggerSubBlocks({
20+
triggerId: 'calcom_recording_ready',
21+
triggerOptions: calcomTriggerOptions,
22+
setupInstructions: calcomSetupInstructions('recording_ready'),
23+
extraFields: [calcomWebhookSecretField('calcom_recording_ready')],
24+
}),
25+
26+
outputs: buildRecordingReadyOutputs(),
27+
28+
webhook: {
29+
method: 'POST',
30+
headers: {
31+
'Content-Type': 'application/json',
32+
'X-Cal-Signature-256': 'sha256=...',
33+
},
34+
},
35+
}

0 commit comments

Comments
 (0)