@zellifyapp/mcp 0.3.1 → 0.4.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/CHANGELOG.md +14 -0
- package/README.md +16 -15
- package/build/client.d.ts +77 -28
- package/build/client.d.ts.map +1 -1
- package/build/client.js +78 -34
- package/build/client.test.d.ts +2 -0
- package/build/client.test.d.ts.map +1 -0
- package/build/client.test.js +88 -0
- package/build/index.js +63 -45
- package/build/init.d.ts.map +1 -1
- package/build/init.js +3 -2
- package/build/prompts/integration-plan.d.ts +2 -0
- package/build/prompts/integration-plan.d.ts.map +1 -1
- package/build/prompts/integration-plan.js +46 -30
- package/build/tools/get-example-payload.d.ts.map +1 -1
- package/build/tools/get-example-payload.js +24 -7
- package/build/tools/get-funnel-schema.d.ts.map +1 -1
- package/build/tools/get-funnel-schema.js +35 -7
- package/build/tools/get-integrations.d.ts +2 -0
- package/build/tools/get-integrations.d.ts.map +1 -1
- package/build/tools/get-integrations.js +37 -22
- package/build/tools/get-integrations.test.d.ts +2 -0
- package/build/tools/get-integrations.test.d.ts.map +1 -0
- package/build/tools/get-integrations.test.js +29 -0
- package/build/tools/list-funnels.d.ts.map +1 -1
- package/build/tools/list-funnels.js +6 -7
- package/build/tools/validate-setup.d.ts +2 -0
- package/build/tools/validate-setup.d.ts.map +1 -1
- package/build/tools/validate-setup.js +85 -52
- package/build/tools/validate-setup.test.d.ts +2 -0
- package/build/tools/validate-setup.test.d.ts.map +1 -0
- package/build/tools/validate-setup.test.js +57 -0
- package/commands/integrationcheck.md +3 -1
- package/package.json +7 -4
- package/skill/SKILL.md +36 -35
- package/skill/references/debugging.md +28 -20
- package/skill/references/integration-paths.md +47 -25
- package/skill/references/language-guides.md +7 -3
- package/skill/references/revenuecat.md +15 -16
- package/skill/references/types-and-payload.md +336 -70
- package/skill/references/webhook-handler.md +31 -22
- package/build/tools/send-test-webhook.d.ts +0 -3
- package/build/tools/send-test-webhook.d.ts.map +0 -1
- package/build/tools/send-test-webhook.js +0 -78
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
const publishedFunnel = {
|
|
3
|
+
createdAt: "2026-11-20T10:00:00.000Z",
|
|
4
|
+
id: "42",
|
|
5
|
+
name: "Quiz",
|
|
6
|
+
publishedAt: "2026-11-21T10:00:00.000Z",
|
|
7
|
+
updatedAt: "2026-11-21T10:00:00.000Z",
|
|
8
|
+
variant: "code",
|
|
9
|
+
};
|
|
10
|
+
function accessKey(scopes) {
|
|
11
|
+
return Response.json({
|
|
12
|
+
expiresAt: null,
|
|
13
|
+
id: "0123456789abcdef",
|
|
14
|
+
name: "Claude Code",
|
|
15
|
+
organizationId: "org",
|
|
16
|
+
scopes,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
// The tool reads its environment when it loads, so each test loads it anew.
|
|
20
|
+
async function validateSetup(key, ...responses) {
|
|
21
|
+
const fetch = vi.fn();
|
|
22
|
+
for (const response of responses) {
|
|
23
|
+
fetch.mockResolvedValueOnce(response);
|
|
24
|
+
}
|
|
25
|
+
vi.stubGlobal("fetch", fetch);
|
|
26
|
+
vi.resetModules();
|
|
27
|
+
vi.stubEnv("ZELLIFY_API_KEY", key);
|
|
28
|
+
const tool = await import("./validate-setup.js");
|
|
29
|
+
return { fetch, text: await tool.validateSetup() };
|
|
30
|
+
}
|
|
31
|
+
afterEach(() => {
|
|
32
|
+
vi.unstubAllEnvs();
|
|
33
|
+
vi.unstubAllGlobals();
|
|
34
|
+
});
|
|
35
|
+
describe("validate_setup", () => {
|
|
36
|
+
it("passes a key with both permissions and a published funnel", async () => {
|
|
37
|
+
const { text } = await validateSetup("zak_0123456789abcdef_secret", accessKey(["funnels:read", "integrations:read"]), Response.json({ data: [publishedFunnel], next: null }));
|
|
38
|
+
expect(text).toContain('✓ Access key "Claude Code" is valid');
|
|
39
|
+
expect(text).toContain("1 built with the agent (1 published), 0 legacy");
|
|
40
|
+
expect(text).toContain("✓ Setup looks good.");
|
|
41
|
+
});
|
|
42
|
+
it("names a permission the key lacks", async () => {
|
|
43
|
+
const { text } = await validateSetup("zak_0123456789abcdef_secret", accessKey(["funnels:read"]), Response.json({ data: [publishedFunnel], next: null }));
|
|
44
|
+
expect(text).toContain("✗ FAIL — the key lacks the permission Read integrations (integrations:read).");
|
|
45
|
+
expect(text).not.toContain("Setup looks good");
|
|
46
|
+
});
|
|
47
|
+
it("tells the holder of a retired API key to create an access key", async () => {
|
|
48
|
+
const { fetch, text } = await validateSetup("zk_live_0123456789abcdef");
|
|
49
|
+
expect(text).toContain("✗ FAIL — API keys were retired; create an access key in Settings > Developers");
|
|
50
|
+
expect(fetch).not.toHaveBeenCalled();
|
|
51
|
+
});
|
|
52
|
+
it("explains a rejected key", async () => {
|
|
53
|
+
const { text } = await validateSetup("zak_0123456789abcdef_secret", Response.json({ status: 401, title: "A valid access key is required" }, { status: 401 }));
|
|
54
|
+
expect(text).toContain("✗ FAIL — Zellify API 401: A valid access key is required");
|
|
55
|
+
expect(text).toContain("mistyped, revoked, or expired");
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -18,7 +18,9 @@ Optional argument: a funnel ID. If provided, skip the funnel-picking step in Pha
|
|
|
18
18
|
|
|
19
19
|
```
|
|
20
20
|
/integrationcheck # uses first published funnel
|
|
21
|
-
/integrationcheck
|
|
21
|
+
/integrationcheck 42 # uses a specific funnel
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
After Phase 4 (path picked, user confirmed), pause and ask whether to proceed with the plan in Phase 5 or stop there. The user may want the plan and not the implementation.
|
|
25
|
+
|
|
26
|
+
The Zellify MCP sends no test requests. To test the webhook endpoint in Phase 7, ask the user to click **Send test** in the Zellify dashboard (Settings → Developers → Registration Webhook), then read the result in the Delivery Logs.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zellifyapp/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "An MCP server that gives Claude Code full context about your Zellify funnels so it can build
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "An MCP server that gives Claude Code full context about your Zellify funnels so it can build and debug your webhook integration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"zellify-mcp": "./build/index.js"
|
|
@@ -22,11 +22,13 @@
|
|
|
22
22
|
"build": "pnpm run clean && tsc && chmod 755 build/index.js",
|
|
23
23
|
"clean": "rimraf build tsconfig.tsbuildinfo",
|
|
24
24
|
"clean:deep": "rimraf build node_modules .turbo tsconfig.tsbuildinfo",
|
|
25
|
-
"check-types": "tsc --noEmit"
|
|
25
|
+
"check-types": "tsc --noEmit",
|
|
26
|
+
"test": "vitest run"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
29
|
"build",
|
|
29
30
|
"README.md",
|
|
31
|
+
"CHANGELOG.md",
|
|
30
32
|
"skill",
|
|
31
33
|
"commands"
|
|
32
34
|
],
|
|
@@ -38,7 +40,8 @@
|
|
|
38
40
|
"@types/node": "^22.15.3",
|
|
39
41
|
"@web2app/typescript-config": "workspace:*",
|
|
40
42
|
"rimraf": "^6.0.1",
|
|
41
|
-
"typescript": "5.9.2"
|
|
43
|
+
"typescript": "5.9.2",
|
|
44
|
+
"vitest": "^3.2.4"
|
|
42
45
|
},
|
|
43
46
|
"publishConfig": {
|
|
44
47
|
"access": "public"
|
package/skill/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: zellify-integration
|
|
3
|
-
description: "MUST USE for any Zellify integration work. Triggers: 'integrate with Zellify', 'set up Zellify', 'connect Zellify to our app', '/integrationcheck', plus all specific tasks: webhook handler, HMAC signature verification, quiz answers payload, Registration Webhook, RevenueCat entitlements, Adapty entitlements, Glassfy, deep link setup, app_user_id chain, Stripe metadata, Paddle custom data, Solidgate metadata,
|
|
3
|
+
description: "MUST USE for any Zellify integration work. Triggers: 'integrate with Zellify', 'set up Zellify', 'connect Zellify to our app', '/integrationcheck', plus all specific tasks: webhook handler, HMAC signature verification, quiz answers payload, Registration Webhook, RevenueCat entitlements, Adapty entitlements, Glassfy, deep link setup, app_user_id chain, Stripe metadata, Paddle custom data, Solidgate metadata, testing and debugging webhook delivery, generating types from funnel schema, choosing an integration path, mobile vs web app integration, existing Stripe/Paddle webhook augmentation."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Zellify Integration Expert
|
|
@@ -22,10 +22,10 @@ Run these phases in order. Don't skip ahead. Each phase has an exit condition.
|
|
|
22
22
|
### Phase 1 — Gather Zellify context (always first)
|
|
23
23
|
|
|
24
24
|
Call in parallel:
|
|
25
|
-
1. `list_funnels` — confirms the
|
|
26
|
-
2. `get_integrations` — returns the customer's payment provider, RevenueCat status, webhook configuration status (including the configured URL for `registration_webhook`),
|
|
25
|
+
1. `list_funnels` — confirms the access key works, returns funnel IDs and publish status.
|
|
26
|
+
2. `get_integrations` — returns the customer's payment provider, RevenueCat status, webhook configuration status (including the configured URL for `registration_webhook`), link count.
|
|
27
27
|
|
|
28
|
-
If `list_funnels` fails with auth, network error, or anything ambiguous: stop and run `validate_setup`. It pinpoints whether the problem is the env var not being set, an invalid key, the backend being unreachable, or no funnels existing — each with the exact remediation. Only ask the user to
|
|
28
|
+
If `list_funnels` fails with auth, network error, or anything ambiguous: stop and run `validate_setup`. It pinpoints whether the problem is the env var not being set, a retired API key, an invalid access key, a missing permission, the backend being unreachable, or no funnels existing — each with the exact remediation. Only ask the user to create a new access key (`https://dash.zellify.app/settings?tab=developers`, with the permissions Read funnels and Read integrations) if `validate_setup` says the key was rejected or retired. Otherwise the docs/install guide remediation is in its output.
|
|
29
29
|
|
|
30
30
|
If no funnels are published yet: tell the user to publish at least one funnel before integrating, and stop. Integration without a published funnel is meaningless.
|
|
31
31
|
|
|
@@ -150,20 +150,18 @@ Now fetch the deep recipe. The skill's bundled references are summaries — the
|
|
|
150
150
|
|
|
151
151
|
| Path | URL |
|
|
152
152
|
|---|---|
|
|
153
|
-
| Mobile App with RevenueCat | `https://
|
|
154
|
-
| Mobile App with Custom Backend | `https://
|
|
155
|
-
| Web App with Signup Page | `https://
|
|
156
|
-
| Using Existing Webhooks | `https://
|
|
157
|
-
| Early Account Creation | `https://
|
|
158
|
-
| Free Funnel with Deep Link | `https://
|
|
159
|
-
| Custom Registration Component | `https://
|
|
160
|
-
|
|
161
|
-
Use WebFetch to read the page. Also fetch the underlying
|
|
162
|
-
- `https://
|
|
163
|
-
- `https://
|
|
164
|
-
- `https://
|
|
165
|
-
- `https://developers.zellify.app/developers/webhooks/registration` (if the path involves the registration webhook)
|
|
166
|
-
- `https://developers.zellify.app/developers/webhooks/registration/payload` (when generating types)
|
|
153
|
+
| Mobile App with RevenueCat | `https://docs.zellify.app/developers/grant-access/mobile-app-with-revenuecat` |
|
|
154
|
+
| Mobile App with Custom Backend | `https://docs.zellify.app/developers/grant-access/mobile-app-with-your-own-backend` |
|
|
155
|
+
| Web App with Signup Page | `https://docs.zellify.app/developers/grant-access/web-app-with-a-sign-up-page` |
|
|
156
|
+
| Using Existing Webhooks | `https://docs.zellify.app/developers/grant-access/existing-stripe-or-paddle-webhooks` |
|
|
157
|
+
| Early Account Creation | `https://docs.zellify.app/developers/grant-access/accounts-before-payment` |
|
|
158
|
+
| Free Funnel with Deep Link | `https://docs.zellify.app/developers/grant-access/free-funnels` |
|
|
159
|
+
| Custom Registration Component | `https://docs.zellify.app/account/legacy-builder` |
|
|
160
|
+
|
|
161
|
+
Use WebFetch to read the page. Also fetch the underlying reference pages on the first run:
|
|
162
|
+
- `https://docs.zellify.app/developers/how-access-works` (`app_user_id` and checkout metadata)
|
|
163
|
+
- `https://docs.zellify.app/developers/deep-links`
|
|
164
|
+
- `https://docs.zellify.app/developers/registration-webhook` (if the path involves the registration webhook, and when generating types)
|
|
167
165
|
|
|
168
166
|
Output the plan as a numbered checklist with file paths and code snippets matched to the user's framework. Sections to cover (skip ones that don't apply to the chosen path):
|
|
169
167
|
|
|
@@ -173,7 +171,7 @@ Output the plan as a numbered checklist with file paths and code snippets matche
|
|
|
173
171
|
4. **Deep link wiring** — exact button config on the Zellify success page (the user sets this in the dashboard) + the URL scheme/universal link the app catches.
|
|
174
172
|
5. **Idempotency** — every grant looks up by `app_user_id` and no-ops if already granted. Inline a snippet.
|
|
175
173
|
6. **Error handling** — webhook returns < 10s, signature mismatch is 401, async work is offloaded.
|
|
176
|
-
7. **Testing** — the
|
|
174
|
+
7. **Testing** — **Send test** in the dashboard (Settings → Developers → Registration Webhook), the expected response, one real funnel walkthrough.
|
|
177
175
|
|
|
178
176
|
Show the user the full plan before writing any code.
|
|
179
177
|
|
|
@@ -204,38 +202,41 @@ If approved, generate the files. Apply the universal rules below to every webhoo
|
|
|
204
202
|
|
|
205
203
|
After writing code, run this checklist:
|
|
206
204
|
|
|
207
|
-
1. Call `get_integrations` again — confirm `registration_webhook` is configured and that its `url` field exactly matches the new endpoint you just deployed (don't accept "configured: true" as proof; the URL may still point at a stale deployment). If `url` is null or wrong, tell the user where to fix it: dashboard → Settings →
|
|
208
|
-
2.
|
|
205
|
+
1. Call `get_integrations` again — confirm `registration_webhook` is configured and that its `url` field exactly matches the new endpoint you just deployed (don't accept "configured: true" as proof; the URL may still point at a stale deployment). If `url` is null or wrong, tell the user where to fix it: dashboard → Settings → Developers → Registration Webhook.
|
|
206
|
+
2. Ask the user to click **Send test** in the dashboard (Settings → Developers → Registration Webhook). It sends a signed `{ "event": "webhook.test", ... }` body, not a registration, so it proves the endpoint is reachable and the signature check passes; the handler must answer it with 2xx and store nothing. Then point the user at the dashboard's Delivery Logs (Settings → Developers) so they can see the delivery and the response body.
|
|
209
207
|
3. Walk through the `app_user_id` chain manually:
|
|
210
208
|
- Webhook payload has `context.appUserId`? ✓
|
|
211
|
-
- Stripe/Paddle metadata read in payment handler? ✓ (read code)
|
|
212
|
-
- Deep
|
|
213
|
-
- App init
|
|
209
|
+
- Stripe/Paddle/Solidgate metadata read in payment handler? ✓ (read code)
|
|
210
|
+
- Deep Link Button has the **App User ID** toggle enabled in Built-in Parameters, with the key matching what the app reads? (user has to verify in the funnel editor — tell them how; the URL must be plain, no `{{template}}` syntax)
|
|
211
|
+
- App init parses `app_user_id` from the deep link query string and passes it to whatever grants access (RevenueCat, custom backend, other entitlement system)? ✓ (read code)
|
|
214
212
|
4. Tell the user to do an end-to-end test with a real funnel run + test card before going live.
|
|
215
213
|
|
|
216
|
-
Report the results plainly. If anything failed, diagnose using the debugging reference and
|
|
214
|
+
Report the results plainly. If anything failed, diagnose using the debugging reference and the error or response body the Delivery Logs show for the request.
|
|
217
215
|
|
|
218
216
|
---
|
|
219
217
|
|
|
220
218
|
## Universal rules (apply to every handler — violating these causes silent failures)
|
|
221
219
|
|
|
222
220
|
**MUST: Answers are wrapped objects, not primitives.**
|
|
223
|
-
Funnel answer access is `payload.answers.
|
|
221
|
+
Funnel answer access is `payload.answers.primaryGoal.value` and `payload.answers.primaryGoal.label`. Use `.label` when present; fall back to `.value` + option lookup via `get_funnel_schema`. The wrapped shape applies to every question type. For multiselect, `.label` is the chosen option labels comma-joined in selection order — usually exactly what you want.
|
|
224
222
|
|
|
225
223
|
**MUST: Option IDs are not labels.**
|
|
226
224
|
For singleselect/multiselect questions, `value` is an opaque ID like `"1"`. Resolve to a human-readable label via `answer.label` or by mapping against `get_funnel_schema` options. Don't ship code that switches on raw IDs without a comment explaining what they mean.
|
|
227
225
|
|
|
226
|
+
**MUST: Composite components emit dotted Component IDs.**
|
|
227
|
+
Components like double text input and multi-variant double input emit one entry per sub-field, keyed as `parent.child` (e.g. `fullName.left` / `fullName.right`). Read each as `payload.answers["fullName.left"]?.value`. The parent never appears on its own. Empty user input on a sub-field arrives as `""`, not omitted.
|
|
228
|
+
|
|
228
229
|
**MUST: Verify HMAC against the raw request body.**
|
|
229
|
-
Re-stringifying the JSON before HMAC will break the signature on any handler. Use `express.raw`, Fastify's `rawBody` plugin, Flask's `request.get_data(as_text=False)`, etc. Reference `references/language-guides.md` for per-framework patterns, or fetch `https://
|
|
230
|
+
Re-stringifying the JSON before HMAC will break the signature on any handler. Use `express.raw`, Fastify's `rawBody` plugin, Flask's `request.get_data(as_text=False)`, etc. Reference `references/language-guides.md` for per-framework patterns, or fetch `https://docs.zellify.app/developers/registration-webhook` for the canonical version.
|
|
230
231
|
|
|
231
232
|
**IMPORTANT: Preview mode silently disables webhooks.**
|
|
232
|
-
Funnel URLs containing `/preview/` will not fire webhooks no matter how perfect the handler is. Make sure the user is testing on a published funnel URL or with
|
|
233
|
+
Funnel URLs containing `/preview/` will not fire webhooks no matter how perfect the handler is. Make sure the user is testing on a published funnel URL or with **Send test** in the dashboard.
|
|
233
234
|
|
|
234
|
-
**IMPORTANT:
|
|
235
|
-
The handler must respond
|
|
235
|
+
**IMPORTANT: At-least-once delivery, 10-second timeout, full delivery logs in dashboard.**
|
|
236
|
+
The handler must respond within 10 seconds and **must be idempotent** — Zellify retries non-2xx responses and timeouts with exponential backoff, so the same registration can arrive more than once. Use `app_user_id` as the idempotency key. Do heavy work async after returning 200. Every delivery (including retries) is recorded in Settings → Developers → Delivery Logs, with request/response bodies and a Resend button.
|
|
236
237
|
|
|
237
238
|
**IMPORTANT: `app_user_id` is the bridge.**
|
|
238
|
-
It surfaces in three places: `context.appUserId` in the webhook (camelCase), `app_user_id` in Stripe/Paddle/Solidgate metadata (snake_case), and
|
|
239
|
+
It surfaces in three places: `context.appUserId` in the Registration webhook (camelCase), `app_user_id` in Stripe metadata / Paddle custom data / Solidgate metadata + `customer_account_id` (snake_case), and as a query parameter on the Deep Link Button URL (default key `app_user_id`, configurable). Same value, different field name and casing. Match by value, never by field name. The Deep Link Button does **not** use `{{template}}` interpolation — the user toggles "App User ID" in Built-in Parameters and Zellify auto-appends `?app_user_id=…` on tap.
|
|
239
240
|
|
|
240
241
|
---
|
|
241
242
|
|
|
@@ -245,18 +246,18 @@ Use these when the user's request is narrow and you don't need the full cold-sta
|
|
|
245
246
|
|
|
246
247
|
| User wants… | Sequence |
|
|
247
248
|
|---|---|
|
|
248
|
-
| Build webhook handler | `list_funnels` → `get_funnel_schema` → `get_example_payload` → write code →
|
|
249
|
-
| Debug webhook delivery | `get_integrations` →
|
|
249
|
+
| Build webhook handler | `list_funnels` → `get_funnel_schema` → `get_example_payload` → write code → **Send test** in the dashboard |
|
|
250
|
+
| Debug webhook delivery | `get_integrations` → Delivery Logs in the dashboard → diagnose response code → fix |
|
|
250
251
|
| Generate TypeScript types | `get_funnel_schema` → `get_example_payload` → extract interface |
|
|
251
252
|
| Choose an integration path | Phases 2 → 3 → 4 of cold-start workflow above |
|
|
252
|
-
| Wire up RevenueCat | Read `references/revenuecat.md` + WebFetch `https://
|
|
253
|
+
| Wire up RevenueCat | Read `references/revenuecat.md` + WebFetch `https://docs.zellify.app/integrations/subscriptions/revenuecat` |
|
|
253
254
|
| Wire up something other than RevenueCat | Phase 5b research mode → map to "Mobile App with Custom Backend" |
|
|
254
255
|
|
|
255
256
|
---
|
|
256
257
|
|
|
257
258
|
## Reference files (npm-bundled summaries)
|
|
258
259
|
|
|
259
|
-
These are quick-reference. For the canonical recipe, fetch the matching `
|
|
260
|
+
These are quick-reference. For the canonical recipe, fetch the matching `docs.zellify.app/developers` page.
|
|
260
261
|
|
|
261
262
|
| File | Use when |
|
|
262
263
|
|---|---|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Debugging Webhook Issues
|
|
2
2
|
|
|
3
|
-
> **Canonical recipe (live):** https://
|
|
3
|
+
> **Canonical recipe (live):** https://docs.zellify.app/developers/registration-webhook
|
|
4
4
|
|
|
5
5
|
## Step 1: Is the webhook configured?
|
|
6
6
|
|
|
@@ -10,19 +10,23 @@ get_integrations → check for registration_webhook
|
|
|
10
10
|
|
|
11
11
|
If not configured: Dashboard → Settings → Developers → Registration Webhook → Configure.
|
|
12
12
|
|
|
13
|
-
## Step 2:
|
|
13
|
+
## Step 2: Check the dashboard delivery logs first
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Every Registration webhook delivery is logged in **Dashboard → Settings → Developers → Delivery Logs**. Each row shows the time, event name, response status, success/failed, request duration, the request payload, and the response body (truncated to 1024 chars). Filter by All / Successful / Failed and search by recipient email. This is usually the fastest way to see whether the webhook fired, what the endpoint returned, and what error message came back.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
If a delivery failed, click into the row, fix the issue, then hit **Resend** to replay against the current webhook URL with a fresh signature.
|
|
18
18
|
|
|
19
|
-
## Step 3:
|
|
19
|
+
## Step 3: Are they testing in preview mode?
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
Any URL containing `/preview/` silently disables ALL webhooks. The preview tracker is a stub — every method is a no-op. No warning in the UI.
|
|
22
|
+
|
|
23
|
+
Fix: Use a published funnel URL (`yourdomain.com/f/{funnelId}/...`), or use **Send test** in the dashboard.
|
|
24
|
+
|
|
25
|
+
## Step 4: Send a test request
|
|
26
|
+
|
|
27
|
+
Click **Send test** in the dashboard under Settings → Developers → Registration Webhook.
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
Zellify signs a `{ "event": "webhook.test", "message": "…", "timestamp": "…" }` body with the webhook secret and POSTs it to the configured endpoint. It is not a registration: it proves the endpoint is reachable and the signature check passes. The handler answers it with 2xx and stores nothing. The request and the response appear in the Delivery Logs with the event `test`.
|
|
26
30
|
|
|
27
31
|
## Response diagnosis
|
|
28
32
|
|
|
@@ -30,15 +34,15 @@ Generates a realistic payload from the funnel's schema, signs it, POSTs to their
|
|
|
30
34
|
|
|
31
35
|
- Connection refused → server not running, wrong port, firewall
|
|
32
36
|
- DNS resolution failed → check URL for typos
|
|
33
|
-
- Timeout (>10s) → move heavy processing to background job
|
|
37
|
+
- Timeout (>10s) → move heavy processing to a background job
|
|
34
38
|
- SSL/TLS error → check cert validity
|
|
35
39
|
|
|
36
40
|
### HTTP error responses
|
|
37
41
|
|
|
38
42
|
| Status | Likely cause | Fix |
|
|
39
43
|
|--------|-------------|-----|
|
|
40
|
-
| 400 | Expects wrong payload shape | Common: expecting flat answers instead of `{ value }` objects, or expecting fields that don't exist |
|
|
41
|
-
| 401/403 | Auth middleware blocking OR signature mismatch | Exclude webhook route from auth; verify raw body
|
|
44
|
+
| 400 | Expects wrong payload shape | Common: expecting flat answers instead of `{ value, label?, pageSlug?, questionText? }` objects, or expecting fields that don't exist |
|
|
45
|
+
| 401/403 | Auth middleware blocking OR signature mismatch | Exclude webhook route from auth; verify HMAC against the raw body |
|
|
42
46
|
| 404 | URL doesn't match route | Check webhook config URL matches route definition |
|
|
43
47
|
| 405 | Route defined as GET instead of POST | Change to POST |
|
|
44
48
|
| 500 | Bug in handler code | Check server logs for stack trace |
|
|
@@ -46,9 +50,11 @@ Generates a realistic payload from the funnel's schema, signs it, POSTs to their
|
|
|
46
50
|
### 200 but nothing happens
|
|
47
51
|
|
|
48
52
|
- **Checking for event type field:** Registration Webhook has no `event` or `type` field. It always represents email_captured. Handlers that route by event type silently exit.
|
|
49
|
-
- **Accessing answers incorrectly:**
|
|
53
|
+
- **Accessing answers incorrectly:** Reading `payload.answers.primaryGoal` expecting a string but getting `{ value: "2", label: "Build a habit" }`. Use `.label` (preferred) or `.value`.
|
|
54
|
+
- **Missing dotted-key handling:** Composite components emit dotted Component IDs (e.g. `fullName.left`, `fullName.right`). Handlers reading only the parent key see nothing.
|
|
50
55
|
- **Email dedup:** Test email already exists, handler skips processing.
|
|
51
|
-
- **
|
|
56
|
+
- **At-least-once delivery:** the same registration can arrive more than once. Idempotency on `app_user_id` is required. A handler that double-creates accounts on retries will look like nothing-happens after the first run silently overwrites.
|
|
57
|
+
- **Wrong environment:** Handler writes to a staging DB the developer isn't checking.
|
|
52
58
|
|
|
53
59
|
### Signature verification failures
|
|
54
60
|
|
|
@@ -58,12 +64,13 @@ Fix: Capture raw request body BEFORE parsing. See `references/language-guides.md
|
|
|
58
64
|
|
|
59
65
|
Other causes: wrong secret (regenerated but env var not updated), encoding mismatch (UTF-8 vs Latin-1).
|
|
60
66
|
|
|
61
|
-
## Step
|
|
67
|
+
## Step 5: End-to-end with real funnel
|
|
62
68
|
|
|
63
69
|
After test webhook passes:
|
|
64
70
|
1. Open live funnel URL in incognito browser
|
|
65
71
|
2. Fill out the quiz, submit email
|
|
66
|
-
3. Check
|
|
72
|
+
3. Check the Delivery Logs in the dashboard for the new entry
|
|
73
|
+
4. Check server logs / database for the new record
|
|
67
74
|
|
|
68
75
|
If test works but real funnel doesn't fire:
|
|
69
76
|
- Funnel may not be published (check `list_funnels`)
|
|
@@ -73,7 +80,8 @@ If test works but real funnel doesn't fire:
|
|
|
73
80
|
## Webhook delivery facts
|
|
74
81
|
|
|
75
82
|
- Method: POST, Content-Type: application/json
|
|
76
|
-
- Signature: X-Webhook-Signature (HMAC-SHA256)
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
83
|
+
- Signature: `X-Webhook-Signature` (HMAC-SHA256 of the raw body, hex)
|
|
84
|
+
- Default timeout: 10 seconds
|
|
85
|
+
- Retries: yes — non-2xx responses and timeouts are retried with exponential backoff (at-least-once delivery)
|
|
86
|
+
- Delivery logs: full UI in Settings → Developers, with Resend
|
|
87
|
+
- Test request: **Send test** sends a signed `webhook.test` body; skip it after the signature check
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Integration Paths
|
|
2
2
|
|
|
3
|
-
> **Canonical recipes (live):** https://
|
|
3
|
+
> **Canonical recipes (live):** https://docs.zellify.app/developers/how-access-works
|
|
4
4
|
> Fetch the specific guide for the chosen path. The summaries below are for path-picking only.
|
|
5
5
|
|
|
6
6
|
Use `get_integrations` to determine which path fits the developer.
|
|
@@ -21,25 +21,25 @@ Use `get_integrations` to determine which path fits the developer.
|
|
|
21
21
|
|
|
22
22
|
## Mobile App with RevenueCat
|
|
23
23
|
|
|
24
|
-
**Needs:** RevenueCat connected to Stripe/Paddle,
|
|
24
|
+
**Needs:** RevenueCat connected to Stripe/Paddle, Deep Link Button on success page, SDK init with `app_user_id` from the deep link.
|
|
25
25
|
|
|
26
26
|
**app_user_id chain (3 places):**
|
|
27
|
-
1. Stripe/Paddle
|
|
27
|
+
1. Stripe metadata / Paddle custom data → read by RevenueCat via S2S webhook
|
|
28
28
|
2. Deep Link Button URL → carried into the app
|
|
29
|
-
3. RevenueCat SDK init → `Purchases.configure()` with app_user_id from deep link
|
|
29
|
+
3. RevenueCat SDK init → `Purchases.configure()` with `app_user_id` extracted from the deep link
|
|
30
30
|
|
|
31
31
|
**Biggest risk:** 5 silent failure points — see `references/revenuecat.md`.
|
|
32
32
|
|
|
33
|
-
**Docs:** https://docs.zellify.app/
|
|
33
|
+
**Docs:** https://docs.zellify.app/developers/grant-access/mobile-app-with-revenuecat
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
37
|
## Mobile App with Custom Backend
|
|
38
38
|
|
|
39
|
-
**Needs:** Payment webhook handler (Stripe/Paddle),
|
|
39
|
+
**Needs:** Payment webhook handler (Stripe/Paddle/Solidgate), Deep Link Button on success page. Optionally Registration Webhook for early lead capture.
|
|
40
40
|
|
|
41
41
|
**app_user_id chain (2 places):**
|
|
42
|
-
1.
|
|
42
|
+
1. Payment metadata → in the payment webhook
|
|
43
43
|
2. Deep Link Button URL → carried into the app
|
|
44
44
|
|
|
45
45
|
**Stripe events to listen for:**
|
|
@@ -47,33 +47,41 @@ Use `get_integrations` to determine which path fits the developer.
|
|
|
47
47
|
| Scenario | Event |
|
|
48
48
|
|----------|-------|
|
|
49
49
|
| One-time product | `checkout.session.completed` |
|
|
50
|
-
| Subscription (first) | `checkout.session.completed` |
|
|
50
|
+
| Subscription (first payment) | `checkout.session.completed` |
|
|
51
51
|
| Subscription (renewals) | `invoice.paid` |
|
|
52
|
-
|
|
|
52
|
+
| Subscription schedule phase | `invoice.paid` |
|
|
53
|
+
| Upsells (any type) | `invoice.paid` |
|
|
53
54
|
|
|
54
|
-
Recommend listening for both
|
|
55
|
+
Recommend listening for both `checkout.session.completed` and `invoice.paid` if you sell mixed product types or use upsells. Use `app_user_id` as the idempotency key.
|
|
55
56
|
|
|
56
|
-
**Paddle:** Listen for `transaction.completed`. Paddle does NOT support upsells or multi-phase subscription schedules.
|
|
57
|
+
**Paddle:** Listen for `transaction.completed`. Optionally `subscription.activated` for lifecycle. Paddle does NOT support upsells or multi-phase subscription schedules.
|
|
57
58
|
|
|
58
|
-
**
|
|
59
|
+
**Solidgate:** Listen for `order.approved` (one-time + first subscription payment), `subscription.renewed` (renewals), `subscription.canceled` (cancellation). `app_user_id` is on `Order.metadata` and `Subscription.metadata`. Solidgate also sets the top-level `customer_account_id` field to the same `app_user_id` for customer linking.
|
|
60
|
+
|
|
61
|
+
**Docs:** https://docs.zellify.app/developers/grant-access/mobile-app-with-your-own-backend
|
|
59
62
|
|
|
60
63
|
---
|
|
61
64
|
|
|
62
65
|
## Web App with Signup Page
|
|
63
66
|
|
|
64
|
-
**Needs:**
|
|
67
|
+
**Needs:** Deep Link Button on success page (web URL with `app_user_id` and `email` toggled on). Signup page reads them from the URL and either (a) queries the payment provider by metadata at signup, or (b) listens for payment webhooks to match.
|
|
68
|
+
|
|
69
|
+
**Registration Webhook is OPTIONAL** here, only if the customer wants pre-payment lead data (abandoned cart, early account creation). It is *not* required for this path.
|
|
65
70
|
|
|
66
|
-
**Flow:** Funnel → pay → success page →
|
|
71
|
+
**Flow:** Funnel → pay → success page → Deep Link Button → signup page receives `?app_user_id=…&email=…` → web app creates account, links to payment by `app_user_id`.
|
|
67
72
|
|
|
68
|
-
**Docs:** https://docs.zellify.app/
|
|
73
|
+
**Docs:** https://docs.zellify.app/developers/grant-access/web-app-with-a-sign-up-page
|
|
69
74
|
|
|
70
75
|
---
|
|
71
76
|
|
|
72
77
|
## Using Existing Webhooks
|
|
73
78
|
|
|
74
|
-
Developer already has Stripe/Paddle webhook handlers. Zellify
|
|
79
|
+
Developer already has Stripe/Paddle/Solidgate webhook handlers. Zellify attaches a metadata bundle (`app_user_id`, `organization_id`, `funnel_id`, `campaign_id`, `experiment_id`, optional `fbp` / `fbc`) to every payment object it creates. The developer reads `app_user_id` (and any other useful fields) from those handlers.
|
|
80
|
+
|
|
81
|
+
For Stripe: `Customer.metadata`, `Checkout Session.metadata`, `Subscription.metadata`, `Invoice.metadata`. For Paddle: `Customer.custom_data`, `Transaction.custom_data`. For Solidgate: `Order.metadata`, `Subscription.metadata`.
|
|
75
82
|
|
|
76
|
-
**Docs:** https://docs.zellify.app/
|
|
83
|
+
**Docs:** https://docs.zellify.app/developers/grant-access/existing-stripe-or-paddle-webhooks
|
|
84
|
+
**Checkout metadata reference:** https://docs.zellify.app/developers/how-access-works
|
|
77
85
|
|
|
78
86
|
---
|
|
79
87
|
|
|
@@ -81,25 +89,39 @@ Developer already has Stripe/Paddle webhook handlers. Zellify sets `app_user_id`
|
|
|
81
89
|
|
|
82
90
|
Registration Webhook creates a pending account BEFORE payment. Payment webhook activates it.
|
|
83
91
|
|
|
84
|
-
1. Email submitted → Registration Webhook → create pending account with app_user_id
|
|
85
|
-
2. Payment → Stripe/Paddle webhook → look up by app_user_id → activate
|
|
92
|
+
1. Email submitted → Registration Webhook → create pending account with `app_user_id`
|
|
93
|
+
2. Payment → Stripe/Paddle/Solidgate webhook → look up by `app_user_id` → activate
|
|
86
94
|
|
|
87
|
-
Same app_user_id links both events. Handle the case where payment never happens.
|
|
95
|
+
Same `app_user_id` links both events. Handle the case where payment never happens.
|
|
88
96
|
|
|
89
|
-
**Docs:** https://docs.zellify.app/
|
|
97
|
+
**Docs:** https://docs.zellify.app/developers/registration-webhook
|
|
90
98
|
|
|
91
99
|
---
|
|
92
100
|
|
|
93
101
|
## Free Funnel with Deep Link
|
|
94
102
|
|
|
95
|
-
No paywall, no checkout. Registration Webhook is the ONLY data delivery mechanism.
|
|
103
|
+
No paywall, no checkout. Registration Webhook is the ONLY data delivery mechanism, and the Deep Link Button is the routing handoff.
|
|
96
104
|
|
|
97
|
-
**Docs:** https://docs.zellify.app/
|
|
105
|
+
**Docs:** https://docs.zellify.app/developers/grant-access/free-funnels
|
|
98
106
|
|
|
99
107
|
---
|
|
100
108
|
|
|
101
109
|
## Custom Registration Component
|
|
102
110
|
|
|
103
|
-
Client-side
|
|
111
|
+
Client-side React component on the success page that calls the developer's API from the browser. Has access to email, payment-provider IDs (`_stripeCustomerId`, `_stripeCheckoutSessionId`, `_paddleCustomerId`, `_paddleTransactionId`, `_solidgateCustomerId`), and `app_user_id` via `tracker.sessionId`. Developer must handle CORS and tab-close-before-completion.
|
|
112
|
+
|
|
113
|
+
**Docs:** https://docs.zellify.app/account/legacy-builder
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Deep Link Button URL pattern (common to most paths)
|
|
118
|
+
|
|
119
|
+
The Deep Link Button does **not** use `{{template}}` interpolation in the URL field. Instead:
|
|
120
|
+
|
|
121
|
+
1. Set **Destination URL** to a plain URL (e.g. `https://yourapp.onelink.me/abc` or `https://app.example.com/signup`).
|
|
122
|
+
2. In **Built-in Parameters**, toggle on **App User ID** (and **Email** if needed). Each toggle has a configurable key — default `app_user_id`, rename to whatever your app expects (`customerUid`, `userId`, etc.).
|
|
123
|
+
3. On click, Zellify auto-appends the toggled values as query parameters: `https://yourapp.onelink.me/abc?app_user_id=3a296273-...`.
|
|
124
|
+
|
|
125
|
+
For deferred deeplink providers (Adjust, Branch), use that provider's URL format as Destination URL — toggled params are appended either way. For AppsFlyer use the dedicated **AppsFlyer OneLink** component.
|
|
104
126
|
|
|
105
|
-
**
|
|
127
|
+
**Reference:** https://docs.zellify.app/developers/deep-links
|
|
@@ -80,8 +80,12 @@ const rawBody = event.body ?? '';
|
|
|
80
80
|
## Answer access pattern (all languages)
|
|
81
81
|
|
|
82
82
|
```
|
|
83
|
-
answer.label → "
|
|
84
|
-
answer.
|
|
83
|
+
answer.label → "Build a habit" (singleselect, slider with labeled stops)
|
|
84
|
+
answer.label → "Apple, Banana" (multiselect — comma-joined in selection order)
|
|
85
|
+
answer.value → "2" (option ID — always present)
|
|
86
|
+
answer.value → ["3", "2", "4"] (multiselect — array of option IDs)
|
|
85
87
|
```
|
|
86
88
|
|
|
87
|
-
For multiselect, `
|
|
89
|
+
For multiselect, prefer `answer.label` (already joined in selection order). If you need an array, `split(", ")` on the label or look each ID up in a map from `get_funnel_schema`.
|
|
90
|
+
|
|
91
|
+
Composite components (double text input, multi-variant double input) emit one entry per sub-field with a dotted key — read `answer["fullName.left"]`, `answer["fullName.right"]`, etc. The parent name never appears on its own.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# RevenueCat Integration
|
|
2
2
|
|
|
3
|
-
> **Canonical recipe (live):** https://
|
|
4
|
-
> Plus integration setup: https://developers.zellify.app/integrations/subscriptions/revenuecat
|
|
3
|
+
> **Canonical recipe (live):** https://docs.zellify.app/developers/grant-access/mobile-app-with-revenuecat
|
|
5
4
|
|
|
6
5
|
## The chain
|
|
7
6
|
|
|
@@ -9,13 +8,13 @@ Every link must be correct. A failure at any point is silent.
|
|
|
9
8
|
|
|
10
9
|
```
|
|
11
10
|
Zellify funnel → quiz → paywall
|
|
12
|
-
→ Checkout: Zellify sets app_user_id in Stripe/Paddle
|
|
11
|
+
→ Checkout: Zellify sets app_user_id in Stripe metadata / Paddle custom data
|
|
13
12
|
→ Payment: Stripe/Paddle charges the visitor
|
|
14
13
|
→ S2S webhook: Stripe/Paddle → RevenueCat
|
|
15
14
|
→ RevenueCat reads app_user_id from metadata → creates subscriber
|
|
16
|
-
→ Success page: Deep Link Button
|
|
17
|
-
→ App opens, extracts app_user_id from deep link
|
|
18
|
-
→ App calls Purchases.configure() with app_user_id
|
|
15
|
+
→ Success page: Deep Link Button appends app_user_id as a query param
|
|
16
|
+
→ App opens, extracts app_user_id from the deep link query string
|
|
17
|
+
→ App calls Purchases.configure() with that app_user_id
|
|
19
18
|
→ RevenueCat returns entitlements → access granted
|
|
20
19
|
```
|
|
21
20
|
|
|
@@ -42,21 +41,21 @@ Zellify funnel → quiz → paywall
|
|
|
42
41
|
- **Symptom:** Subscriber profile exists, purchase tracked, but no entitlements granted. App checks entitlements, finds none.
|
|
43
42
|
- **Fix:** Map each Stripe/Paddle product ID to a RevenueCat entitlement.
|
|
44
43
|
|
|
45
|
-
### 4.
|
|
44
|
+
### 4. Deep Link Button missing the App User ID toggle
|
|
46
45
|
|
|
47
|
-
- **Where:** Zellify funnel editor → success page → Deep Link Button
|
|
48
|
-
- **Symptom:** App opens but has no app_user_id. SDK initializes with anonymous ID. Entitlements exist on a different subscriber profile.
|
|
49
|
-
- **Fix:**
|
|
46
|
+
- **Where:** Zellify funnel editor → success page → Deep Link Button → Built-in Parameters
|
|
47
|
+
- **Symptom:** App opens but has no `app_user_id` in the query string. SDK initializes with anonymous ID. Entitlements exist on a different subscriber profile.
|
|
48
|
+
- **Fix:** In the Deep Link Button config, toggle on **App User ID** in Built-in Parameters. Default key is `app_user_id` — rename if your app expects a different name. Do **not** put `{{app_user_id}}` in the Destination URL — the button doesn't use template syntax. Set Destination URL to a plain URL (e.g. `https://yourapp.onelink.me/abc`); Zellify auto-appends `?app_user_id=…` on tap.
|
|
50
49
|
|
|
51
50
|
### 5. App doesn't use app_user_id from deep link
|
|
52
51
|
|
|
53
52
|
- **Where:** Developer's mobile app code
|
|
54
|
-
- **Symptom:** App receives deep link but ignores app_user_id
|
|
55
|
-
- **Fix:**
|
|
53
|
+
- **Symptom:** App receives deep link but ignores `app_user_id`. SDK starts anonymous.
|
|
54
|
+
- **Fix:** Parse the query string, extract `app_user_id` (or whatever key you configured), and pass to `Purchases.configure()` or `Purchases.logIn()`.
|
|
56
55
|
|
|
57
56
|
## Zellify's RevenueCat metadata enrichment
|
|
58
57
|
|
|
59
|
-
When enabled (Dashboard → Settings → Integrations → RevenueCat), Zellify calls RevenueCat's API at checkout time to pre-create a subscriber profile with email, funnel/
|
|
58
|
+
When enabled (Dashboard → Settings → Integrations → RevenueCat), Zellify calls RevenueCat's API at checkout time to pre-create a subscriber profile with `app_user_id`, email, and funnel/link/experiment metadata as subscriber attributes. This is optional but valuable — the Stripe/Paddle S2S webhook does NOT carry email.
|
|
60
59
|
|
|
61
60
|
Check if enabled: `get_integrations` → look for `revenuecat: configured`.
|
|
62
61
|
|
|
@@ -65,12 +64,12 @@ Check if enabled: `get_integrations` → look for `revenuecat: configured`.
|
|
|
65
64
|
1. `get_integrations` — verify RevenueCat + payment provider configured
|
|
66
65
|
2. Ask developer to check points 1 and 2 in RevenueCat dashboard (no API access)
|
|
67
66
|
3. Verify product → entitlement mapping
|
|
68
|
-
4. Check
|
|
67
|
+
4. Check Deep Link Button: App User ID toggle enabled in Built-in Parameters, key matches what the app reads
|
|
69
68
|
5. Review app's deep link handling and SDK initialization code
|
|
70
69
|
|
|
71
70
|
## Reference docs
|
|
72
71
|
|
|
73
|
-
- Zellify RevenueCat guide: https://docs.zellify.app/
|
|
74
|
-
- Zellify
|
|
72
|
+
- Zellify RevenueCat guide: https://docs.zellify.app/integrations/subscriptions/revenuecat
|
|
73
|
+
- Zellify deep links: https://docs.zellify.app/developers/deep-links
|
|
75
74
|
- RevenueCat Stripe setup: https://www.revenuecat.com/docs/web/integrations/stripe
|
|
76
75
|
- RevenueCat identifying users: https://www.revenuecat.com/docs/customers/user-ids
|