@friggframework/core 2.0.0--canary.700.80ec1cc.0 → 2.0.0--canary.702.047d3c4.0

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 (130) hide show
  1. package/database/documentdb-utils.js +1 -6
  2. package/errors/index.js +0 -4
  3. package/generated/prisma-mongodb/edge.js +4 -52
  4. package/generated/prisma-mongodb/index-browser.js +1 -49
  5. package/generated/prisma-mongodb/index.d.ts +60 -3506
  6. package/generated/prisma-mongodb/index.js +4 -52
  7. package/generated/prisma-mongodb/package.json +1 -1
  8. package/generated/prisma-mongodb/schema.prisma +0 -65
  9. package/generated/prisma-mongodb/wasm.js +4 -52
  10. package/generated/prisma-postgresql/edge.js +4 -52
  11. package/generated/prisma-postgresql/index-browser.js +1 -49
  12. package/generated/prisma-postgresql/index.d.ts +94 -3824
  13. package/generated/prisma-postgresql/index.js +4 -52
  14. package/generated/prisma-postgresql/package.json +1 -1
  15. package/generated/prisma-postgresql/schema.prisma +0 -63
  16. package/generated/prisma-postgresql/wasm.js +4 -52
  17. package/handlers/WEBHOOKS.md +0 -29
  18. package/handlers/app-definition-loader.js +9 -2
  19. package/handlers/app-handler-helpers.js +2 -5
  20. package/handlers/integration-event-dispatcher.js +3 -7
  21. package/handlers/routers/integration-webhook-routers.js +38 -26
  22. package/index.js +0 -2
  23. package/integrations/integration-base.js +1 -162
  24. package/integrations/integration-router.js +1 -6
  25. package/integrations/repositories/integration-mapping-repository-documentdb.js +0 -50
  26. package/integrations/repositories/integration-mapping-repository-interface.js +0 -15
  27. package/integrations/repositories/integration-mapping-repository-mongo.js +0 -29
  28. package/integrations/repositories/integration-mapping-repository-postgres.js +0 -30
  29. package/integrations/repositories/integration-mapping-repository.js +0 -29
  30. package/integrations/repositories/integration-repository-documentdb.js +2 -6
  31. package/integrations/repositories/integration-repository-interface.js +0 -3
  32. package/integrations/repositories/integration-repository-mongo.js +5 -20
  33. package/integrations/repositories/integration-repository-postgres.js +1 -5
  34. package/integrations/repositories/process-repository-mongo.js +1 -1
  35. package/integrations/use-cases/create-integration.js +4 -14
  36. package/integrations/use-cases/delete-integration-for-user.js +4 -4
  37. package/integrations/use-cases/get-integration-for-user.js +2 -4
  38. package/integrations/use-cases/get-integration-instance.js +4 -4
  39. package/integrations/use-cases/get-integrations-for-user.js +4 -4
  40. package/integrations/use-cases/get-possible-integrations.js +2 -7
  41. package/integrations/use-cases/update-integration.js +4 -4
  42. package/package.json +6 -6
  43. package/prisma-mongodb/schema.prisma +0 -65
  44. package/prisma-postgresql/schema.prisma +0 -63
  45. package/queues/queuer-util.js +2 -9
  46. package/errors/mapping-already-exists-error.js +0 -14
  47. package/handlers/workers/integration-triggers.js +0 -25
  48. package/infrastructure/scheduler/recurrence.js +0 -204
  49. package/integrations/definitions/README.md +0 -278
  50. package/integrations/definitions/canonical.js +0 -11
  51. package/integrations/definitions/capabilities/AUDIT.md +0 -480
  52. package/integrations/definitions/capabilities/acmeerp.capabilities.json +0 -633
  53. package/integrations/definitions/capabilities/asana.capabilities.json +0 -279
  54. package/integrations/definitions/capabilities/calendly.capabilities.json +0 -385
  55. package/integrations/definitions/capabilities/docusign.capabilities.json +0 -314
  56. package/integrations/definitions/capabilities/fathom.capabilities.json +0 -238
  57. package/integrations/definitions/capabilities/github.capabilities.json +0 -585
  58. package/integrations/definitions/capabilities/hubspot.capabilities.json +0 -822
  59. package/integrations/definitions/capabilities/jira.capabilities.json +0 -391
  60. package/integrations/definitions/capabilities/klaviyo.capabilities.json +0 -503
  61. package/integrations/definitions/capabilities/linear.capabilities.json +0 -378
  62. package/integrations/definitions/capabilities/netsuite.capabilities.json +0 -535
  63. package/integrations/definitions/capabilities/notion.capabilities.json +0 -208
  64. package/integrations/definitions/capabilities/phone.capabilities.json +0 -511
  65. package/integrations/definitions/capabilities/pipedrive.capabilities.json +0 -430
  66. package/integrations/definitions/capabilities/quickbooks.capabilities.json +0 -635
  67. package/integrations/definitions/capabilities/salesforce.capabilities.json +0 -568
  68. package/integrations/definitions/capabilities/shopify.capabilities.json +0 -1128
  69. package/integrations/definitions/capabilities/slack.capabilities.json +0 -373
  70. package/integrations/definitions/capabilities/stripe.capabilities.json +0 -630
  71. package/integrations/definitions/capabilities/webflow.capabilities.json +0 -196
  72. package/integrations/definitions/capabilities/zendesk.capabilities.json +0 -422
  73. package/integrations/definitions/compile.js +0 -80
  74. package/integrations/definitions/config-form.js +0 -137
  75. package/integrations/definitions/examples/acme-erp-quickbooks.definition.json +0 -467
  76. package/integrations/definitions/examples/asana-slack.definition.json +0 -219
  77. package/integrations/definitions/examples/calendly-salesforce.definition.json +0 -459
  78. package/integrations/definitions/examples/docusign-salesforce.definition.json +0 -305
  79. package/integrations/definitions/examples/fathom-hubspot-notion.definition.json +0 -575
  80. package/integrations/definitions/examples/github-linear.definition.json +0 -322
  81. package/integrations/definitions/examples/hubspot-slack.definition.json +0 -427
  82. package/integrations/definitions/examples/klaviyo-hubspot.definition.json +0 -336
  83. package/integrations/definitions/examples/phone-hubspot.definition.json +0 -633
  84. package/integrations/definitions/examples/pipedrive-hubspot.definition.json +0 -136
  85. package/integrations/definitions/examples/pipedrive-phone.definition.json +0 -340
  86. package/integrations/definitions/examples/records/phone-hubspot.definition-version.json +0 -652
  87. package/integrations/definitions/examples/records/phone-hubspot.integration.json +0 -86
  88. package/integrations/definitions/examples/records/phone-hubspot.mappings.json +0 -39
  89. package/integrations/definitions/examples/records/phone-hubspot.workflow-run.json +0 -62
  90. package/integrations/definitions/examples/shopify-klaviyo.definition.json +0 -488
  91. package/integrations/definitions/examples/shopify-netsuite.definition.json +0 -622
  92. package/integrations/definitions/examples/stripe-quickbooks.definition.json +0 -476
  93. package/integrations/definitions/examples/webflow-hubspot-slack.definition.json +0 -262
  94. package/integrations/definitions/examples/zendesk-jira.definition.json +0 -604
  95. package/integrations/definitions/expressions.js +0 -229
  96. package/integrations/definitions/index.js +0 -45
  97. package/integrations/definitions/integration-runtime.js +0 -763
  98. package/integrations/definitions/interpreter.js +0 -104
  99. package/integrations/definitions/manifests.js +0 -177
  100. package/integrations/definitions/renderers/common.js +0 -67
  101. package/integrations/definitions/renderers/html.js +0 -129
  102. package/integrations/definitions/renderers/hubspot.js +0 -59
  103. package/integrations/definitions/renderers/preview.js +0 -154
  104. package/integrations/definitions/renderers/slack.js +0 -146
  105. package/integrations/definitions/repositories/definition-version-repository.js +0 -67
  106. package/integrations/definitions/repositories/workflow-run-repository.js +0 -80
  107. package/integrations/definitions/router.js +0 -170
  108. package/integrations/definitions/runtime.js +0 -268
  109. package/integrations/definitions/schema/capability-manifest.v0.1.schema.json +0 -549
  110. package/integrations/definitions/schema/installation.v0.1.schema.json +0 -130
  111. package/integrations/definitions/schema/integration-definition.v0.1.schema.json +0 -909
  112. package/integrations/definitions/schema/records.md +0 -105
  113. package/integrations/definitions/schema-check.js +0 -58
  114. package/integrations/definitions/scripts/check-manifests.js +0 -220
  115. package/integrations/definitions/scripts/validate.js +0 -66
  116. package/integrations/definitions/steps.js +0 -123
  117. package/integrations/definitions/sync-engine.js +0 -297
  118. package/integrations/definitions/tests/helpers-fake-crm.js +0 -49
  119. package/integrations/definitions/transforms.js +0 -91
  120. package/integrations/definitions/use-cases/definition-use-cases.js +0 -245
  121. package/integrations/definitions/validate.js +0 -436
  122. package/integrations/definitions/versioning.js +0 -176
  123. package/integrations/definitions/webhooks.js +0 -119
  124. package/integrations/integration-types.js +0 -64
  125. package/integrations/triggers.js +0 -244
  126. package/integrations/use-cases/run-trigger-tick.js +0 -155
  127. package/integrations/use-cases/run-trigger.js +0 -77
  128. package/prisma-postgresql/migrations/20261018000000_add_data_defined_integrations/migration.sql +0 -66
  129. package/prisma-postgresql/migrations/20261019000000_workflow_run_waits/migration.sql +0 -7
  130. package/prisma-postgresql/migrations/20261019120000_definition_workspace/migration.sql +0 -5
