-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathwebhook.ts
More file actions
93 lines (89 loc) · 2.88 KB
/
webhook.ts
File metadata and controls
93 lines (89 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import { CalendlyIcon } from '@/components/icons'
import type { TriggerConfig } from '@/triggers/types'
export const calendlyWebhookTrigger: TriggerConfig = {
id: 'calendly_webhook',
name: 'Calendly Webhook',
provider: 'calendly',
description: 'Trigger workflow from any Calendly webhook event',
version: '1.0.0',
icon: CalendlyIcon,
subBlocks: [
{
id: 'apiKey',
title: 'Personal Access Token',
type: 'short-input',
placeholder: 'Enter your Calendly personal access token',
password: true,
required: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'calendly_webhook',
},
},
{
id: 'organization',
title: 'Organization URI',
type: 'short-input',
placeholder: 'https://api.calendly.com/organizations/XXXXXX',
description:
'Organization URI for the webhook subscription. Get this from "Get Current User" operation.',
required: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'calendly_webhook',
},
},
{
id: 'triggerInstructions',
title: 'Setup Instructions',
hideFromPreview: true,
type: 'text',
defaultValue: [
'<strong>Note:</strong> This trigger requires a paid Calendly subscription (Professional, Teams, or Enterprise plan).',
'Get your Personal Access Token from <strong>Settings > Integrations > API & Webhooks</strong> in your Calendly account.',
'Use the "Get Current User" operation in a Calendly block to retrieve your Organization URI.',
'The webhook will be automatically created in Calendly when you deploy the workflow.',
'This webhook subscribes to all Calendly events (invitee created, invitee canceled, and routing form submitted). Use the <code>event</code> field in the payload to determine the event type.',
]
.map(
(instruction, index) =>
`<div class="mb-3"><strong>${index + 1}.</strong> ${instruction}</div>`
)
.join(''),
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'calendly_webhook',
},
},
],
outputs: {
event: {
type: 'string',
description:
'Event type (invitee.created, invitee.canceled, or routing_form_submission.created)',
},
created_at: {
type: 'string',
description: 'Webhook event creation timestamp',
},
created_by: {
type: 'string',
description: 'URI of the Calendly user who created this webhook',
},
payload: {
type: 'object',
description: 'Complete event payload (structure varies by event type)',
},
},
webhook: {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Calendly-Webhook-Signature': 'v1,signature...',
'User-Agent': 'Calendly-Webhook',
},
},
}