@friggframework/core 2.0.0--canary.690.08cd07e.0 → 2.0.0--canary.693.d8859c2.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.
- package/CLAUDE.md +0 -28
- package/README.md +0 -105
- package/application/commands/integration-commands.js +10 -20
- package/application/commands/scheduler-commands.js +7 -11
- package/application/commands/user-commands.js +5 -17
- package/application/index.js +2 -6
- package/core/Worker.js +7 -31
- package/core/create-handler.js +0 -9
- package/credential/repositories/credential-repository-documentdb.js +0 -34
- package/credential/repositories/credential-repository-interface.js +0 -15
- package/credential/repositories/credential-repository-mongo.js +0 -23
- package/credential/repositories/credential-repository-postgres.js +0 -28
- package/database/config.js +24 -48
- package/database/documentdb-utils.js +0 -2
- package/database/encryption/encryption-schema-registry.js +12 -93
- package/database/prisma.js +2 -4
- package/errors/index.js +4 -0
- package/errors/mapping-already-exists-error.js +14 -0
- package/generated/prisma-mongodb/edge.js +38 -33
- package/generated/prisma-mongodb/index-browser.js +35 -30
- package/generated/prisma-mongodb/index.d.ts +1880 -3191
- package/generated/prisma-mongodb/index.js +38 -33
- package/generated/prisma-mongodb/package.json +1 -1
- package/generated/prisma-mongodb/schema.prisma +50 -86
- package/generated/prisma-mongodb/wasm.js +38 -33
- package/generated/prisma-postgresql/edge.js +38 -33
- package/generated/prisma-postgresql/index-browser.js +35 -30
- package/generated/prisma-postgresql/index.d.ts +2050 -3390
- package/generated/prisma-postgresql/index.js +38 -33
- package/generated/prisma-postgresql/package.json +1 -1
- package/generated/prisma-postgresql/schema.prisma +48 -81
- package/generated/prisma-postgresql/wasm.js +38 -33
- package/handlers/WEBHOOKS.md +29 -0
- package/handlers/app-definition-loader.js +19 -128
- package/handlers/app-handler-helpers.js +3 -25
- package/handlers/backend-utils.js +25 -31
- package/handlers/middleware/admin-auth.js +1 -14
- package/handlers/routers/auth.js +10 -46
- package/handlers/routers/health.js +4 -13
- package/handlers/routers/integration-defined-routers.js +92 -144
- package/handlers/routers/integration-webhook-routers.js +64 -102
- package/handlers/workers/integration-defined-workers.js +2 -5
- package/index.js +3 -65
- package/infrastructure/scheduler/index.js +6 -19
- package/infrastructure/scheduler/scheduler-service-factory.js +7 -55
- package/integrations/data-defined/README.md +169 -0
- package/integrations/data-defined/canonical.js +11 -0
- package/integrations/data-defined/capabilities/acmeerp.capabilities.json +608 -0
- package/integrations/data-defined/capabilities/asana.capabilities.json +265 -0
- package/integrations/data-defined/capabilities/calendly.capabilities.json +385 -0
- package/integrations/data-defined/capabilities/docusign.capabilities.json +314 -0
- package/integrations/data-defined/capabilities/fathom.capabilities.json +228 -0
- package/integrations/data-defined/capabilities/github.capabilities.json +563 -0
- package/integrations/data-defined/capabilities/hubspot.capabilities.json +715 -0
- package/integrations/data-defined/capabilities/jira.capabilities.json +376 -0
- package/integrations/data-defined/capabilities/klaviyo.capabilities.json +475 -0
- package/integrations/data-defined/capabilities/linear.capabilities.json +324 -0
- package/integrations/data-defined/capabilities/netsuite.capabilities.json +491 -0
- package/integrations/data-defined/capabilities/notion.capabilities.json +208 -0
- package/integrations/data-defined/capabilities/phone.capabilities.json +470 -0
- package/integrations/data-defined/capabilities/pipedrive.capabilities.json +388 -0
- package/integrations/data-defined/capabilities/quickbooks.capabilities.json +615 -0
- package/integrations/data-defined/capabilities/salesforce.capabilities.json +507 -0
- package/integrations/data-defined/capabilities/shopify.capabilities.json +1082 -0
- package/integrations/data-defined/capabilities/slack.capabilities.json +363 -0
- package/integrations/data-defined/capabilities/stripe.capabilities.json +580 -0
- package/integrations/data-defined/capabilities/webflow.capabilities.json +196 -0
- package/integrations/data-defined/capabilities/zendesk.capabilities.json +409 -0
- package/integrations/data-defined/compile.js +77 -0
- package/integrations/data-defined/config-form.js +110 -0
- package/integrations/data-defined/data-defined-integration.js +366 -0
- package/integrations/data-defined/examples/acme-erp-quickbooks.definition.json +467 -0
- package/integrations/data-defined/examples/asana-slack.definition.json +220 -0
- package/integrations/data-defined/examples/calendly-salesforce.definition.json +459 -0
- package/integrations/data-defined/examples/docusign-salesforce.definition.json +305 -0
- package/integrations/data-defined/examples/fathom-hubspot-notion.definition.json +575 -0
- package/integrations/data-defined/examples/github-linear.definition.json +316 -0
- package/integrations/data-defined/examples/hubspot-slack.definition.json +409 -0
- package/integrations/data-defined/examples/klaviyo-hubspot.definition.json +339 -0
- package/integrations/data-defined/examples/phone-hubspot.definition.json +637 -0
- package/integrations/data-defined/examples/pipedrive-hubspot.definition.json +136 -0
- package/integrations/data-defined/examples/pipedrive-phone.definition.json +340 -0
- package/integrations/data-defined/examples/records/phone-hubspot.definition-version.json +652 -0
- package/integrations/data-defined/examples/records/phone-hubspot.integration.json +86 -0
- package/integrations/data-defined/examples/records/phone-hubspot.mappings.json +39 -0
- package/integrations/data-defined/examples/records/phone-hubspot.workflow-run.json +62 -0
- package/integrations/data-defined/examples/shopify-klaviyo.definition.json +488 -0
- package/integrations/data-defined/examples/shopify-netsuite.definition.json +622 -0
- package/integrations/data-defined/examples/stripe-quickbooks.definition.json +476 -0
- package/integrations/data-defined/examples/webflow-hubspot-slack.definition.json +262 -0
- package/integrations/data-defined/examples/zendesk-jira.definition.json +604 -0
- package/integrations/data-defined/expressions.js +225 -0
- package/integrations/data-defined/index.js +39 -0
- package/integrations/data-defined/interpreter.js +89 -0
- package/integrations/data-defined/manifests.js +125 -0
- package/integrations/data-defined/repositories/definition-version-repository.js +67 -0
- package/integrations/data-defined/repositories/workflow-run-repository.js +59 -0
- package/integrations/data-defined/router.js +97 -0
- package/integrations/data-defined/runtime.js +208 -0
- package/integrations/data-defined/schema/capability-manifest.v0.1.schema.json +377 -0
- package/integrations/data-defined/schema/installation.v0.1.schema.json +83 -0
- package/integrations/data-defined/schema/integration-definition.v0.1.schema.json +848 -0
- package/integrations/data-defined/schema/records.md +98 -0
- package/integrations/data-defined/schema-check.js +58 -0
- package/integrations/data-defined/scripts/validate.js +66 -0
- package/integrations/data-defined/steps.js +89 -0
- package/integrations/data-defined/transforms.js +91 -0
- package/integrations/data-defined/use-cases/definition-use-cases.js +187 -0
- package/integrations/data-defined/validate.js +370 -0
- package/integrations/data-defined/versioning.js +161 -0
- package/integrations/data-defined/webhooks.js +119 -0
- package/integrations/index.js +0 -1
- package/integrations/integration-base.js +29 -0
- package/integrations/integration-router.js +101 -131
- package/integrations/repositories/integration-mapping-repository-documentdb.js +50 -0
- package/integrations/repositories/integration-mapping-repository-interface.js +15 -0
- package/integrations/repositories/integration-mapping-repository-mongo.js +29 -0
- package/integrations/repositories/integration-mapping-repository-postgres.js +30 -0
- package/integrations/repositories/integration-mapping-repository.js +29 -0
- package/integrations/repositories/integration-repository-documentdb.js +3 -35
- package/integrations/repositories/integration-repository-interface.js +1 -17
- package/integrations/repositories/integration-repository-mongo.js +77 -60
- package/integrations/repositories/integration-repository-postgres.js +76 -62
- package/integrations/repositories/process-repository-mongo.js +1 -1
- package/integrations/tests/doubles/test-integration-repository.js +1 -12
- package/integrations/use-cases/create-integration.js +20 -55
- package/integrations/use-cases/get-integrations-for-user.js +40 -80
- package/integrations/use-cases/index.js +1 -7
- package/integrations/utils/map-integration-dto.js +14 -43
- package/modules/index.js +0 -14
- package/modules/module-factory.js +0 -12
- package/modules/module.js +2 -53
- package/modules/repositories/module-repository-documentdb.js +6 -51
- package/modules/repositories/module-repository-interface.js +2 -19
- package/modules/repositories/module-repository-mongo.js +74 -67
- package/modules/repositories/module-repository-postgres.js +74 -66
- package/modules/repositories/module-repository.js +1 -2
- package/modules/requester/requester.js +5 -35
- package/modules/use-cases/get-entities-for-user.js +13 -26
- package/modules/use-cases/get-entity-options-by-id.js +4 -10
- package/modules/use-cases/get-entity-options-by-type.js +1 -1
- package/modules/use-cases/get-module-instance-from-type.js +1 -1
- package/modules/use-cases/get-module.js +4 -10
- package/modules/use-cases/process-authorization-callback.js +19 -53
- package/modules/use-cases/refresh-entity-options.js +4 -10
- package/modules/use-cases/test-module-auth.js +4 -10
- package/package.json +6 -6
- package/prisma-mongodb/schema.prisma +50 -86
- package/prisma-postgresql/migrations/20261018000000_add_data_defined_integrations/migration.sql +66 -0
- package/prisma-postgresql/schema.prisma +48 -81
- package/queues/index.js +0 -25
- package/types/index.d.ts +0 -2
- package/user/repositories/user-repository-documentdb.js +2 -27
- package/user/repositories/user-repository-interface.js +0 -18
- package/user/repositories/user-repository-mongo.js +0 -24
- package/user/repositories/user-repository-postgres.js +0 -18
- package/user/use-cases/authenticate-user.js +1 -7
- package/user/use-cases/get-user-from-adopter-jwt.js +124 -95
- package/user/use-cases/get-user-from-x-frigg-headers.js +80 -83
- package/user/user.js +1 -64
- package/credential/use-cases/credential-operations-for-user.js +0 -202
- package/credential/use-cases/reauthorize-credential-for-user.js +0 -73
- package/database/organization-where.js +0 -18
- package/database/unique-violation.js +0 -25
- package/extensions/bootstrap-runner.js +0 -43
- package/extensions/extension-loader.js +0 -187
- package/extensions/index.js +0 -41
- package/extensions/initialize-app.js +0 -123
- package/extensions/route-mounter.js +0 -103
- package/extensions/schema-composer.js +0 -188
- package/infrastructure/scheduler/netlify-scheduler-adapter.js +0 -216
- package/infrastructure/scheduler/scheduled-job-repository.js +0 -118
- package/integrations/repositories/integration-not-found.js +0 -14
- package/integrations/schedule-config.js +0 -80
- package/integrations/use-cases/dispatch-ongoing-syncs.js +0 -100
- package/integrations/use-cases/integration-operations-for-user.js +0 -256
- package/integrations/use-cases/resolve-integration-ownership.js +0 -177
- package/management-api/create-management-api-router.js +0 -49
- package/management-api/error-response.js +0 -116
- package/management-api/management-api-config.js +0 -151
- package/management-api/meta-router.js +0 -76
- package/management-api/openapi/build-openapi.js +0 -144
- package/management-api/openapi/components.js +0 -415
- package/management-api/openapi/v1-operations.js +0 -83
- package/management-api/openapi/v2-operations.js +0 -264
- package/management-api/route-registry.js +0 -411
- package/management-api/test-support/http-client.js +0 -39
- package/management-api/use-cases/get-management-api-meta.js +0 -57
- package/management-api/v1-deprecation.js +0 -120
- package/management-api/v2/create-v2-router.js +0 -85
- package/management-api/v2/dependencies.js +0 -281
- package/management-api/v2/dto.js +0 -143
- package/management-api/v2/handlers/authorization.js +0 -94
- package/management-api/v2/handlers/credentials.js +0 -33
- package/management-api/v2/handlers/entities.js +0 -77
- package/management-api/v2/handlers/integrations.js +0 -128
- package/management-api/v2/handlers/proxy.js +0 -34
- package/management-api/v2/request.js +0 -85
- package/management-api/v2/test-support/fake-dependencies.js +0 -103
- package/modules/domain/authorization-session.js +0 -144
- package/modules/entity-scope.js +0 -15
- package/modules/entity-type-registry.js +0 -311
- package/modules/proxy/proxy-bases.js +0 -169
- package/modules/proxy/proxy-errors.js +0 -31
- package/modules/proxy/proxy-path.js +0 -183
- package/modules/proxy/proxy-policy.js +0 -277
- package/modules/repositories/authorization-session-repository-documentdb.js +0 -112
- package/modules/repositories/authorization-session-repository-factory.js +0 -31
- package/modules/repositories/authorization-session-repository-interface.js +0 -47
- package/modules/repositories/authorization-session-repository-prisma.js +0 -87
- package/modules/repositories/entity-not-found.js +0 -18
- package/modules/requester/proxy-request.js +0 -245
- package/modules/scope-config.js +0 -192
- package/modules/scope-policy.js +0 -112
- package/modules/scope-resolution.js +0 -288
- package/modules/scope-visibility.js +0 -247
- package/modules/tests/doubles/in-memory-authorization-session-repository.js +0 -45
- package/modules/tests/doubles/ownership-matching.js +0 -18
- package/modules/use-cases/authorize-entity-for-user.js +0 -61
- package/modules/use-cases/create-entity-from-credential.js +0 -113
- package/modules/use-cases/entity-operations-for-user.js +0 -162
- package/modules/use-cases/entity-types.js +0 -139
- package/modules/use-cases/execute-entity-proxy-request.js +0 -331
- package/modules/use-cases/get-authorization-requirements.js +0 -100
- package/modules/use-cases/get-entity-module-for-user.js +0 -113
- package/modules/use-cases/manage-access.js +0 -21
- package/modules/use-cases/multi-step-authorization.js +0 -329
- package/prisma-postgresql/migrations/20261003000000_add_authorization_session/migration.sql +0 -28
- package/prisma-postgresql/migrations/20261015000000_add_organization_membership/migration.sql +0 -26
- package/prisma-postgresql/migrations/20261016000000_add_entity_integration_organization/migration.sql +0 -25
- package/prisma-postgresql/migrations/20261017000000_add_scheduled_job/migration.sql +0 -28
- package/providers/index.js +0 -23
- package/providers/resolve-provider.js +0 -93
- package/providers/runtime-detection.js +0 -124
- package/queues/providers/index.js +0 -11
- package/queues/providers/netlify-background-provider.js +0 -150
- package/queues/providers/qstash-queue-provider.js +0 -219
- package/queues/providers/sqs-queue-provider.js +0 -70
- package/queues/queue-client-interface.js +0 -55
- package/queues/queue-message-auth.js +0 -193
- package/queues/queue-provider-factory.js +0 -101
- package/queues/queue-provider.js +0 -65
- package/queues/sqs-queue-client.js +0 -81
- package/types/modules/index.d.ts +0 -214
- package/types/user/index.d.ts +0 -134
- package/user/adopter-jwt-config.js +0 -177
- package/user/adopter-jwt-errors.js +0 -59
- package/user/adopter-token-verifier.js +0 -122
- package/user/app-user-helpers.js +0 -97
- package/user/create-user-authentication.js +0 -64
- package/user/membership.js +0 -51
- package/user/repositories/organization-membership-record.js +0 -19
- package/user/repositories/organization-membership-repository-documentdb.js +0 -106
- package/user/repositories/organization-membership-repository-factory.js +0 -42
- package/user/repositories/organization-membership-repository-interface.js +0 -57
- package/user/repositories/organization-membership-repository-mongo.js +0 -13
- package/user/repositories/organization-membership-repository-postgres.js +0 -29
- package/user/repositories/organization-membership-repository-prisma.js +0 -81
- package/user/tests/doubles/adopter-jwt-fixtures.js +0 -220
- package/user/use-cases/ensure-organization-membership.js +0 -92
- package/user/use-cases/find-individual-users-by-organization.js +0 -54
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "Frigg Integration row (existing model). Only `config` is new in shape; everything else is what Frigg stores today.",
|
|
3
|
+
"id": "int_7f3a9c",
|
|
4
|
+
"userId": "usr_acme_admin",
|
|
5
|
+
"status": "ENABLED",
|
|
6
|
+
"version": "1.4.0",
|
|
7
|
+
"entities": [
|
|
8
|
+
{
|
|
9
|
+
"id": "ent_phone_51",
|
|
10
|
+
"moduleName": "phone",
|
|
11
|
+
"externalId": "ws_9a1"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "ent_hs_88",
|
|
15
|
+
"moduleName": "hubspot",
|
|
16
|
+
"externalId": "12345678"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"config": {
|
|
20
|
+
"definition": {
|
|
21
|
+
"id": "phone-hubspot",
|
|
22
|
+
"version": "1.4.0",
|
|
23
|
+
"checksum": "sha256:386c69e18a51a7cf061634309eca3e8267c1a59629a388498eddaad9eb44be59"
|
|
24
|
+
},
|
|
25
|
+
"settings": {
|
|
26
|
+
"fromNumber": "+15125550100"
|
|
27
|
+
},
|
|
28
|
+
"syncs": {
|
|
29
|
+
"contacts": {
|
|
30
|
+
"enabled": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"workflows": {
|
|
34
|
+
"log-call": {
|
|
35
|
+
"enabled": true
|
|
36
|
+
},
|
|
37
|
+
"call-summary": {
|
|
38
|
+
"enabled": true
|
|
39
|
+
},
|
|
40
|
+
"missed-call-task": {
|
|
41
|
+
"enabled": true,
|
|
42
|
+
"settings": {
|
|
43
|
+
"owner": "81273645",
|
|
44
|
+
"dueIn": "2h"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"texts-timeline": {
|
|
48
|
+
"enabled": true
|
|
49
|
+
},
|
|
50
|
+
"won-thank-you": {
|
|
51
|
+
"enabled": false
|
|
52
|
+
},
|
|
53
|
+
"stale-contacts": {
|
|
54
|
+
"enabled": false
|
|
55
|
+
},
|
|
56
|
+
"text-from-card": {
|
|
57
|
+
"enabled": true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"ui": {
|
|
61
|
+
"phone-card": {
|
|
62
|
+
"enabled": true
|
|
63
|
+
},
|
|
64
|
+
"deals-panel": {
|
|
65
|
+
"enabled": true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"runtime": {
|
|
69
|
+
"installed": {
|
|
70
|
+
"hook": {
|
|
71
|
+
"id": "WHk2c9",
|
|
72
|
+
"url": "https://api.example.com/api/data-defined-integration/webhooks/int_7f3a9c?module=phone",
|
|
73
|
+
"events": [
|
|
74
|
+
"call.completed",
|
|
75
|
+
"call.ringing",
|
|
76
|
+
"call.summary.completed",
|
|
77
|
+
"message.received",
|
|
78
|
+
"contact.updated"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"createdAt": "2026-09-02T15:20:00Z",
|
|
85
|
+
"updatedAt": "2026-10-18T09:12:44Z"
|
|
86
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "IntegrationMapping rows (existing table). link:* = the same record on both sides; idx:* = identity index (normalised email/phone); evt:* = an event already handled (insert-only, so a redelivery is a no-op).",
|
|
3
|
+
"rows": [
|
|
4
|
+
{
|
|
5
|
+
"integrationId": "int_7f3a9c",
|
|
6
|
+
"sourceId": "idx:contacts:phone:+15125550142",
|
|
7
|
+
"mapping": {
|
|
8
|
+
"hubspot": "51",
|
|
9
|
+
"phone": "CT7",
|
|
10
|
+
"linkedAt": "2026-09-02T15:31:10Z"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"integrationId": "int_7f3a9c",
|
|
15
|
+
"sourceId": "link:contacts:hubspot:51",
|
|
16
|
+
"mapping": {
|
|
17
|
+
"hubspot": "51",
|
|
18
|
+
"phone": "CT7",
|
|
19
|
+
"linkedAt": "2026-09-02T15:31:10Z"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"integrationId": "int_7f3a9c",
|
|
24
|
+
"sourceId": "link:contacts:phone:CT7",
|
|
25
|
+
"mapping": {
|
|
26
|
+
"hubspot": "51",
|
|
27
|
+
"phone": "CT7",
|
|
28
|
+
"linkedAt": "2026-09-02T15:31:10Z"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"integrationId": "int_7f3a9c",
|
|
33
|
+
"sourceId": "evt:phone-hubspot:log-call:EVc0a1",
|
|
34
|
+
"mapping": {
|
|
35
|
+
"at": "2026-10-18T16:08:10.523Z"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "WorkflowRun row written by the runtime for one delivered Phone call.completed event. `outbound` is the captured HubSpot call (shown here for documentation; production stores a digest).",
|
|
3
|
+
"id": "run_01JB8A0K",
|
|
4
|
+
"integrationId": "int_7f3a9c",
|
|
5
|
+
"definition": {
|
|
6
|
+
"id": "phone-hubspot",
|
|
7
|
+
"version": "1.4.0"
|
|
8
|
+
},
|
|
9
|
+
"workflowId": "log-call",
|
|
10
|
+
"trigger": {
|
|
11
|
+
"type": "webhook",
|
|
12
|
+
"eventId": "EVc0a1"
|
|
13
|
+
},
|
|
14
|
+
"startedAt": "2026-10-18T14:07:13.037Z",
|
|
15
|
+
"status": "completed",
|
|
16
|
+
"endedAt": "2026-10-18T14:07:13.074Z",
|
|
17
|
+
"trace": [
|
|
18
|
+
{
|
|
19
|
+
"id": "contact",
|
|
20
|
+
"use": "links.find",
|
|
21
|
+
"at": "steps[0]",
|
|
22
|
+
"status": "ok",
|
|
23
|
+
"ms": 0
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "stop#1",
|
|
27
|
+
"use": "stop",
|
|
28
|
+
"at": "steps[1]",
|
|
29
|
+
"status": "skipped"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "body",
|
|
33
|
+
"use": "template",
|
|
34
|
+
"at": "steps[2]",
|
|
35
|
+
"status": "ok",
|
|
36
|
+
"ms": 2
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "engagement",
|
|
40
|
+
"use": "hubspot.call.create",
|
|
41
|
+
"at": "steps[3]",
|
|
42
|
+
"status": "ok",
|
|
43
|
+
"ms": 0
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"outbound": [
|
|
47
|
+
{
|
|
48
|
+
"module": "hubspot",
|
|
49
|
+
"method": "createCallEngagement",
|
|
50
|
+
"args": {
|
|
51
|
+
"contactId": "51",
|
|
52
|
+
"properties": {
|
|
53
|
+
"hs_call_title": "Phone call (incoming)",
|
|
54
|
+
"hs_call_body": "Phone call with +15125550142 · 312s (completed)",
|
|
55
|
+
"hs_call_duration": 312,
|
|
56
|
+
"hs_call_direction": "INCOMING",
|
|
57
|
+
"hs_timestamp": "2026-10-18T14:07:12Z"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://friggframework.org/schemas/integration-definition/v0.1.json",
|
|
3
|
+
"schemaVersion": "0.1",
|
|
4
|
+
"id": "shopify-klaviyo",
|
|
5
|
+
"version": "1.5.0",
|
|
6
|
+
"display": {
|
|
7
|
+
"label": "Shopify \u2192 Klaviyo",
|
|
8
|
+
"description": "Customers become Klaviyo profiles, and orders, ordered products, abandoned checkouts and fulfillments become Klaviyo events for flows. The Shopify customer page shows the customer's Klaviyo lists.",
|
|
9
|
+
"category": "Marketing",
|
|
10
|
+
"tags": [
|
|
11
|
+
"ecommerce",
|
|
12
|
+
"email",
|
|
13
|
+
"events"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"modules": {
|
|
17
|
+
"shopify": {
|
|
18
|
+
"module": "shopify",
|
|
19
|
+
"version": "^3.1"
|
|
20
|
+
},
|
|
21
|
+
"klaviyo": {
|
|
22
|
+
"module": "klaviyo",
|
|
23
|
+
"version": "^1.1"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"syncs": [
|
|
27
|
+
{
|
|
28
|
+
"id": "customers",
|
|
29
|
+
"label": "Customers",
|
|
30
|
+
"source": "shopify.customer",
|
|
31
|
+
"target": "klaviyo.profile",
|
|
32
|
+
"direction": "one_way",
|
|
33
|
+
"identity": {
|
|
34
|
+
"match": [
|
|
35
|
+
{
|
|
36
|
+
"source": "email",
|
|
37
|
+
"target": "attributes.email",
|
|
38
|
+
"transform": "lowercase",
|
|
39
|
+
"key": "email"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"mapping": [
|
|
44
|
+
{
|
|
45
|
+
"source": "email",
|
|
46
|
+
"target": "attributes.email",
|
|
47
|
+
"transform": "lowercase"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"source": "first_name",
|
|
51
|
+
"target": "attributes.first_name"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"source": "last_name",
|
|
55
|
+
"target": "attributes.last_name"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"source": "phone",
|
|
59
|
+
"target": "attributes.phone_number",
|
|
60
|
+
"transform": "to_e164_phone"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"source": "default_address.company",
|
|
64
|
+
"target": "attributes.organization"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"source": "default_address.city",
|
|
68
|
+
"target": "attributes.location.city"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"source": "default_address.province_code",
|
|
72
|
+
"target": "attributes.location.region"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"source": "default_address.country_code",
|
|
76
|
+
"target": "attributes.location.country"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"source": "default_address.zip",
|
|
80
|
+
"target": "attributes.location.zip"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"source": "total_spent",
|
|
84
|
+
"target": "attributes.properties.lifetime_value",
|
|
85
|
+
"transform": "number"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"source": "tags",
|
|
89
|
+
"target": "attributes.properties.shopify_tags"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"source": "id",
|
|
93
|
+
"target": "attributes.external_id"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"filter": "$.record.email exists",
|
|
97
|
+
"backfill": {
|
|
98
|
+
"trigger": "onInstall",
|
|
99
|
+
"pageSize": 250
|
|
100
|
+
},
|
|
101
|
+
"ongoing": {
|
|
102
|
+
"mode": "webhook"
|
|
103
|
+
},
|
|
104
|
+
"default": "on"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"workflows": [
|
|
108
|
+
{
|
|
109
|
+
"id": "placed-order",
|
|
110
|
+
"label": "Placed Order and Ordered Product events",
|
|
111
|
+
"description": "One \"Placed Order\" event per order and one \"Ordered Product\" per line item, the shape Klaviyo's ecommerce flows expect.",
|
|
112
|
+
"purpose": "write",
|
|
113
|
+
"default": "on",
|
|
114
|
+
"trigger": {
|
|
115
|
+
"type": "webhook",
|
|
116
|
+
"module": "shopify",
|
|
117
|
+
"topic": "order.created",
|
|
118
|
+
"filter": "$.record.email exists"
|
|
119
|
+
},
|
|
120
|
+
"steps": [
|
|
121
|
+
{
|
|
122
|
+
"use": "klaviyo.event.create",
|
|
123
|
+
"with": {
|
|
124
|
+
"metric": "Placed Order",
|
|
125
|
+
"profile": {
|
|
126
|
+
"email": "$.record.email",
|
|
127
|
+
"external_id": "{{record.customer.id}}"
|
|
128
|
+
},
|
|
129
|
+
"properties": {
|
|
130
|
+
"OrderId": "$.record.id",
|
|
131
|
+
"OrderNumber": "$.record.name",
|
|
132
|
+
"Items": "$.record.line_items",
|
|
133
|
+
"DiscountCodes": "$.record.discount_codes",
|
|
134
|
+
"SourceName": "$.record.source_name",
|
|
135
|
+
"ShippingCity": "$.record.shipping_address.city"
|
|
136
|
+
},
|
|
137
|
+
"value": "{{record.total_price | number}}",
|
|
138
|
+
"time": "$.record.created_at",
|
|
139
|
+
"uniqueId": "order-{{record.id}}"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"id": "products",
|
|
144
|
+
"use": "foreach",
|
|
145
|
+
"with": {
|
|
146
|
+
"over": "$.record.line_items",
|
|
147
|
+
"max": 100
|
|
148
|
+
},
|
|
149
|
+
"do": [
|
|
150
|
+
{
|
|
151
|
+
"id": "price",
|
|
152
|
+
"use": "map",
|
|
153
|
+
"with": {
|
|
154
|
+
"record": "$.item",
|
|
155
|
+
"mapping": [
|
|
156
|
+
{
|
|
157
|
+
"source": "price",
|
|
158
|
+
"target": "value",
|
|
159
|
+
"transform": "number"
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"use": "klaviyo.event.create",
|
|
166
|
+
"with": {
|
|
167
|
+
"metric": "Ordered Product",
|
|
168
|
+
"profile": {
|
|
169
|
+
"email": "$.record.email",
|
|
170
|
+
"external_id": "{{record.customer.id}}"
|
|
171
|
+
},
|
|
172
|
+
"properties": {
|
|
173
|
+
"OrderId": "$.record.id",
|
|
174
|
+
"ProductID": "$.item.product_id",
|
|
175
|
+
"SKU": "$.item.sku",
|
|
176
|
+
"ProductName": "$.item.title",
|
|
177
|
+
"VariantName": "$.item.variant_title",
|
|
178
|
+
"Quantity": "$.item.quantity"
|
|
179
|
+
},
|
|
180
|
+
"value": "$.steps.price.value",
|
|
181
|
+
"time": "$.record.created_at",
|
|
182
|
+
"uniqueId": "order-{{record.id}}-line-{{item.id}}"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"id": "abandoned-checkout",
|
|
191
|
+
"label": "Started Checkout events for abandoned checkouts",
|
|
192
|
+
"purpose": "write",
|
|
193
|
+
"default": "on",
|
|
194
|
+
"trigger": {
|
|
195
|
+
"type": "webhook",
|
|
196
|
+
"module": "shopify",
|
|
197
|
+
"topic": "checkout.abandoned",
|
|
198
|
+
"filter": "$.record.email exists && !($.record.completed_at exists)"
|
|
199
|
+
},
|
|
200
|
+
"steps": [
|
|
201
|
+
{
|
|
202
|
+
"use": "klaviyo.event.create",
|
|
203
|
+
"with": {
|
|
204
|
+
"metric": "Started Checkout",
|
|
205
|
+
"profile": {
|
|
206
|
+
"email": "$.record.email",
|
|
207
|
+
"external_id": "{{record.customer.id}}"
|
|
208
|
+
},
|
|
209
|
+
"properties": {
|
|
210
|
+
"CheckoutURL": "$.record.abandoned_checkout_url",
|
|
211
|
+
"Items": "$.record.line_items",
|
|
212
|
+
"Currency": "$.record.currency"
|
|
213
|
+
},
|
|
214
|
+
"value": "{{record.total_price | number}}",
|
|
215
|
+
"time": "$.record.created_at",
|
|
216
|
+
"uniqueId": "checkout-{{record.token}}"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"id": "fulfilled-order",
|
|
223
|
+
"label": "Fulfilled Order events",
|
|
224
|
+
"purpose": "write",
|
|
225
|
+
"default": "on",
|
|
226
|
+
"trigger": {
|
|
227
|
+
"type": "webhook",
|
|
228
|
+
"module": "shopify",
|
|
229
|
+
"topic": "fulfillment.created"
|
|
230
|
+
},
|
|
231
|
+
"steps": [
|
|
232
|
+
{
|
|
233
|
+
"id": "order",
|
|
234
|
+
"use": "shopify.order.get",
|
|
235
|
+
"with": {
|
|
236
|
+
"id": "$.record.order_id",
|
|
237
|
+
"fields": "id,name,email,customer,total_price"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"use": "stop",
|
|
242
|
+
"when": "!($.steps.order.email exists)",
|
|
243
|
+
"with": {
|
|
244
|
+
"reason": "Order has no email"
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"use": "klaviyo.event.create",
|
|
249
|
+
"with": {
|
|
250
|
+
"metric": "Fulfilled Order",
|
|
251
|
+
"profile": {
|
|
252
|
+
"email": "$.steps.order.email",
|
|
253
|
+
"external_id": "{{steps.order.customer.id}}"
|
|
254
|
+
},
|
|
255
|
+
"properties": {
|
|
256
|
+
"OrderId": "$.steps.order.id",
|
|
257
|
+
"OrderNumber": "$.steps.order.name",
|
|
258
|
+
"TrackingCompany": "$.record.tracking_company",
|
|
259
|
+
"TrackingNumber": "$.record.tracking_number",
|
|
260
|
+
"TrackingUrl": "$.record.tracking_url"
|
|
261
|
+
},
|
|
262
|
+
"time": "$.record.created_at",
|
|
263
|
+
"uniqueId": "fulfillment-{{record.id}}"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"id": "add-to-list",
|
|
270
|
+
"label": "Subscribe the customer to a Klaviyo list",
|
|
271
|
+
"purpose": "respond",
|
|
272
|
+
"default": "on",
|
|
273
|
+
"settings": {
|
|
274
|
+
"list": {
|
|
275
|
+
"type": "option",
|
|
276
|
+
"options": "klaviyo.list",
|
|
277
|
+
"label": "List the button subscribes to",
|
|
278
|
+
"required": true
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"trigger": {
|
|
282
|
+
"type": "userAction",
|
|
283
|
+
"label": "Subscribe to list",
|
|
284
|
+
"from": "klaviyo-block"
|
|
285
|
+
},
|
|
286
|
+
"steps": [
|
|
287
|
+
{
|
|
288
|
+
"use": "stop",
|
|
289
|
+
"when": "!($.record.email exists)",
|
|
290
|
+
"with": {
|
|
291
|
+
"reason": "Customer has no email"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"use": "klaviyo.profile.subscribe",
|
|
296
|
+
"with": {
|
|
297
|
+
"listId": "$.settings.list",
|
|
298
|
+
"email": "$.record.email",
|
|
299
|
+
"channels": [
|
|
300
|
+
"email"
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
"queries": [
|
|
308
|
+
{
|
|
309
|
+
"id": "klaviyo-profile",
|
|
310
|
+
"description": "The Klaviyo profile for this Shopify customer and the lists it is on.",
|
|
311
|
+
"steps": [
|
|
312
|
+
{
|
|
313
|
+
"use": "stop",
|
|
314
|
+
"when": "!($.record.email exists)",
|
|
315
|
+
"with": {
|
|
316
|
+
"reason": "Customer has no email"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"id": "profiles",
|
|
321
|
+
"use": "klaviyo.profile.search",
|
|
322
|
+
"with": {
|
|
323
|
+
"email": "$.record.email"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"use": "stop",
|
|
328
|
+
"when": "$.steps.profiles[0] == null",
|
|
329
|
+
"with": {
|
|
330
|
+
"reason": "No Klaviyo profile"
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"id": "lists",
|
|
335
|
+
"use": "klaviyo.profile.lists",
|
|
336
|
+
"with": {
|
|
337
|
+
"id": "$.steps.profiles[0].id"
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
"returns": {
|
|
342
|
+
"profile": "$.steps.profiles[0]",
|
|
343
|
+
"lists": "$.steps.lists"
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
],
|
|
347
|
+
"ui": [
|
|
348
|
+
{
|
|
349
|
+
"id": "klaviyo-block",
|
|
350
|
+
"label": "Klaviyo",
|
|
351
|
+
"host": "shopify",
|
|
352
|
+
"placement": "admin.customer-details.block",
|
|
353
|
+
"objects": [
|
|
354
|
+
"customer"
|
|
355
|
+
],
|
|
356
|
+
"data": {
|
|
357
|
+
"query": "klaviyo-profile"
|
|
358
|
+
},
|
|
359
|
+
"view": {
|
|
360
|
+
"component": "Stack",
|
|
361
|
+
"children": [
|
|
362
|
+
{
|
|
363
|
+
"component": "Heading",
|
|
364
|
+
"props": {
|
|
365
|
+
"text": "Klaviyo"
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"component": "Empty",
|
|
370
|
+
"when": "!($.data.profile exists)",
|
|
371
|
+
"props": {
|
|
372
|
+
"text": "No Klaviyo profile for this customer yet."
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"component": "KeyValue",
|
|
377
|
+
"when": "$.data.profile exists",
|
|
378
|
+
"props": {
|
|
379
|
+
"items": [
|
|
380
|
+
{
|
|
381
|
+
"label": "Email consent",
|
|
382
|
+
"value": "{{data.profile.attributes.subscriptions.email.marketing.consent | default: 'NEVER_SUBSCRIBED'}}"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"label": "Lifetime value",
|
|
386
|
+
"value": "{{data.profile.attributes.properties.lifetime_value | default: 0}}"
|
|
387
|
+
}
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"component": "List",
|
|
393
|
+
"props": {
|
|
394
|
+
"items": "$.data.lists",
|
|
395
|
+
"title": "{{item.attributes.name}}",
|
|
396
|
+
"meta": "since {{item.attributes.created | date}}"
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"component": "Button",
|
|
401
|
+
"props": {
|
|
402
|
+
"label": "Subscribe to list",
|
|
403
|
+
"action": {
|
|
404
|
+
"type": "userAction",
|
|
405
|
+
"workflow": "add-to-list"
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"component": "Button",
|
|
411
|
+
"when": "$.data.profile exists",
|
|
412
|
+
"props": {
|
|
413
|
+
"label": "Open in Klaviyo",
|
|
414
|
+
"action": {
|
|
415
|
+
"type": "open_url",
|
|
416
|
+
"url": "https://www.klaviyo.com/profile/{{data.profile.id}}"
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
"lifecycle": {
|
|
425
|
+
"onInstall": [
|
|
426
|
+
{
|
|
427
|
+
"use": "shopify.webhook.create",
|
|
428
|
+
"with": {
|
|
429
|
+
"topic": "orders/create",
|
|
430
|
+
"address": "$.install.webhookUrls.shopify",
|
|
431
|
+
"format": "json"
|
|
432
|
+
},
|
|
433
|
+
"id": "hook-orders-create"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"use": "shopify.webhook.create",
|
|
437
|
+
"with": {
|
|
438
|
+
"topic": "fulfillments/create",
|
|
439
|
+
"address": "$.install.webhookUrls.shopify",
|
|
440
|
+
"format": "json"
|
|
441
|
+
},
|
|
442
|
+
"id": "hook-fulfillments-create"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"use": "shopify.webhook.create",
|
|
446
|
+
"with": {
|
|
447
|
+
"topic": "customers/create",
|
|
448
|
+
"address": "$.install.webhookUrls.shopify",
|
|
449
|
+
"format": "json"
|
|
450
|
+
},
|
|
451
|
+
"id": "hook-customers-create"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
"use": "shopify.webhook.create",
|
|
455
|
+
"with": {
|
|
456
|
+
"topic": "customers/update",
|
|
457
|
+
"address": "$.install.webhookUrls.shopify",
|
|
458
|
+
"format": "json"
|
|
459
|
+
},
|
|
460
|
+
"id": "hook-customers-update"
|
|
461
|
+
}
|
|
462
|
+
],
|
|
463
|
+
"onUninstall": [
|
|
464
|
+
{
|
|
465
|
+
"id": "unhook",
|
|
466
|
+
"use": "foreach",
|
|
467
|
+
"with": {
|
|
468
|
+
"over": [
|
|
469
|
+
"$.install.runtime.installed.hook-orders-create.id",
|
|
470
|
+
"$.install.runtime.installed.hook-fulfillments-create.id",
|
|
471
|
+
"$.install.runtime.installed.hook-customers-create.id",
|
|
472
|
+
"$.install.runtime.installed.hook-customers-update.id"
|
|
473
|
+
],
|
|
474
|
+
"max": 20
|
|
475
|
+
},
|
|
476
|
+
"do": [
|
|
477
|
+
{
|
|
478
|
+
"use": "shopify.webhook.delete",
|
|
479
|
+
"with": {
|
|
480
|
+
"id": "$.item"
|
|
481
|
+
},
|
|
482
|
+
"onError": "continue"
|
|
483
|
+
}
|
|
484
|
+
]
|
|
485
|
+
}
|
|
486
|
+
]
|
|
487
|
+
}
|
|
488
|
+
}
|