@zellifyapp/mcp 0.1.4 → 0.3.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/README.md +12 -27
- package/build/client.d.ts +4 -0
- package/build/client.d.ts.map +1 -1
- package/build/index.js +68 -12
- package/build/init.d.ts +2 -0
- package/build/init.d.ts.map +1 -0
- package/build/init.js +30 -0
- package/build/tools/get-integrations.d.ts.map +1 -1
- package/build/tools/get-integrations.js +4 -0
- package/build/tools/validate-setup.d.ts +3 -0
- package/build/tools/validate-setup.d.ts.map +1 -0
- package/build/tools/validate-setup.js +58 -0
- package/commands/integrationcheck.md +24 -0
- package/package.json +3 -3
- package/skill/SKILL.md +268 -0
- package/{references → skill/references}/debugging.md +2 -0
- package/{references → skill/references}/integration-paths.md +3 -0
- package/{references → skill/references}/revenuecat.md +3 -0
- package/{references → skill/references}/types-and-payload.md +2 -0
- package/{references → skill/references}/webhook-handler.md +3 -0
- package/SKILL.md +0 -47
- /package/{references → skill/references}/language-guides.md +0 -0
package/README.md
CHANGED
|
@@ -2,48 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
An MCP server that gives Claude Code full context about your Zellify funnels — variable names, payload shapes, integration status — so it can build, test, and debug your webhook integration without guessing.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. Generate an API key in Zellify Dashboard → Settings → Developer.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
2. Register the MCP server, then run the init command to copy the skill + slash command into your project:
|
|
10
|
+
```bash
|
|
11
|
+
claude mcp add zellify -e ZELLIFY_API_KEY=YOUR_API_KEY -- npx -y @zellifyapp/mcp@latest
|
|
12
|
+
npx -y @zellifyapp/mcp@latest init
|
|
13
|
+
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
The init command is pure Node, so it works on macOS, Linux, and Windows (PowerShell, cmd.exe, and Git Bash) without shell-specific tweaks. Re-run it any time to update the skill files to the latest version.
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
claude mcp add zellify -- npx -y @zellifyapp/mcp@latest -y --api-key YOUR_API_KEY
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### 3. Try it
|
|
18
|
-
|
|
19
|
-
Open Claude Code and ask:
|
|
17
|
+
The API key is passed as an environment variable (`-e ZELLIFY_API_KEY=…`), not on the command line — argv-passed secrets leak to `ps`, shell history, and process inspection. If you previously installed with `--api-key`, rotate that key in the dashboard and re-add with the form above.
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Claude will call `list_funnels` to find your funnel, `get_funnel_schema` for the variable names, `get_example_payload` for a typed payload and TypeScript interface, write the handler with signature verification, and fire `send_test_webhook` to prove it works.
|
|
19
|
+
3. Fully quit and reopen Claude Code (⌘Q on macOS — closing the window is not enough; the MCP server registration is loaded once at startup). Then run `/integrationcheck` in Claude Code. Claude will analyze your codebase, ask any clarifying questions, pick the easiest integration path, and produce a complete plan you can approve and execute in one session.
|
|
24
20
|
|
|
25
21
|
## Available tools
|
|
26
22
|
|
|
27
23
|
| Tool | Description |
|
|
28
24
|
|------|-------------|
|
|
25
|
+
| `validate_setup` | Verify the MCP is configured: env var present, API key valid, backend reachable, funnels published. Run this first if anything else fails. |
|
|
29
26
|
| `list_funnels` | List all funnels with IDs, names, published status, and last updated date |
|
|
30
27
|
| `get_funnel_schema` | Get a funnel's variables — names, question types, option ID-to-label mappings |
|
|
31
28
|
| `get_example_payload` | Get a realistic example webhook payload and TypeScript interface for a funnel |
|
|
32
|
-
| `get_integrations` | Check configured integrations, payment provider, and active campaign count |
|
|
29
|
+
| `get_integrations` | Check configured integrations, payment provider, registration webhook URL, and active campaign count |
|
|
33
30
|
| `send_test_webhook` | Fire a signed test webhook to your configured endpoint and report the result |
|
|
34
31
|
|
|
35
|
-
## Skill file
|
|
36
|
-
|
|
37
|
-
The package ships with `SKILL.md` — a Claude Code skill that teaches Claude the full Zellify integration playbook: which reference docs to read, how to chain tools together, and the rules that prevent silent failures (raw body signatures, option ID resolution, `app_user_id` chaining).
|
|
38
|
-
|
|
39
|
-
To install it, copy the file into your project's skills directory:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
cp node_modules/@zellifyapp/mcp/SKILL.md .claude/skills/zellify-integration.md
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
With the skill installed, Claude will automatically follow the correct workflow whenever you ask it to build a webhook handler, debug delivery issues, set up RevenueCat, or generate types.
|
|
46
|
-
|
|
47
32
|
## Example prompts
|
|
48
33
|
|
|
49
34
|
```
|
package/build/client.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export interface ExamplePayloadResponse {
|
|
|
24
24
|
export interface Integration {
|
|
25
25
|
name: string;
|
|
26
26
|
configured: boolean;
|
|
27
|
+
/** Present for `registration_webhook` only. The configured public webhook URL, or null if unset. */
|
|
28
|
+
url?: string | null;
|
|
29
|
+
/** Present for `registration_webhook` only. Whether the signing secret is configured. */
|
|
30
|
+
secretConfigured?: boolean;
|
|
27
31
|
}
|
|
28
32
|
export interface IntegrationsResponse {
|
|
29
33
|
integrations: Integration[];
|
package/build/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAyCA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAyCA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,oGAAoG;IACpG,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,yFAAyF;IACzF,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAID,wBAAsB,WAAW,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAElE;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,SAAS,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,CAE1C;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,sBAAsB,CAAC,CAEjC;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAErE;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CAI9B"}
|
package/build/index.js
CHANGED
|
@@ -2,19 +2,67 @@
|
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
if (args.includes("--help") || args.includes("-h") || args[0] === "help") {
|
|
7
|
+
process.stdout.write(`zellify-mcp — Zellify MCP server for Claude Code
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
zellify-mcp Run the MCP server (stdio transport)
|
|
11
|
+
zellify-mcp init Install the Zellify skill + /integrationcheck
|
|
12
|
+
slash command into ./.claude/ in the current
|
|
13
|
+
project. Re-run any time to update.
|
|
14
|
+
zellify-mcp --help Show this message.
|
|
15
|
+
|
|
16
|
+
Authentication:
|
|
17
|
+
The server reads ZELLIFY_API_KEY from its environment. With Claude Code:
|
|
18
|
+
|
|
19
|
+
claude mcp add zellify -e ZELLIFY_API_KEY=YOUR_KEY -- npx -y @zellifyapp/mcp@latest
|
|
20
|
+
|
|
21
|
+
Pass the key via -e (env), not on the command line — argv leaks to ps,
|
|
22
|
+
shell history, and process inspection.
|
|
23
|
+
|
|
24
|
+
Environment variables:
|
|
25
|
+
ZELLIFY_API_KEY Required. Generate at https://dash.zellify.app/dashboard/settings/developer
|
|
26
|
+
ZELLIFY_API_URL Optional. Defaults to https://standalone-api.zellify.app
|
|
27
|
+
|
|
28
|
+
Docs:
|
|
29
|
+
https://docs.zellify.app
|
|
30
|
+
`);
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
if (args[0] === "init") {
|
|
34
|
+
const { run } = await import("./init.js");
|
|
35
|
+
run();
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
// Backward compatibility: a previous version of the install docs used
|
|
39
|
+
// `--api-key VALUE` on the command line. The server reads from env, so the
|
|
40
|
+
// flag silently did nothing. Accept it now (set the env), warn loudly that
|
|
41
|
+
// it's insecure, and tell the user how to migrate.
|
|
42
|
+
const apiKeyFlagIdx = args.indexOf("--api-key");
|
|
43
|
+
if (apiKeyFlagIdx !== -1 && args[apiKeyFlagIdx + 1]) {
|
|
44
|
+
process.env.ZELLIFY_API_KEY = args[apiKeyFlagIdx + 1];
|
|
45
|
+
process.stderr.write("[zellify-mcp] WARNING: --api-key on the command line is insecure (leaks to ps, shell history, process inspection).\n" +
|
|
46
|
+
"[zellify-mcp] Rotate this key in the dashboard and re-add the MCP with -e ZELLIFY_API_KEY=…:\n" +
|
|
47
|
+
"[zellify-mcp] claude mcp remove zellify\n" +
|
|
48
|
+
"[zellify-mcp] claude mcp add zellify -e ZELLIFY_API_KEY=NEW_KEY -- npx -y @zellifyapp/mcp@latest\n");
|
|
49
|
+
}
|
|
50
|
+
// Imports below depend on env being read (client.ts captures ZELLIFY_API_KEY
|
|
51
|
+
// at module-eval time), so do them after the --api-key fallback above.
|
|
52
|
+
const { McpServer } = await import("@modelcontextprotocol/sdk/server/mcp.js");
|
|
53
|
+
const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
54
|
+
const { registerListFunnels } = await import("./tools/list-funnels.js");
|
|
55
|
+
const { registerGetFunnelSchema } = await import("./tools/get-funnel-schema.js");
|
|
56
|
+
const { registerGetExamplePayload } = await import("./tools/get-example-payload.js");
|
|
57
|
+
const { registerGetIntegrations } = await import("./tools/get-integrations.js");
|
|
58
|
+
const { registerSendTestWebhook } = await import("./tools/send-test-webhook.js");
|
|
59
|
+
const { registerValidateSetup } = await import("./tools/validate-setup.js");
|
|
60
|
+
const { registerIntegrationPlanPrompt } = await import("./prompts/integration-plan.js");
|
|
13
61
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
const referencesDir = join(__dirname, "..", "references");
|
|
62
|
+
const referencesDir = join(__dirname, "..", "skill", "references");
|
|
15
63
|
const server = new McpServer({
|
|
16
64
|
name: "zellify",
|
|
17
|
-
version: "0.
|
|
65
|
+
version: "0.3.0",
|
|
18
66
|
}, {
|
|
19
67
|
instructions: `Zellify MCP — integrate with Zellify web funnels.
|
|
20
68
|
|
|
@@ -34,9 +82,16 @@ No retries. 10-second timeout. No dashboard delivery logs. A failed delivery is
|
|
|
34
82
|
**Debug:** get_integrations → send_test_webhook → diagnose response
|
|
35
83
|
**Generate types:** get_funnel_schema → get_example_payload → extract TypeScript interface
|
|
36
84
|
|
|
37
|
-
##
|
|
85
|
+
## Cold-start
|
|
86
|
+
If the user wants to integrate but has no working code yet, run \`/integrationcheck\`
|
|
87
|
+
(custom slash command, see commands/integrationcheck.md in the npm package) or
|
|
88
|
+
follow the cold-start workflow in SKILL.md. Do not improvise — use the phased
|
|
89
|
+
flow: discover → ask → decide → plan → implement → verify.
|
|
38
90
|
|
|
39
|
-
|
|
91
|
+
## Reference resources
|
|
92
|
+
Read the MCP resources for detailed guides: webhook-handler, debugging,
|
|
93
|
+
integration-paths, revenuecat, types-and-payload, language-guides. For full
|
|
94
|
+
recipes, fetch the matching guide on https://docs2.zellify.app/developers/guides.`,
|
|
40
95
|
});
|
|
41
96
|
// ── Reference resources ──────────────────────────────────
|
|
42
97
|
const referenceFiles = [
|
|
@@ -54,6 +109,7 @@ for (const ref of referenceFiles) {
|
|
|
54
109
|
});
|
|
55
110
|
}
|
|
56
111
|
// ── Tools ────────────────────────────────────────────────
|
|
112
|
+
registerValidateSetup(server);
|
|
57
113
|
registerListFunnels(server);
|
|
58
114
|
registerGetFunnelSchema(server);
|
|
59
115
|
registerGetExamplePayload(server);
|
package/build/init.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAIA,wBAAgB,GAAG,IAAI,IAAI,CA8B1B"}
|
package/build/init.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { copyFileSync, cpSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
export function run() {
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const pkgRoot = join(__dirname, "..");
|
|
7
|
+
const cwd = process.cwd();
|
|
8
|
+
const skillSrc = join(pkgRoot, "skill");
|
|
9
|
+
const skillDst = join(cwd, ".claude", "skills", "zellify-integration");
|
|
10
|
+
const cmdSrc = join(pkgRoot, "commands", "integrationcheck.md");
|
|
11
|
+
const cmdDstDir = join(cwd, ".claude", "commands");
|
|
12
|
+
const cmdDst = join(cmdDstDir, "integrationcheck.md");
|
|
13
|
+
mkdirSync(dirname(skillDst), { recursive: true });
|
|
14
|
+
cpSync(skillSrc, skillDst, { recursive: true, force: true });
|
|
15
|
+
mkdirSync(cmdDstDir, { recursive: true });
|
|
16
|
+
copyFileSync(cmdSrc, cmdDst);
|
|
17
|
+
console.log("Installed Zellify skill at .claude/skills/zellify-integration/");
|
|
18
|
+
console.log("Installed /integrationcheck slash command at .claude/commands/integrationcheck.md");
|
|
19
|
+
console.log("");
|
|
20
|
+
console.log("Next:");
|
|
21
|
+
console.log(" 1. Register the MCP server (one-time, per project):");
|
|
22
|
+
console.log(" claude mcp add zellify -e ZELLIFY_API_KEY=YOUR_KEY -- npx -y @zellifyapp/mcp@latest");
|
|
23
|
+
console.log(" Get a key at https://dash.zellify.app/dashboard/settings/developer.");
|
|
24
|
+
console.log("");
|
|
25
|
+
console.log(" 2. Fully quit and reopen Claude Code (⌘Q on macOS — closing the");
|
|
26
|
+
console.log(" window is not enough; MCP server registrations are loaded once");
|
|
27
|
+
console.log(" at app start and do not hot-reload).");
|
|
28
|
+
console.log("");
|
|
29
|
+
console.log(" 3. In your project, run /integrationcheck.");
|
|
30
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-integrations.d.ts","sourceRoot":"","sources":["../../src/tools/get-integrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"get-integrations.d.ts","sourceRoot":"","sources":["../../src/tools/get-integrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAuCxD"}
|
|
@@ -7,6 +7,10 @@ export function registerGetIntegrations(server) {
|
|
|
7
7
|
lines.push("Configured integrations:");
|
|
8
8
|
for (const i of data.integrations) {
|
|
9
9
|
lines.push(` - ${i.name}`);
|
|
10
|
+
if (i.name === "registration_webhook") {
|
|
11
|
+
lines.push(` URL: ${i.url ?? "(not set)"}`);
|
|
12
|
+
lines.push(` Secret: ${i.secretConfigured ? "configured" : "missing"}`);
|
|
13
|
+
}
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-setup.d.ts","sourceRoot":"","sources":["../../src/tools/validate-setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QA2EtD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { listFunnels } from "../client.js";
|
|
2
|
+
const API_URL = process.env.ZELLIFY_API_URL ?? "https://standalone-api.zellify.app";
|
|
3
|
+
const API_KEY_PRESENT = Boolean(process.env.ZELLIFY_API_KEY);
|
|
4
|
+
export function registerValidateSetup(server) {
|
|
5
|
+
server.tool("validate_setup", "Verify that the Zellify MCP is correctly configured: env var present, API key valid, backend reachable, and at least one published funnel exists. Run this first if anything else fails — it pinpoints whether the problem is auth, network, or empty org. Returns a checklist with PASS/FAIL for each check.", {}, async () => {
|
|
6
|
+
const lines = [];
|
|
7
|
+
lines.push(`API URL: ${API_URL}`);
|
|
8
|
+
lines.push(`ZELLIFY_API_KEY env var: ${API_KEY_PRESENT ? "PRESENT" : "MISSING"}`);
|
|
9
|
+
if (!API_KEY_PRESENT) {
|
|
10
|
+
lines.push("");
|
|
11
|
+
lines.push("✗ FAIL — ZELLIFY_API_KEY is not in the MCP server's environment.");
|
|
12
|
+
lines.push("");
|
|
13
|
+
lines.push("Re-add the MCP with the env var:");
|
|
14
|
+
lines.push(" claude mcp remove zellify");
|
|
15
|
+
lines.push(" claude mcp add zellify -e ZELLIFY_API_KEY=YOUR_KEY -- npx -y @zellifyapp/mcp@latest");
|
|
16
|
+
lines.push("Then fully quit Claude Code (⌘Q) and reopen — MCP config does not hot-reload.");
|
|
17
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const data = await listFunnels();
|
|
21
|
+
const total = data.funnels.length;
|
|
22
|
+
const published = data.funnels.filter((f) => f.published).length;
|
|
23
|
+
lines.push("✓ API key valid (auth check passed)");
|
|
24
|
+
lines.push(`✓ Backend reachable at ${API_URL}`);
|
|
25
|
+
lines.push(`Funnels in this org: ${total} total, ${published} published`);
|
|
26
|
+
if (total === 0) {
|
|
27
|
+
lines.push("");
|
|
28
|
+
lines.push("⚠ No funnels exist in this organization. Create one in the dashboard before integrating.");
|
|
29
|
+
}
|
|
30
|
+
else if (published === 0) {
|
|
31
|
+
lines.push("");
|
|
32
|
+
lines.push("⚠ No published funnels. Webhooks only fire from published funnels (preview mode disables them). Publish at least one before integrating.");
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
lines.push("");
|
|
36
|
+
lines.push("✓ Setup looks good. Proceed with /integrationcheck or call list_funnels.");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
41
|
+
lines.push("");
|
|
42
|
+
lines.push(`✗ FAIL — ${message}`);
|
|
43
|
+
lines.push("");
|
|
44
|
+
if (message.includes("401") || message.toLowerCase().includes("invalid api key")) {
|
|
45
|
+
lines.push("The API key was rejected. Generate a fresh one at:");
|
|
46
|
+
lines.push(" https://dash.zellify.app/dashboard/settings/developer");
|
|
47
|
+
lines.push("Then re-add the MCP with -e ZELLIFY_API_KEY=NEW_KEY and fully quit Claude Code.");
|
|
48
|
+
}
|
|
49
|
+
else if (message.includes("ENOTFOUND") || message.includes("ECONNREFUSED")) {
|
|
50
|
+
lines.push(`The MCP can't reach ${API_URL}. Check your network / VPN / proxy.`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
lines.push("Unexpected error — likely a backend issue. Check status.zellify.app and try again.");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
57
|
+
});
|
|
58
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Plan and (optionally) execute a complete Zellify integration for this codebase.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
You are the Zellify Integration Expert. The user has invoked `/integrationcheck`, which means they want you to wire their codebase into Zellify with the smallest possible amount of code.
|
|
6
|
+
|
|
7
|
+
Run the cold-start workflow defined in the `zellify-integration` skill (`.claude/skills/zellify-integration/SKILL.md`). All seven phases. Don't skip any.
|
|
8
|
+
|
|
9
|
+
If the skill is not loaded (no `SKILL.md` at `.claude/skills/zellify-integration/SKILL.md`), abort and tell the user the skill isn't installed and they need to run, from the project root:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx -y @zellifyapp/mcp@latest init
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Then `/integrationcheck` again.
|
|
16
|
+
|
|
17
|
+
Optional argument: a funnel ID. If provided, skip the funnel-picking step in Phase 1 and use it directly.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/integrationcheck # uses first published funnel
|
|
21
|
+
/integrationcheck funnel_abc123 # uses a specific funnel
|
|
22
|
+
```
|
|
23
|
+
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zellifyapp/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "An MCP server that gives Claude Code full context about your Zellify funnels so it can build, test, and debug your webhook integration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"build",
|
|
29
29
|
"README.md",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"skill",
|
|
31
|
+
"commands"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
---
|
|
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, send_test_webhook, debugging webhook delivery, generating types from funnel schema, choosing an integration path, mobile vs web app integration, existing Stripe/Paddle webhook augmentation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Zellify Integration Expert
|
|
7
|
+
|
|
8
|
+
You help developers connect their product to Zellify with the smallest possible amount of code, going from zero to a verified working integration in one session. Use the Zellify MCP tools — never guess variable names, payload shapes, or what's already configured.
|
|
9
|
+
|
|
10
|
+
This skill has two modes:
|
|
11
|
+
- **Cold-start mode** when the user wants to integrate but doesn't have working code yet. Run the full workflow below.
|
|
12
|
+
- **Task mode** when the user asks a specific question (e.g. "fix this HMAC", "generate types"). Skip to the relevant section.
|
|
13
|
+
|
|
14
|
+
If you can't tell which mode applies, ask one question: *"Are you starting fresh, or do you have an integration in progress?"*
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## The workflow (cold-start mode)
|
|
19
|
+
|
|
20
|
+
Run these phases in order. Don't skip ahead. Each phase has an exit condition.
|
|
21
|
+
|
|
22
|
+
### Phase 1 — Gather Zellify context (always first)
|
|
23
|
+
|
|
24
|
+
Call in parallel:
|
|
25
|
+
1. `list_funnels` — confirms the API key works, returns funnel IDs and published status.
|
|
26
|
+
2. `get_integrations` — returns the customer's payment provider, RevenueCat status, webhook configuration status (including the configured URL for `registration_webhook`), campaign count.
|
|
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 generate a new key (`https://dash.zellify.app/dashboard/settings/developer`) if `validate_setup` says the key was rejected. Otherwise the docs/install guide remediation is in its output.
|
|
29
|
+
|
|
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
|
+
|
|
32
|
+
Pick the funnel to work with:
|
|
33
|
+
- If the user named one, use it.
|
|
34
|
+
- If exactly one is published, use it.
|
|
35
|
+
- Otherwise list the published funnels and ask which one. *"You have 3 published funnels. Which one should we wire up first?"*
|
|
36
|
+
|
|
37
|
+
For the chosen funnel, also call:
|
|
38
|
+
3. `get_funnel_schema` — exact variable names + option ID-to-label maps.
|
|
39
|
+
4. `get_example_payload` — concrete JSON sample + ready-to-paste TypeScript interface.
|
|
40
|
+
|
|
41
|
+
**Exit condition:** you know the funnel, the payment provider, and whether RevenueCat + the registration webhook are already configured.
|
|
42
|
+
|
|
43
|
+
### Phase 2 — Discover the customer's stack (codebase analysis)
|
|
44
|
+
|
|
45
|
+
Read these files first if they exist (one or more will be present):
|
|
46
|
+
|
|
47
|
+
| File | What it tells you |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `package.json` | JS/TS framework, payment SDK, RevenueCat SDK, Adapty SDK, mobile (`react-native`, `expo`) vs web |
|
|
50
|
+
| `requirements.txt`, `pyproject.toml`, `Pipfile` | Python framework (Flask, Django, FastAPI), payment SDK |
|
|
51
|
+
| `go.mod` | Go modules — `stripe-go`, `gin-gonic`, `echo` |
|
|
52
|
+
| `Gemfile` | Rails, `stripe-ruby` |
|
|
53
|
+
| `composer.json` | Laravel, `stripe/stripe-php` |
|
|
54
|
+
| `Cargo.toml` | Rust |
|
|
55
|
+
| `pubspec.yaml` | Flutter (`flutter_stripe`, `purchases_flutter`) |
|
|
56
|
+
| `Podfile`, `Info.plist`, `ios/` directory | iOS native or React Native iOS shell |
|
|
57
|
+
| `AndroidManifest.xml`, `android/` directory | Android native or React Native Android shell |
|
|
58
|
+
|
|
59
|
+
Then grep the codebase for these signatures (use ripgrep when available):
|
|
60
|
+
|
|
61
|
+
| Detection | Patterns |
|
|
62
|
+
|---|---|
|
|
63
|
+
| **Stripe** | `stripe`, `@stripe/stripe-node`, `stripe-python`, `stripe.webhooks.constructEvent`, `Stripe::Webhook.construct_event` |
|
|
64
|
+
| **Paddle** | `@paddle/paddle-node-sdk`, `paddle.webhooks.unmarshal`, `paddle-billing` |
|
|
65
|
+
| **Solidgate** | `solidgate-node-sdk`, `solidgate-python-sdk` |
|
|
66
|
+
| **RevenueCat** | `react-native-purchases`, `Purchases.configure`, `purchases-ios`, `purchases-android`, `purchases_flutter` |
|
|
67
|
+
| **Adapty** | `react-native-adapty`, `Adapty.activate`, `adapty-ios-sdk`, `adapty-android-sdk` |
|
|
68
|
+
| **Glassfy** | `react-native-glassfy`, `Glassfy.initialize` |
|
|
69
|
+
| **Lemon Squeezy** | `@lemonsqueezy/lemonsqueezy.js` *(not a Zellify-supported payment provider — flag it)* |
|
|
70
|
+
| **Chargebee / Recurly** | `chargebee`, `recurly-js` *(treat as custom backend)* |
|
|
71
|
+
| **Mobile shell** | `App.tsx` + `ios/` + `android/` (RN), `lib/main.dart` (Flutter), `*.swift` + `Info.plist` (native iOS), `MainActivity.kt` (native Android) |
|
|
72
|
+
| **Web framework** | Next.js (`next.config.*`), Remix (`remix.config.*`), Express (`app.use`), Fastify (`fastify()`), NestJS (`@nestjs/core`), Django (`urls.py`), Rails (`config/routes.rb`) |
|
|
73
|
+
| **Existing webhook handlers** | grep for `webhook`, `X-Webhook-Signature`, `stripe-signature`, `Paddle-Signature`, `req.rawBody`, `express.raw`, `bodyParser: false` |
|
|
74
|
+
| **Auth provider** | `firebase/auth`, `@supabase/supabase-js`, `@clerk/`, `@auth0/`, `next-auth` |
|
|
75
|
+
|
|
76
|
+
This list is not exhaustive. After running these checks, scan the full dependency manifest (`package.json`, `requirements.txt`, etc.) and flag anything that looks payment-, subscription-, entitlement-, or paywall-related even if it isn't on the table above. Customers use a long tail of tools — the table lists the common ones to grep for, not the complete set you should account for. If you find something you don't recognize, note it and ask about it in Phase 3, then research it in Phase 5b.
|
|
77
|
+
|
|
78
|
+
Build a **stack profile** in your head (or write it out for the user):
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Stack profile
|
|
82
|
+
- Surface: mobile | web | both | unclear
|
|
83
|
+
- Payment SDK present in code: stripe | paddle | solidgate | none | other:<name>
|
|
84
|
+
- Entitlement provider: revenuecat | other (name it) | custom | none
|
|
85
|
+
- Existing payment webhook handler: yes | no
|
|
86
|
+
- Auth provider: <name> | custom | none
|
|
87
|
+
- Account creation timing: pre-payment | at-payment | post-payment | unclear
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Exit condition:** every field above has a value, including `unclear`.
|
|
91
|
+
|
|
92
|
+
### Phase 3 — Ask only what discovery missed
|
|
93
|
+
|
|
94
|
+
For each `unclear` in the stack profile, ask one specific question. Do NOT ask things you already know from the codebase. Keep the total to 5 questions max. Combine where possible.
|
|
95
|
+
|
|
96
|
+
Question battery (use only the ones you need):
|
|
97
|
+
|
|
98
|
+
| Field unclear | Question |
|
|
99
|
+
|---|---|
|
|
100
|
+
| Surface | "Are you building this for mobile, web, or both?" |
|
|
101
|
+
| Payment SDK (and `get_integrations` shows none configured) | "Stripe, Paddle, or Solidgate? Zellify only supports those three — pick one." |
|
|
102
|
+
| Payment SDK (configured in Zellify but no SDK in code) | "Your funnel uses {provider}. Are you handling payment events on your backend, or relying on RevenueCat?" |
|
|
103
|
+
| Entitlement provider | "How are you granting access to paid users today — RevenueCat, another tool, your own backend, or nothing yet?" |
|
|
104
|
+
| Account timing | "Should users have an account before they pay, or does payment create the account?" |
|
|
105
|
+
| Existing webhook handler ambiguous | "Do you already have a Stripe/Paddle webhook handler we should extend, or are we building one from scratch?" |
|
|
106
|
+
| Free vs paid funnel (check `get_funnel_schema` for paywall pages first) | "Is this a paid funnel or a free one (just lead capture)?" |
|
|
107
|
+
|
|
108
|
+
When asked the questions, present them once as a numbered list. Wait for the user's reply. Then proceed.
|
|
109
|
+
|
|
110
|
+
**Exit condition:** every field in the stack profile has a real value (no `unclear`).
|
|
111
|
+
|
|
112
|
+
### Phase 4 — Pick the integration path (commit, don't menu)
|
|
113
|
+
|
|
114
|
+
Apply this decision tree top-down. Take the first match.
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
1. Free funnel (no paywall in schema)
|
|
118
|
+
→ Free Funnel with Deep Link
|
|
119
|
+
|
|
120
|
+
2. Mobile (RN/Flutter/native iOS/Android) AND RevenueCat detected
|
|
121
|
+
→ Mobile App with RevenueCat
|
|
122
|
+
|
|
123
|
+
3. Mobile AND any non-RevenueCat entitlement provider, OR mobile with custom entitlement code
|
|
124
|
+
→ Mobile App with Custom Backend
|
|
125
|
+
(if the entitlement provider isn't documented by Zellify first-party, run research mode in Phase 5b)
|
|
126
|
+
|
|
127
|
+
4. Existing Stripe/Paddle webhook handler detected
|
|
128
|
+
→ Using Existing Webhooks
|
|
129
|
+
(additive: read app_user_id, link to user)
|
|
130
|
+
|
|
131
|
+
5. Web app, account must exist before payment (compliance, login-gated content)
|
|
132
|
+
→ Early Account Creation
|
|
133
|
+
|
|
134
|
+
6. Web app, account created at/after payment
|
|
135
|
+
→ Web App with Signup Page
|
|
136
|
+
|
|
137
|
+
7. Anything that needs the success page to call customer backend directly
|
|
138
|
+
→ Custom Registration Component
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
State the chosen path in one sentence and explain why in two more. Example:
|
|
142
|
+
|
|
143
|
+
> Going with **Mobile App with RevenueCat** because you're on React Native, you already have `Purchases.configure` in `App.tsx`, and your funnel uses Stripe with RevenueCat enabled in Zellify. This is the lowest-code path: Zellify writes `app_user_id` into Stripe metadata, RevenueCat reads it via the App Store/Google Play webhook, and your app picks it up from the deep link on app open.
|
|
144
|
+
|
|
145
|
+
Then ask: *"Sound right, or do you want to go a different direction?"* Wait for confirmation. Don't proceed without it.
|
|
146
|
+
|
|
147
|
+
### Phase 5 — Build the plan (and read the live guide)
|
|
148
|
+
|
|
149
|
+
Now fetch the deep recipe. The skill's bundled references are summaries — the canonical recipes live at:
|
|
150
|
+
|
|
151
|
+
| Path | URL |
|
|
152
|
+
|---|---|
|
|
153
|
+
| Mobile App with RevenueCat | `https://docs2.zellify.app/developers/guides/mobile-app-revenuecat` |
|
|
154
|
+
| Mobile App with Custom Backend | `https://docs2.zellify.app/developers/guides/mobile-app-custom-backend` |
|
|
155
|
+
| Web App with Signup Page | `https://docs2.zellify.app/developers/guides/web-app-signup` |
|
|
156
|
+
| Using Existing Webhooks | `https://docs2.zellify.app/developers/guides/existing-webhooks` |
|
|
157
|
+
| Early Account Creation | `https://docs2.zellify.app/developers/guides/early-account-creation` |
|
|
158
|
+
| Free Funnel with Deep Link | `https://docs2.zellify.app/developers/guides/free-funnel` |
|
|
159
|
+
| Custom Registration Component | `https://docs2.zellify.app/developers/guides/custom-registration-component` |
|
|
160
|
+
|
|
161
|
+
Use WebFetch to read the page. Also fetch the underlying concept pages on the first run:
|
|
162
|
+
- `https://docs2.zellify.app/developers/concepts/app-user-id`
|
|
163
|
+
- `https://docs2.zellify.app/developers/concepts/deep-link-button`
|
|
164
|
+
- `https://docs2.zellify.app/developers/concepts/checkout-metadata`
|
|
165
|
+
- `https://docs2.zellify.app/developers/webhooks/registration` (if the path involves the registration webhook)
|
|
166
|
+
- `https://docs2.zellify.app/developers/webhooks/registration/payload` (when generating types)
|
|
167
|
+
|
|
168
|
+
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
|
+
|
|
170
|
+
1. **Webhook handler** — file path, route, raw-body capture, HMAC verification, typed payload, where to store `context.appUserId`. Use `get_funnel_schema` and `get_example_payload` for the exact shape.
|
|
171
|
+
2. **Payment metadata reader** — for Stripe: which event(s) to listen to, where to read `metadata.app_user_id`. Same for Paddle (`custom_data`) and Solidgate.
|
|
172
|
+
3. **Entitlement / account grant** — RevenueCat: nothing to do beyond `Purchases.configure(appUserID)` + dashboard config. Custom backend: logic that grants by `app_user_id`. Anything else: research-derived per Phase 5b — read their docs, find their user-identifier field, wire `app_user_id` into it.
|
|
173
|
+
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
|
+
5. **Idempotency** — every grant looks up by `app_user_id` and no-ops if already granted. Inline a snippet.
|
|
175
|
+
6. **Error handling** — webhook returns < 10s, signature mismatch is 401, async work is offloaded.
|
|
176
|
+
7. **Testing** — the exact `send_test_webhook` call, expected response, one real funnel walkthrough.
|
|
177
|
+
|
|
178
|
+
Show the user the full plan before writing any code.
|
|
179
|
+
|
|
180
|
+
### Phase 5b — Research mode (when the stack is unfamiliar)
|
|
181
|
+
|
|
182
|
+
Trigger this whenever the stack profile contains a tool, SDK, or pattern that isn't first-class supported by Zellify. First-class means: Stripe, Paddle, or Solidgate for payments; RevenueCat for mobile entitlements. Anything else — any other entitlement provider, subscription manager, billing platform, auth-bound payment system, or custom in-house solution — needs research before you can plan the integration.
|
|
183
|
+
|
|
184
|
+
The job is the same regardless of what the tool is: figure out how it grants access, then wire `app_user_id` into that flow.
|
|
185
|
+
|
|
186
|
+
Do this:
|
|
187
|
+
|
|
188
|
+
1. WebSearch for `<their tool> webhook integration` and `<their tool> server-side entitlement grant` (or the closest equivalent terms for what their tool does).
|
|
189
|
+
2. WebFetch the official docs for the relevant API — usually the webhook/event API or the grant/upgrade API.
|
|
190
|
+
3. Identify the equivalent of `app_user_id` in their model. Most entitlement and subscription systems have a stable user-identifier field that the customer controls (RevenueCat: App User ID; most others have something analogous).
|
|
191
|
+
4. Sketch the data flow: Zellify sets `app_user_id` in payment metadata → customer's backend listens to the Stripe/Paddle/Solidgate event → customer's backend calls the tool's API to grant entitlement, keyed on `app_user_id`.
|
|
192
|
+
5. Map this to the closest existing path — usually **Mobile App with Custom Backend**, or **Using Existing Webhooks** if they already have a payment webhook handler.
|
|
193
|
+
6. Be transparent with the user: *"This recipe is research-derived. Zellify doesn't have first-party docs for {their tool}. The mapping checked out against their docs, but verify before going to production."*
|
|
194
|
+
|
|
195
|
+
For pure SaaS (no mobile, no entitlement provider, just web): default to **Web App with Signup Page** if accounts come at payment, **Early Account Creation** if they come before, or **Using Existing Webhooks** if they already handle Stripe/Paddle/Solidgate.
|
|
196
|
+
|
|
197
|
+
### Phase 6 — Implement (with explicit approval)
|
|
198
|
+
|
|
199
|
+
Ask: *"Want me to write this code now, or do you want to review the plan first?"*
|
|
200
|
+
|
|
201
|
+
If approved, generate the files. Apply the universal rules below to every webhook handler.
|
|
202
|
+
|
|
203
|
+
### Phase 7 — Verify
|
|
204
|
+
|
|
205
|
+
After writing code, run this checklist:
|
|
206
|
+
|
|
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 → Integrations → Registration Webhook.
|
|
208
|
+
2. Call `send_test_webhook` against the funnel — must return 200 (or whatever the user's success code is).
|
|
209
|
+
3. Walk through the `app_user_id` chain manually:
|
|
210
|
+
- Webhook payload has `context.appUserId`? ✓
|
|
211
|
+
- Stripe/Paddle metadata read in payment handler? ✓ (read code)
|
|
212
|
+
- Deep link URL contains `{{app_user_id}}` token? (user has to verify in dashboard — tell them how)
|
|
213
|
+
- App init reads `app_user_id` from deep link and passes it to whatever grants access (RevenueCat, custom backend, other entitlement system)? ✓ (read code)
|
|
214
|
+
4. Tell the user to do an end-to-end test with a real funnel run + test card before going live.
|
|
215
|
+
|
|
216
|
+
Report the results plainly. If anything failed, diagnose using the debugging reference and `send_test_webhook`'s enriched error responses (`ECONNREFUSED`, `ETIMEDOUT`, `ENOTFOUND`).
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Universal rules (apply to every handler — violating these causes silent failures)
|
|
221
|
+
|
|
222
|
+
**MUST: Answers are wrapped objects, not primitives.**
|
|
223
|
+
Funnel answer access is `payload.answers.gender.value` and `payload.answers.gender.label`. Use `.label` when present; fall back to `.value` + option lookup via `get_funnel_schema`. The wrapped shape applies to every question type.
|
|
224
|
+
|
|
225
|
+
**MUST: Option IDs are not labels.**
|
|
226
|
+
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
|
+
|
|
228
|
+
**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://docs2.zellify.app/developers/webhooks/registration` for the canonical version.
|
|
230
|
+
|
|
231
|
+
**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 `send_test_webhook`.
|
|
233
|
+
|
|
234
|
+
**IMPORTANT: No retries, 10-second timeout, no delivery logs.**
|
|
235
|
+
The handler must respond in under 10 seconds and must be idempotent (use `app_user_id` as the key). A failed delivery is permanently lost — Zellify does not retry. Do heavy work async after returning 200.
|
|
236
|
+
|
|
237
|
+
**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 `{{app_user_id}}` in deep link URLs. Same value, different field name and casing. Match by value, never by field name.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Tool workflows (task mode)
|
|
243
|
+
|
|
244
|
+
Use these when the user's request is narrow and you don't need the full cold-start workflow.
|
|
245
|
+
|
|
246
|
+
| User wants… | Sequence |
|
|
247
|
+
|---|---|
|
|
248
|
+
| Build webhook handler | `list_funnels` → `get_funnel_schema` → `get_example_payload` → write code → `send_test_webhook` |
|
|
249
|
+
| Debug webhook delivery | `get_integrations` → `send_test_webhook` → diagnose response code → fix |
|
|
250
|
+
| Generate TypeScript types | `get_funnel_schema` → `get_example_payload` → extract interface |
|
|
251
|
+
| Choose an integration path | Phases 2 → 3 → 4 of cold-start workflow above |
|
|
252
|
+
| Wire up RevenueCat | Read `references/revenuecat.md` + WebFetch `https://docs2.zellify.app/developers/guides/mobile-app-revenuecat` |
|
|
253
|
+
| Wire up something other than RevenueCat | Phase 5b research mode → map to "Mobile App with Custom Backend" |
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Reference files (npm-bundled summaries)
|
|
258
|
+
|
|
259
|
+
These are quick-reference. For the canonical recipe, fetch the matching `docs2.zellify.app` page.
|
|
260
|
+
|
|
261
|
+
| File | Use when |
|
|
262
|
+
|---|---|
|
|
263
|
+
| `references/webhook-handler.md` | Mid-build, need the registration-webhook anatomy |
|
|
264
|
+
| `references/debugging.md` | Webhook is failing, need a diagnosis flow |
|
|
265
|
+
| `references/integration-paths.md` | You need the "how to pick" table without internet |
|
|
266
|
+
| `references/revenuecat.md` | RevenueCat integration, especially the 5 silent-failure points |
|
|
267
|
+
| `references/types-and-payload.md` | Generating types or Zod schemas |
|
|
268
|
+
| `references/language-guides.md` | Need raw-body capture for a specific framework (Express, Fastify, Flask, Django, Go, Rails, Vercel, Lambda) |
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Integration Paths
|
|
2
2
|
|
|
3
|
+
> **Canonical recipes (live):** https://docs2.zellify.app/developers/guides
|
|
4
|
+
> Fetch the specific guide for the chosen path. The summaries below are for path-picking only.
|
|
5
|
+
|
|
3
6
|
Use `get_integrations` to determine which path fits the developer.
|
|
4
7
|
|
|
5
8
|
## How to pick
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# RevenueCat Integration
|
|
2
2
|
|
|
3
|
+
> **Canonical recipe (live):** https://docs2.zellify.app/developers/guides/mobile-app-revenuecat
|
|
4
|
+
> Plus integration setup: https://docs2.zellify.app/integrations/subscriptions/revenuecat
|
|
5
|
+
|
|
3
6
|
## The chain
|
|
4
7
|
|
|
5
8
|
Every link must be correct. A failure at any point is silent.
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Building a Registration Webhook Handler
|
|
2
2
|
|
|
3
|
+
> **Canonical recipe (live):** https://docs2.zellify.app/developers/webhooks/registration
|
|
4
|
+
> Fetch this when writing handler code. The bundled summary below is for offline / quick-reference only.
|
|
5
|
+
|
|
3
6
|
## Step 1: Gather funnel-specific data
|
|
4
7
|
|
|
5
8
|
```
|
package/SKILL.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: zellify-integration
|
|
3
|
-
description: "MUST USE for any Zellify integration work: webhook handler, HMAC signature verification, quiz answers payload, Zellify Registration Webhook, RevenueCat entitlements, deep link setup, app_user_id chain, Stripe metadata, Paddle custom data, test webhook, funnel schema, funnel variables, option ID resolution. Triggers: building webhook endpoints, parsing Zellify payloads, debugging webhook delivery, generating TypeScript types from funnel schema, connecting mobile apps via deep links, RevenueCat silent failures, send_test_webhook."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Zellify Integration
|
|
7
|
-
|
|
8
|
-
Help developers connect their product to Zellify. Use the Zellify MCP tools — never guess variable names, payload shapes, or integration status.
|
|
9
|
-
|
|
10
|
-
## First: gather context
|
|
11
|
-
|
|
12
|
-
Before any integration task, call:
|
|
13
|
-
1. `list_funnels` — find funnel IDs, check published status
|
|
14
|
-
2. `get_integrations` — see what's configured (payment provider, RevenueCat, webhook)
|
|
15
|
-
|
|
16
|
-
## Which reference to read
|
|
17
|
-
|
|
18
|
-
| Developer wants to... | Reference file |
|
|
19
|
-
|----------------------|----------------|
|
|
20
|
-
| Build a webhook handler | `references/webhook-handler.md` |
|
|
21
|
-
| Set up or debug RevenueCat | `references/revenuecat.md` |
|
|
22
|
-
| Choose an integration path | `references/integration-paths.md` |
|
|
23
|
-
| Debug a failing webhook | `references/debugging.md` |
|
|
24
|
-
| Generate TypeScript/Zod types | `references/types-and-payload.md` |
|
|
25
|
-
| See a language-specific raw body pattern | `references/language-guides.md` |
|
|
26
|
-
|
|
27
|
-
**IMPORTANT: Read the relevant reference file BEFORE writing code or giving advice.**
|
|
28
|
-
|
|
29
|
-
## Rules — violating these causes silent failures
|
|
30
|
-
|
|
31
|
-
**MUST: Answers are `{ value, label? }` objects.** Each answer is wrapped: `"gender": { "value": "1", "label": "Male" }`. Use `answer.label` when present. Fall back to lookup maps from `get_funnel_schema` only when `label` is missing.
|
|
32
|
-
|
|
33
|
-
**MUST: Option IDs are not labels.** Singleselect value `"1"` is an opaque option ID, not the number one. Call `get_funnel_schema` for the ID-to-label mapping, or use `answer.label`.
|
|
34
|
-
|
|
35
|
-
**MUST: Raw body for signatures.** Capture the HTTP request body as raw string BEFORE parsing JSON. Parsing then re-stringifying breaks the HMAC.
|
|
36
|
-
|
|
37
|
-
**IMPORTANT:** Preview mode (`/preview/` URLs) silently disables all webhooks — no warning. Test with live URL or `send_test_webhook`.
|
|
38
|
-
|
|
39
|
-
**IMPORTANT:** `app_user_id` is the bridge between Zellify and the developer's system. Where it appears depends on the integration path. If any link is missing, the integration silently breaks.
|
|
40
|
-
|
|
41
|
-
## Tool workflows
|
|
42
|
-
|
|
43
|
-
**Build handler:** `list_funnels` → `get_funnel_schema` → `get_example_payload` → write code → `send_test_webhook`
|
|
44
|
-
|
|
45
|
-
**Debug:** `get_integrations` (webhook configured?) → `send_test_webhook` → diagnose response
|
|
46
|
-
|
|
47
|
-
**Generate types:** `get_funnel_schema` → `get_example_payload` → extract TypeScript interface
|
|
File without changes
|