@@ -1,219 +0,0 @@
1
- {
2
- "$schema": "https://friggframework.org/schemas/integration-definition/v0.1.json",
3
- "schemaVersion": "0.1",
4
- "id": "asana-slack",
5
- "version": "0.2.0",
6
- "display": {
7
- "label": "Asana \u2192 Slack nudges",
8
- "description": "Each afternoon, everyone gets a DM listing their Asana tasks due tomorrow; completed tasks in a project are announced in its channel.",
9
- "category": "Notifications",
10
- "tags": [
11
- "tasks",
12
- "slack",
13
- "project-management"
14
- ]
15
- },
16
- "modules": {
17
- "asana": {
18
- "module": "asana",
19
- "version": "^1.5"
20
- },
21
- "slack": {
22
- "module": "slack",
23
- "version": "^2.0"
24
- }
25
- },
26
- "settings": {
27
- "workspace": {
28
- "type": "option",
29
- "options": "asana.workspace",
30
- "label": "Asana workspace",
31
- "required": true
32
- },
33
- "project": {
34
- "type": "option",
35
- "options": {
36
- "source": "asana.project",
37
- "with": {
38
- "workspace": "$.settings.workspace"
39
- }
40
- },
41
- "label": "Project to announce completed tasks from",
42
- "required": true
43
- }
44
- },
45
- "workflows": [
46
- {
47
- "id": "due-tomorrow-digest",
48
- "label": "DM each assignee their tasks due tomorrow",
49
- "purpose": "notify",
50
- "default": "on",
51
- "settings": {
52
- "unassignedChannel": {
53
- "type": "option",
54
- "options": "slack.channel",
55
- "label": "Post unassigned tasks to"
56
- }
57
- },
58
- "trigger": {
59
- "type": "schedule",
60
- "cron": "0 16 * * 1-5",
61
- "timezone": "America/New_York"
62
- },
63
- "steps": [
64
- {
65
- "id": "tasks",
66
- "use": "asana.task.search",
67
- "with": {
68
- "workspaceGid": "$.install.workspace",
69
- "due_on": "+1d",
70
- "completed": false,
71
- "limit": 100
72
- }
73
- },
74
- {
75
- "use": "stop",
76
- "when": "$.steps.tasks[0] == null",
77
- "with": {
78
- "reason": "Nothing due tomorrow"
79
- }
80
- },
81
- {
82
- "id": "groups",
83
- "use": "code",
84
- "with": {
85
- "ref": "@acme/asana-steps#groupByAssignee@1.0.0",
86
- "with": {
87
- "tasks": "$.steps.tasks"
88
- }
89
- }
90
- },
91
- {
92
- "id": "dms",
93
- "use": "foreach",
94
- "with": {
95
- "over": "$.steps.groups.assigned",
96
- "max": 100
97
- },
98
- "do": [
99
- {
100
- "id": "slackUser",
101
- "use": "slack.user.lookupByEmail",
102
- "with": {
103
- "email": "$.item.email"
104
- },
105
- "onError": "continue"
106
- },
107
- {
108
- "id": "text",
109
- "use": "template",
110
- "with": {
111
- "id": "assignee-digest"
112
- }
113
- },
114
- {
115
- "use": "slack.message.post",
116
- "when": "$.steps.slackUser.id exists",
117
- "with": {
118
- "channel": "$.steps.slackUser.id",
119
- "text": "$.steps.text",
120
- "unfurl_links": false
121
- }
122
- }
123
- ]
124
- },
125
- {
126
- "id": "unassigned",
127
- "use": "template",
128
- "with": {
129
- "id": "unassigned-digest"
130
- }
131
- },
132
- {
133
- "use": "slack.message.post",
134
- "when": "$.settings.unassignedChannel exists && $.steps.groups.unassigned[0] exists",
135
- "with": {
136
- "channel": "$.settings.unassignedChannel",
137
- "text": "$.steps.unassigned"
138
- }
139
- }
140
- ]
141
- },
142
- {
143
- "id": "completed-in-project",
144
- "label": "Announce completed tasks",
145
- "purpose": "notify",
146
- "default": "on",
147
- "settings": {
148
- "channel": {
149
- "type": "option",
150
- "options": "slack.channel",
151
- "label": "Announce in",
152
- "required": true
153
- }
154
- },
155
- "trigger": {
156
- "type": "webhook",
157
- "module": "asana",
158
- "topic": "task.changed",
159
- "filter": "$.event.events[0].change.field == 'completed' && $.event.events[0].change.new_value == true"
160
- },
161
- "steps": [
162
- {
163
- "id": "task",
164
- "use": "asana.task.get",
165
- "with": {
166
- "taskGid": "$.record.gid"
167
- }
168
- },
169
- {
170
- "use": "stop",
171
- "when": "$.steps.task.completed != true",
172
- "with": {
173
- "reason": "Reopened before we got to it"
174
- }
175
- },
176
- {
177
- "use": "slack.message.post",
178
- "with": {
179
- "channel": "$.settings.channel",
180
- "text": ":white_check_mark: {{steps.task.completed_by.name | default: 'Someone' | mrkdwn}} completed <{{steps.task.permalink_url}}|{{steps.task.name | mrkdwn}}>"
181
- }
182
- }
183
- ]
184
- }
185
- ],
186
- "templates": {
187
- "assignee-digest": ":spiral_calendar_pad: Hi {{item.firstName | default: item.name | mrkdwn}}, you have {{item.count}} Asana task(s) due tomorrow:\n{{item.lines}}",
188
- "unassigned-digest": ":warning: {{steps.groups.unassignedCount}} task(s) due tomorrow have no assignee:\n{{steps.groups.unassignedLines}}"
189
- },
190
- "lifecycle": {
191
- "onInstall": [
192
- {
193
- "id": "hook",
194
- "use": "asana.webhook.create",
195
- "with": {
196
- "resource": "$.install.project",
197
- "target": "$.install.webhookUrls.asana",
198
- "filters": [
199
- {
200
- "resource_type": "task",
201
- "action": "changed",
202
- "fields": [
203
- "completed"
204
- ]
205
- }
206
- ]
207
- }
208
- }
209
- ],
210
- "onUninstall": [
211
- {
212
- "use": "asana.webhook.delete",
213
- "with": {
214
- "webhookGid": "$.install.runtime.installed.hook.gid"
215
- }
216
- }
217
- ]
218
- }
219
- }
@@ -1,459 +0,0 @@
1
- {
2
- "$schema": "https://friggframework.org/schemas/integration-definition/v0.1.json",
3
- "schemaVersion": "0.1",
4
- "id": "calendly-salesforce",
5
- "version": "2.0.0",
6
- "display": {
7
- "label": "Calendly \u2192 Salesforce",
8
- "description": "Booked meetings land in Salesforce as Events on the right Lead or Contact (creating a Lead when the invitee is new), cancellations update the Event, and the record page shows upcoming meetings.",
9
- "category": "Scheduling",
10
- "tags": [
11
- "meetings",
12
- "crm",
13
- "lead-capture"
14
- ]
15
- },
16
- "modules": {
17
- "calendly": {
18
- "module": "calendly",
19
- "version": "^1.0"
20
- },
21
- "salesforce": {
22
- "module": "salesforce",
23
- "version": "^3.0"
24
- }
25
- },
26
- "settings": {
27
- "leadOwner": {
28
- "type": "option",
29
- "options": "salesforce.user",
30
- "label": "Owner of new Leads and Events",
31
- "required": true
32
- },
33
- "leadSource": {
34
- "type": "string",
35
- "label": "Lead Source for new Leads",
36
- "default": "Calendly"
37
- }
38
- },
39
- "links": [
40
- {
41
- "id": "people",
42
- "label": "Invitees and Leads",
43
- "description": "Which Salesforce Lead or Contact each invitee booked as. Written by the booking workflow.",
44
- "between": [
45
- "calendly.invitee",
46
- "salesforce.lead"
47
- ],
48
- "identity": {
49
- "match": [
50
- {
51
- "key": "email",
52
- "transform": "lowercase"
53
- }
54
- ]
55
- }
56
- },
57
- {
58
- "id": "meetings",
59
- "label": "Meetings and Events",
60
- "description": "Each Calendly meeting is one Salesforce Event.",
61
- "between": [
62
- "calendly.scheduledEvent",
63
- "salesforce.event"
64
- ],
65
- "identity": {
66
- "match": [
67
- {
68
- "key": "eventUri"
69
- }
70
- ]
71
- }
72
- }
73
- ],
74
- "workflows": [
75
- {
76
- "id": "booking-to-event",
77
- "label": "Log bookings as Events on the Lead or Contact",
78
- "purpose": "write",
79
- "default": "on",
80
- "trigger": {
81
- "type": "webhook",
82
- "module": "calendly",
83
- "topic": "invitee.created"
84
- },
85
- "steps": [
86
- {
87
- "id": "link",
88
- "use": "links.find",
89
- "with": {
90
- "key": {
91
- "email": "$.record.email"
92
- },
93
- "link": "people"
94
- }
95
- },
96
- {
97
- "id": "found",
98
- "use": "salesforce.person.searchByEmail",
99
- "when": "$.steps.link == null",
100
- "with": {
101
- "email": "$.record.email"
102
- }
103
- },
104
- {
105
- "id": "who",
106
- "use": "branch",
107
- "cases": [
108
- {
109
- "when": "$.steps.link != null",
110
- "do": [
111
- {
112
- "use": "set",
113
- "with": {
114
- "whoId": "$.steps.link.salesforce"
115
- }
116
- }
117
- ]
118
- },
119
- {
120
- "when": "$.steps.found.contacts[0] exists",
121
- "do": [
122
- {
123
- "use": "set",
124
- "with": {
125
- "whoId": "$.steps.found.contacts[0].Id"
126
- }
127
- }
128
- ]
129
- },
130
- {
131
- "when": "$.steps.found.leads[0] exists",
132
- "do": [
133
- {
134
- "use": "set",
135
- "with": {
136
- "whoId": "$.steps.found.leads[0].Id"
137
- }
138
- },
139
- {
140
- "use": "links.upsert",
141
- "with": {
142
- "ids": {
143
- "calendly": "$.record.uri",
144
- "salesforce": "$.steps.found.leads[0].Id"
145
- },
146
- "keys": {
147
- "email": "$.record.email"
148
- },
149
- "link": "people"
150
- }
151
- }
152
- ]
153
- }
154
- ],
155
- "else": [
156
- {
157
- "id": "leadFields",
158
- "use": "map",
159
- "with": {
160
- "record": "$.record",
161
- "mapping": [
162
- {
163
- "source": "name",
164
- "target": "FirstName",
165
- "transform": "split_full_name",
166
- "options": {
167
- "part": "first"
168
- }
169
- },
170
- {
171
- "source": "name",
172
- "target": "LastName",
173
- "transform": "split_full_name",
174
- "options": {
175
- "part": "last"
176
- }
177
- },
178
- {
179
- "source": "first_name",
180
- "target": "FirstName"
181
- },
182
- {
183
- "source": "last_name",
184
- "target": "LastName"
185
- },
186
- {
187
- "source": "email",
188
- "target": "Email",
189
- "transform": "lowercase"
190
- },
191
- {
192
- "source": "text_reminder_number",
193
- "target": "Phone",
194
- "transform": "to_e164_phone"
195
- },
196
- {
197
- "source": "tracking.utm_source",
198
- "target": "LeadSource"
199
- }
200
- ]
201
- }
202
- },
203
- {
204
- "id": "leadNote",
205
- "use": "template",
206
- "with": {
207
- "id": "lead-description"
208
- }
209
- },
210
- {
211
- "id": "lead",
212
- "use": "salesforce.lead.create",
213
- "with": {
214
- "fields": {
215
- "FirstName": "$.steps.leadFields.FirstName",
216
- "LastName": "{{steps.leadFields.LastName | default: '(unknown)'}}",
217
- "Email": "$.steps.leadFields.Email",
218
- "Phone": "$.steps.leadFields.Phone",
219
- "Company": "{{record.questions_and_answers[0].answer | default: '[not provided]'}}",
220
- "LeadSource": "{{steps.leadFields.LeadSource | default: settings.leadSource}}",
221
- "OwnerId": "$.install.leadOwner",
222
- "Description": "$.steps.leadNote"
223
- }
224
- }
225
- },
226
- {
227
- "use": "links.upsert",
228
- "with": {
229
- "ids": {
230
- "calendly": "$.record.uri",
231
- "salesforce": "$.steps.lead.id"
232
- },
233
- "keys": {
234
- "email": "$.record.email"
235
- },
236
- "link": "people"
237
- }
238
- },
239
- {
240
- "use": "set",
241
- "with": {
242
- "whoId": "$.steps.lead.id"
243
- }
244
- }
245
- ]
246
- },
247
- {
248
- "id": "eventNote",
249
- "use": "template",
250
- "with": {
251
- "id": "event-description"
252
- }
253
- },
254
- {
255
- "id": "event",
256
- "use": "salesforce.event.create",
257
- "with": {
258
- "fields": {
259
- "Subject": "{{record.scheduled_event.name}} with {{record.name}}",
260
- "StartDateTime": "$.record.scheduled_event.start_time",
261
- "EndDateTime": "$.record.scheduled_event.end_time",
262
- "Location": "$.record.scheduled_event.location.join_url",
263
- "Description": "$.steps.eventNote",
264
- "WhoId": "$.vars.whoId",
265
- "OwnerId": "$.install.leadOwner",
266
- "Calendly_Event_URI__c": "$.record.scheduled_event.uri"
267
- }
268
- }
269
- },
270
- {
271
- "use": "links.upsert",
272
- "with": {
273
- "ids": {
274
- "calendly": "$.record.scheduled_event.uri",
275
- "salesforce": "$.steps.event.id"
276
- },
277
- "keys": {
278
- "eventUri": "$.record.scheduled_event.uri"
279
- },
280
- "link": "meetings"
281
- }
282
- }
283
- ]
284
- },
285
- {
286
- "id": "cancellation",
287
- "label": "Mark canceled meetings on the Event",
288
- "purpose": "write",
289
- "default": "on",
290
- "settings": {
291
- "followUpTask": {
292
- "type": "boolean",
293
- "label": "Create a follow-up task to rebook",
294
- "default": false
295
- }
296
- },
297
- "trigger": {
298
- "type": "webhook",
299
- "module": "calendly",
300
- "topic": "invitee.canceled",
301
- "filter": "$.record.rescheduled != true"
302
- },
303
- "steps": [
304
- {
305
- "id": "meeting",
306
- "use": "links.find",
307
- "with": {
308
- "key": {
309
- "eventUri": "$.record.scheduled_event.uri"
310
- },
311
- "link": "meetings"
312
- }
313
- },
314
- {
315
- "use": "stop",
316
- "when": "$.steps.meeting == null",
317
- "with": {
318
- "reason": "Meeting was booked before the integration was installed"
319
- }
320
- },
321
- {
322
- "use": "salesforce.event.update",
323
- "with": {
324
- "id": "$.steps.meeting.salesforce",
325
- "fields": {
326
- "Subject": "Canceled: {{record.scheduled_event.name}} with {{record.name}}",
327
- "ShowAs": "Free",
328
- "Description": "Canceled by {{record.cancellation.canceled_by}}: {{record.cancellation.reason | default: 'no reason given'}}"
329
- }
330
- }
331
- },
332
- {
333
- "id": "person",
334
- "use": "links.find",
335
- "when": "$.settings.followUpTask == true",
336
- "with": {
337
- "key": {
338
- "email": "$.record.email"
339
- },
340
- "link": "people"
341
- }
342
- },
343
- {
344
- "use": "salesforce.task.create",
345
- "when": "$.settings.followUpTask == true && $.steps.person != null",
346
- "with": {
347
- "fields": {
348
- "Subject": "Rebook {{record.name}} ({{record.scheduled_event.name}} canceled)",
349
- "Status": "Not Started",
350
- "Priority": "Normal",
351
- "ActivityDate": "$.record.scheduled_event.start_time",
352
- "WhoId": "$.steps.person.salesforce",
353
- "OwnerId": "$.install.leadOwner"
354
- }
355
- }
356
- }
357
- ]
358
- }
359
- ],
360
- "queries": [
361
- {
362
- "id": "upcoming-meetings",
363
- "description": "Active Calendly meetings booked by this Lead or Contact's email, soonest first.",
364
- "steps": [
365
- {
366
- "use": "stop",
367
- "when": "!($.record.Email exists)",
368
- "with": {
369
- "reason": "Record has no email"
370
- }
371
- },
372
- {
373
- "id": "events",
374
- "use": "calendly.event.list",
375
- "with": {
376
- "organization": "$.install.accounts.calendly.organization",
377
- "invitee_email": "$.record.Email",
378
- "min_start_time": "$.now",
379
- "status": "active",
380
- "count": 5
381
- }
382
- }
383
- ],
384
- "returns": {
385
- "events": "$.steps.events"
386
- }
387
- }
388
- ],
389
- "ui": [
390
- {
391
- "id": "meetings-card",
392
- "label": "Upcoming Calendly meetings",
393
- "host": "salesforce",
394
- "placement": "lightning.record.sidebar",
395
- "objects": [
396
- "lead",
397
- "contact"
398
- ],
399
- "data": {
400
- "query": "upcoming-meetings"
401
- },
402
- "view": {
403
- "component": "Stack",
404
- "children": [
405
- {
406
- "component": "Heading",
407
- "props": {
408
- "text": "Upcoming meetings"
409
- }
410
- },
411
- {
412
- "component": "List",
413
- "props": {
414
- "items": "$.data.events",
415
- "title": "{{item.name}}",
416
- "meta": "{{item.start_time | date}} \u00b7 {{item.location.type}}"
417
- }
418
- },
419
- {
420
- "component": "Empty",
421
- "when": "$.data.events[0] == null",
422
- "props": {
423
- "text": "No upcoming Calendly meetings with this person."
424
- }
425
- }
426
- ]
427
- }
428
- }
429
- ],
430
- "templates": {
431
- "lead-description": "Booked \"{{record.scheduled_event.name}}\" via Calendly on {{record.created_at | date}}.\nTopic: {{record.questions_and_answers[1].answer | default: 'not given'}}\nCampaign: {{record.tracking.utm_campaign | default: 'none'}}",
432
- "event-description": "{{record.questions_and_answers[1].answer | default: 'No agenda given.'}}\n\nJoin: {{record.scheduled_event.location.join_url}}\nReschedule: {{record.reschedule_url}}\nCancel: {{record.cancel_url}}"
433
- },
434
- "lifecycle": {
435
- "onInstall": [
436
- {
437
- "id": "hook",
438
- "use": "calendly.webhook.create",
439
- "with": {
440
- "url": "$.install.webhookUrls.calendly",
441
- "events": [
442
- "invitee.created",
443
- "invitee.canceled"
444
- ],
445
- "organization": "$.install.accounts.calendly.organization",
446
- "scope": "organization"
447
- }
448
- }
449
- ],
450
- "onUninstall": [
451
- {
452
- "use": "calendly.webhook.delete",
453
- "with": {
454
- "uri": "$.install.runtime.installed.hook.resource.uri"
455
- }
456
- }
457
- ]
458
- }
459
- }