@channlize/skills 0.0.0-stage → 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/prompts.json ADDED
@@ -0,0 +1,113 @@
1
+ {
2
+ "$comment": "Copy-paste prompts for AI assistants. Placeholders: {{projectId}}, {{widgetKey}} (public values), and {{react}}, {{core}}, {{mcp}} (package versions below). Secrets are never filled in: prompts refer to env vars. Shown by `npx @channlize/skills prompts` and the dashboard's SDK & Integration → AI prompts tab.",
3
+ "versions": {
4
+ "react": "0.4.0",
5
+ "core": "0.4.0",
6
+ "mcp": "0.4.0"
7
+ },
8
+ "categories": {
9
+ "react": "React / Next.js",
10
+ "server": "Node / server",
11
+ "mcp": "MCP",
12
+ "connections": "Connections",
13
+ "support": "Support"
14
+ },
15
+ "prompts": [
16
+ {
17
+ "id": "nextjs-chat-widget",
18
+ "title": "Add the chat widget to my Next.js app",
19
+ "category": "react",
20
+ "frameworks": ["Next.js"],
21
+ "skills": ["channlize-react-widget"],
22
+ "prompt": "Add the Channlize live chat widget to this Next.js (App Router) app.\n\nUse @channlize/react@^{{react}}. If the channlize-react-widget skill is available, read it first and follow it.\n\n- Widget key (public): {{widgetKey}}\n- Project ID: {{projectId}}\n\nSteps:\n1. Install @channlize/react with this project's package manager.\n2. Put both values in .env.local as NEXT_PUBLIC_CHANNLIZE_WIDGET_KEY and NEXT_PUBLIC_CHANNLIZE_PROJECT_ID, and add the names (without values) to .env.example.\n3. Create a 'use client' component that renders <ChannlizeChat> with those values, our brand color as primaryColor, and a title and greeting that fit this product. Render it once from the root layout, which stays a server component.\n4. Only the public widget key (wk_…) may appear in client code. Never add a server key (ch_live_…).\n\nVerify: run the type-check and the build, start the dev server, and tell me which page to open to send a test message. Remind me to add my domains (including localhost) under Domains in the Channlize dashboard."
23
+ },
24
+ {
25
+ "id": "react-vite-chat-widget",
26
+ "title": "Add the chat widget to my React (Vite) app",
27
+ "category": "react",
28
+ "frameworks": ["React", "Vite"],
29
+ "skills": ["channlize-react-widget"],
30
+ "prompt": "Add the Channlize live chat widget to this React app built with Vite.\n\nUse @channlize/react@^{{react}}. If the channlize-react-widget skill is available, read it first and follow it.\n\n- Widget key (public): {{widgetKey}}\n- Project ID: {{projectId}}\n\nRead them from VITE_CHANNLIZE_WIDGET_KEY and VITE_CHANNLIZE_PROJECT_ID (import.meta.env), and render <ChannlizeChat> once at the app root with our brand color as primaryColor and theme=\"auto\". Only the public widget key (wk_…) may be in the bundle, never a server key.\n\nVerify: run the type-check and the build, then start the dev server and tell me how to send a test message that should appear in Slack."
31
+ },
32
+ {
33
+ "id": "contact-form-page",
34
+ "title": "Add a contact form page",
35
+ "category": "react",
36
+ "frameworks": ["Next.js", "React"],
37
+ "skills": ["channlize-react-widget"],
38
+ "prompt": "Add a /contact page with the Channlize contact form, matching this app's design.\n\nUse @channlize/react@^{{react}}. If the channlize-react-widget skill is available, read it first and follow it.\n\n- Widget key (public): {{widgetKey}}\n- Project ID: {{projectId}}\n\nRequirements:\n- In Next.js, keep the page a server component and put <ChannlizeProvider> + <ContactForm> in a 'use client' component. ContactForm must be inside ChannlizeProvider.\n- Topics: Sales, Support, Billing. Prefill the topic from a ?topic= query parameter with defaultValues.\n- Company field optional. theme=\"auto\" and our brand color as primaryColor.\n- Show a success state, and link the page from the footer or navigation.\n- Only the public widget key in client code.\n\nVerify: run the type-check and the build, then submit the form once locally and confirm the onSuccess callback receives a conversationId."
39
+ },
40
+ {
41
+ "id": "notify-signup",
42
+ "title": "Send a Slack notification when a user signs up, subscribes or pays",
43
+ "category": "server",
44
+ "frameworks": ["Node.js", "Next.js"],
45
+ "skills": ["channlize-notify-events"],
46
+ "prompt": "Post a Slack message through Channlize Events when a user signs up, starts a subscription, or pays an invoice in this app.\n\nUse createNotifier from @channlize/core@^{{core}} on the server only. If the channlize-notify-events skill is available, read it first and follow it.\n\n- Project ID: {{projectId}}\n- The server key is in the CHANNLIZE_SERVER_API_KEY env var. I will set it myself; don't ask me to paste it, and never put it in client code or a NEXT_PUBLIC_/VITE_ variable.\n\nSteps:\n1. Find where signups, subscriptions and payments are completed (after the database write or the payment provider's webhook).\n2. Create one typed notifier module: createNotifier<AppEvents>() with the keys user.signed_up, subscription.started and invoice.paid and the data each message needs (no secrets or card data).\n3. Call it after the action succeeds, with an idempotencyKey derived from the user, subscription or invoice ID. Catch and log errors so a Slack failure never breaks the request.\n4. Add CHANNLIZE_SERVER_API_KEY and CHANNLIZE_PROJECT_ID={{projectId}} to .env.example (no secret values).\n\nVerify: run the type-check and tests, and add a test or a script that calls notify once and prints res.status. Then tell me that each new key starts as a disabled draft (status 'skipped') that I must configure and enable under Events in the dashboard."
47
+ },
48
+ {
49
+ "id": "track-errors",
50
+ "title": "Track errors as logs",
51
+ "category": "server",
52
+ "frameworks": ["React", "Node.js"],
53
+ "skills": ["channlize-log-tracking"],
54
+ "prompt": "Send this app's errors to Channlize log tracking.\n\nUse @channlize/core@^{{core}} (or useChannlizeAnalytics from @channlize/react@^{{react}} in React). If the channlize-log-tracking skill is available, read it first and follow it.\n\n- Project ID: {{projectId}}\n- Browser: the public widget key {{widgetKey}} with trackEvent.\n- Server: trackServerEvent with the server key from the CHANNLIZE_SERVER_API_KEY env var (I'll set it; never expose it to the browser).\n\nReport each error once from a central place (an error boundary or window error/unhandledrejection handlers in the browser, the error middleware on the server) with severity 'error', a stable dotted name such as app.error or api.error, and small properties (route, error name, message; no tokens or personal data). Tracking must never throw into the app.\n\nVerify: run the type-check and tests, then trigger one test error and tell me to check /logs in the dashboard, filtered by severity error."
55
+ },
56
+ {
57
+ "id": "connect-stripe",
58
+ "title": "Connect Stripe webhooks to Channlize",
59
+ "category": "connections",
60
+ "frameworks": ["Stripe"],
61
+ "skills": ["channlize-connections"],
62
+ "prompt": "Help me connect Stripe to Channlize Connections, so failed payments, disputes, new subscriptions and cancellations post to Slack.\n\nIf the channlize-connections skill is available, read it and its references/presets.md first.\n\nThis is a dashboard setup, not code. Walk me through it step by step:\n1. Create the Stripe connection in the Channlize dashboard (Connections → New connection → Stripe) for project {{projectId}}.\n2. Add the event destination in Stripe with exactly the events the Setup tab lists.\n3. Paste the destination's signing secret (whsec_…) into the Setup tab. I will copy it myself; never ask me to paste secrets here.\n4. Explain that test mode needs its own connection.\n5. Map each event type to a Slack channel on the Events tab.\n\nVerify: tell me how to send a test event from Stripe and where to confirm it (the connection's Request log, then Slack)."
63
+ },
64
+ {
65
+ "id": "connect-github-sentry",
66
+ "title": "Connect GitHub and Sentry webhooks",
67
+ "category": "connections",
68
+ "frameworks": ["GitHub", "Sentry"],
69
+ "skills": ["channlize-connections"],
70
+ "prompt": "Help me connect GitHub (issues, pull requests, releases) and Sentry (new issues and alerts) to Channlize Connections for project {{projectId}}.\n\nIf the channlize-connections skill is available, read it and its references/presets.md first.\n\nFor each provider, give me the exact clicks: create the connection, where to paste the URL, which events to select, and which secret goes where (GitHub: a secret generated in the Setup tab; Sentry: the Internal Integration's Client Secret). I paste secrets myself, so never ask for them in the chat.\n\nVerify: GitHub's ping and Sentry's test notification should appear in each connection's Request log. Then help me pick Slack channels for the event types."
71
+ },
72
+ {
73
+ "id": "custom-webhook",
74
+ "title": "Send my own events to a Channlize connection",
75
+ "category": "connections",
76
+ "frameworks": ["Node.js", "Zapier", "n8n"],
77
+ "skills": ["channlize-connections"],
78
+ "prompt": "I want this code to send its own events to Channlize through a \"Zapier, Make & n8n\" connection (the automation contract), not through the SDK.\n\nIf the channlize-connections skill is available, read it and references/automation-contract.md first. The JSON Schema is at https://api.channlize.com/api/in/schema.json.\n\n- The connection URL and secret are in the CHANNLIZE_CONNECTION_URL and CHANNLIZE_CONNECTION_SECRET env vars (server only; I'll set them).\n- Write a small typed helper that POSTs { type, event, message, title?, fields?, url?, customer?, idempotencyKey } with Authorization: Bearer <secret>, and use it where the events happen.\n- Use a stable idempotencyKey, handle 400 INVALID_PAYLOAD by logging the issues, and treat status \"ignored\" as \"switch the event on in the dashboard\".\n\nVerify: add a test with a mocked fetch that checks the payload against the schema's required fields, and give me a curl command to send one real test event."
79
+ },
80
+ {
81
+ "id": "migrate-intercom-crisp",
82
+ "title": "Migrate from the Intercom or Crisp widget",
83
+ "category": "react",
84
+ "frameworks": ["Next.js", "React"],
85
+ "skills": ["channlize-react-widget", "channlize-notify-events"],
86
+ "prompt": "Replace the Intercom or Crisp chat widget in this app with Channlize.\n\nUse @channlize/react@^{{react}}. If the channlize-react-widget skill is available, read it first.\n\n- Widget key (public): {{widgetKey}}\n- Project ID: {{projectId}}\n\nSteps:\n1. Find every Intercom or Crisp integration: script tags, npm packages, boot/identify/update calls, show/hide/open calls, and CSP entries.\n2. Remove them, and add <ChannlizeChat> once in a 'use client' component rendered from the root layout. Match the old launcher position and brand color.\n3. Point buttons that opened the old messenger (\"Chat with us\") at the new widget: control it with defaultOpen, or render SupportChat inline where that fits better.\n4. List what has no direct equivalent (product tours, help-center articles, user identification) and suggest options. For \"user did X\" notifications, suggest server-side notify() from @channlize/core@^{{core}} (see the channlize-notify-events skill), with the server key only in CHANNLIZE_SERVER_API_KEY on the server.\n\nVerify: run the type-check and the build, grep that no intercom or crisp references remain, and give me a test plan for sending a message and replying from Slack."
87
+ },
88
+ {
89
+ "id": "mcp-triage",
90
+ "title": "Set up the MCP server and triage my inbox",
91
+ "category": "mcp",
92
+ "frameworks": ["Claude Code", "Cursor", "VS Code"],
93
+ "skills": ["channlize-mcp-setup", "channlize-support-triage"],
94
+ "prompt": "Set up the Channlize MCP server (@channlize/mcp@^{{mcp}}) in this AI client, then triage my support inbox.\n\nIf the channlize-mcp-setup and channlize-support-triage skills are available, read them first.\n\n1. Give me the exact config for this client with CHANNLIZE_PROJECT_ID={{projectId}} and a placeholder for CHANNLIZE_SERVER_API_KEY. I will paste a read-scope server key myself; never ask me for it in the chat or write it to a committed file.\n2. After I restart, call get_project to verify the connection and show the key's permissions.\n3. Then list the open conversations, read the important ones, and give me a table ranked by urgency with a one-line summary, waiting time and next step for each.\n4. Draft replies only when I ask. Never call a write tool (notify_event, create_conversation, create_contact, track_log) without showing me what it will send and getting my explicit yes."
95
+ },
96
+ {
97
+ "id": "routing-rule-billing",
98
+ "title": "Write a routing rule for billing questions",
99
+ "category": "support",
100
+ "frameworks": ["Dashboard"],
101
+ "skills": ["channlize-troubleshooting"],
102
+ "prompt": "Help me design a Channlize routing rule that sends billing questions to our #billing Slack channel. If the channlize-troubleshooting skill is available, read its \"Nothing reaches Slack\" section first.\n\nContext: routing rules live under Channels & Routing in the dashboard (project {{projectId}}). A rule has conditions (match all or any) on fields such as source, page_url, page_domain, customer_email, customer_email_domain, message, subject, tags, priority and language, with the operators equals, not_equals, contains, not_contains, starts_with, ends_with and matches (* and ? wildcards). Values can be lists, comparisons ignore case, active rules run from the highest priority number down, and the first match wins.\n\nPropose:\n1. The conditions (for example: message or subject contains invoice, refund, charge, billing, receipt, payment, or page_url contains /billing), with match \"any\".\n2. A priority relative to my other rules, and whether to auto-assign someone.\n3. Three example messages that should match and two that should not.\n\nRemind me to /invite @Channlize in #billing. Verify: tell me how to test it with a contact form message that contains \"refund\"."
103
+ },
104
+ {
105
+ "id": "audit-integration",
106
+ "title": "Audit my Channlize integration",
107
+ "category": "support",
108
+ "frameworks": ["React", "Node.js", "Next.js"],
109
+ "skills": ["channlize-troubleshooting", "channlize-react-widget", "channlize-notify-events"],
110
+ "prompt": "Audit this codebase's Channlize integration. Don't change anything yet: report first.\n\nIf the channlize-troubleshooting skill is available, read it and use its audit checklist; use the channlize-react-widget and channlize-notify-events skills as the reference for correct usage. Current versions are @channlize/react {{react}}, @channlize/core {{core}} and @channlize/mcp {{mcp}}.\n\n- The expected project ID is {{projectId}} and the expected public widget key is {{widgetKey}}.\n- Check: package versions, that no server key (ch_live_…) appears in client code, bundles, committed files or NEXT_PUBLIC_/VITE_ variables, that the widget uses the widget key and matching project, that 'use client' and the ChannlizeProvider placement are correct, that notify() runs only on the server after the action succeeds with stable idempotency keys and caught errors, and that env vars are documented in .env.example.\n- List every event key passed to notify() so I can check that each is enabled under Events in the dashboard.\n\nOutput a table of check, status (OK / problem / unknown), file:line and the suggested fix. Verify: for each problem, propose the fix and the check that proves it (a command, a test, or a message that should reach Slack)."
111
+ }
112
+ ]
113
+ }
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: channlize-connections
3
+ description: Wires a third-party webhook into Channlize Connections (Stripe, GitHub, Sentry, Vercel, Netlify, Resend, Postmark, SendGrid, Mailgun, Twilio SMS/WhatsApp, Telegram, Discord, Calendly, Cal.com, Zapier/Make/n8n, or Custom JSON), so its events become Slack alerts, conversations or logs. Use when the user wants to connect a provider's webhooks to Channlize, asks where to find a signing secret, or wants to POST their own JSON to a connection URL using the automation contract at https://api.channlize.com/api/in/schema.json.
4
+ license: MIT
5
+ ---
6
+
7
+ # Channlize Connections: provider webhooks into Slack
8
+
9
+ A **connection** is a unique URL, `https://api.channlize.com/api/in/<token>`, that you paste into another service's webhook settings. Each incoming event type maps to one action: **conversation** (answered from Slack), **alert** (a Slack message from a template), **log**, or **ignore**. Connections live at https://app.channlize.com/connections. Only owners and admins can manage them.
10
+
11
+ The URL is only an address. **Every delivery must pass the provider's signature or secret check**, and a connection without a secret rejects everything with a 401.
12
+
13
+ ## Checklist
14
+
15
+ 1. **Pick the preset.** Use a dedicated preset when one exists; see [references/presets.md](references/presets.md) for each preset's secret and where to find it. Use *Zapier, Make & n8n* for no-code tools or your own code, and *Custom JSON* only for a sender that signs with HMAC-SHA256 and has a fixed payload you map by path.
16
+ 2. **Create it**: Dashboard → **Connections** → **New connection** → the preset → name and project → **Create and get the URL**.
17
+ 3. **Register the URL** in the provider's webhook settings, and select only the events you need.
18
+ 4. **Paste the secret** into the connection's **Setup** tab, or generate one there and paste it into the provider. Some presets also take an optional API key or token for richer messages or two-way replies.
19
+ 5. **Test**: use the provider's "send test" or ping, or **Send a test event** in the Setup tab. The delivery appears in the **Request log** with its signature status.
20
+ 6. **Map events** on the **Events** tab: a type seen for the first time is saved as *Seen, not configured* (off). Choose the action, the Slack channel and the template, then switch it on.
21
+ 7. **Verify** that a real event reaches Slack, and that the Channlize bot is in that channel (`/invite @Channlize`).
22
+
23
+ ## Sending your own events (automation contract)
24
+
25
+ For code, scripts or Zapier, Make and n8n, create a *Zapier, Make & n8n* connection, **Generate** a secret in the Setup tab, and POST this shape. The JSON Schema is at https://api.channlize.com/api/in/schema.json.
26
+
27
+ ```bash
28
+ curl -X POST "$CHANNLIZE_CONNECTION_URL" \
29
+ -H "Authorization: Bearer $CHANNLIZE_CONNECTION_SECRET" \
30
+ -H "Content-Type: application/json" \
31
+ -d '{
32
+ "type": "alert",
33
+ "event": "typeform.submission",
34
+ "title": "New lead",
35
+ "message": "Ada wants a demo",
36
+ "fields": { "Plan": "Pro" },
37
+ "url": "https://admin.example.com/leads/42",
38
+ "customer": { "email": "ada@example.com", "name": "Ada" },
39
+ "idempotencyKey": "lead-42"
40
+ }'
41
+ ```
42
+
43
+ Details are in [references/automation-contract.md](references/automation-contract.md). The essentials:
44
+
45
+ - Required: `type` (`alert`, `conversation` or `log`; the action a *new* event starts with), `event` (the mapping key) and `message`.
46
+ - Auth: `Authorization: Bearer <secret>` or `X-Channlize-Secret: <secret>`, or `X-Channlize-Signature: sha256=<hex HMAC-SHA256 of the raw body>`.
47
+ - Dedupe: `idempotencyKey`, then the `Idempotency-Key` header, then a hash of the body within 10 minutes. A repeat answers `duplicate: true`.
48
+ - Response: 200 `{ ok, requestId, event, action, status, conversationId? }`. `status: "ignored"` means the event still has to be switched on. A 400 `INVALID_PAYLOAD` lists every problem with its path.
49
+
50
+ The connection URL and secret are credentials: keep them in server env vars or the automation tool's secret store, never in browser code or a public repo.
51
+
52
+ ## Connections, Events or Webhooks?
53
+
54
+ - **Connections**: another service calls Channlize (inbound).
55
+ - **Events** (`notify()`, the `channlize-notify-events` skill): your own backend posts to Slack through the SDK with a server key. Prefer it when you control the code.
56
+ - **Webhooks** (https://app.channlize.com/integration/webhooks): Channlize calls *your* endpoint (outbound).
57
+
58
+ ## Pitfalls
59
+
60
+ - **401 / signature failed** in the request log: wrong secret, a secret from the other mode (Stripe test and live mode have separate destinations and secrets, so use two connections), or a proxy that re-serializes the body. The signature is checked on the raw bytes.
61
+ - **Delivered but nothing in Slack**: the event type is *Seen, not configured*, the mapping is off, no channel is set, or the bot isn't in the channel.
62
+ - **413**: the body is over 128 KB (5 MB for the email presets).
63
+ - Rotating the URL in Settings invalidates the old one. Update the provider afterwards.
@@ -0,0 +1,51 @@
1
+ # Automation contract (Zapier, Make & n8n connections)
2
+
3
+ `POST <connection URL>` with `Content-Type: application/json`. JSON Schema: https://api.channlize.com/api/in/schema.json. Empty strings count as absent, because Zapier sends `""` for unmapped fields.
4
+
5
+ | Field | Type | Notes |
6
+ | --- | --- | --- |
7
+ | `type` | `"alert" \| "conversation" \| "log"` | **Required.** The action a new `event` starts with. Change it later on the Events tab |
8
+ | `event` | string, up to 150 characters | **Required.** The mapping key, such as `typeform.submission`. Letters, digits and `. _ : / -` |
9
+ | `message` | string, up to 10,000 characters | **Required.** The alert body, or the customer's first message |
10
+ | `title` | string, up to 300 characters | The alert headline, or the conversation subject |
11
+ | `fields` | object, up to 50 keys | Shown as Slack fields and available in templates as `{{Key}}` |
12
+ | `url` | URL | A link shown with the alert |
13
+ | `customer` | `{ email, name?, phone? }` | For conversations: finds or creates the customer by email |
14
+ | `priority` | `"low" \| "normal" \| "high" \| "urgent"` | Conversation priority |
15
+ | `tags` | string array, or a comma-separated string | Conversation tags |
16
+ | `channel` | Slack channel ID (`C…` or `G…`) | Overrides the event's channel. For a conversation it also skips routing rules |
17
+ | `idempotencyKey` | string | Dedupe key. Use the source record ID (a Typeform response token, an Airtable record ID, n8n's `$execution.id`) |
18
+
19
+ ## Auth (one of)
20
+
21
+ - `Authorization: Bearer <secret>`
22
+ - `X-Channlize-Secret: <secret>`
23
+ - `X-Channlize-Signature: sha256=<hex HMAC-SHA256 of the raw body, keyed by the secret>`
24
+
25
+ The secret has at least 24 characters (the dashboard generates 64 hex characters). The URL token alone never authenticates.
26
+
27
+ ## Responses
28
+
29
+ - **200** `{ ok: true, requestId, event, action, status, conversationId? }`. The delivery is processed before the answer, so a following automation step can use `conversationId`. `status: "ignored"` means the event is configured off.
30
+ - **200** with `duplicate: true`: a repeat. The first request's outcome is returned.
31
+ - **400** `{ ok: false, error: "INVALID_PAYLOAD", message, issues: [{ path, message }], schema }`.
32
+ - **401**: a missing or wrong secret.
33
+ - **422** `PROCESSING_FAILED`, for example no Slack channel. Fix it and retry: the dedupe key is freed.
34
+ - **202** `queued`: a transient error that Channlize retries.
35
+
36
+ ## Signing in Node.js
37
+
38
+ ```ts
39
+ import { createHmac } from 'node:crypto';
40
+
41
+ const body = JSON.stringify(payload);
42
+ const signature = 'sha256=' + createHmac('sha256', process.env.CHANNLIZE_CONNECTION_SECRET!).update(body).digest('hex');
43
+
44
+ await fetch(process.env.CHANNLIZE_CONNECTION_URL!, {
45
+ method: 'POST',
46
+ headers: { 'Content-Type': 'application/json', 'X-Channlize-Signature': signature },
47
+ body, // send exactly the bytes you signed
48
+ });
49
+ ```
50
+
51
+ Conversations created this way have the routing source `automation`. They get no auto-reply and no two-way replies.
@@ -0,0 +1,30 @@
1
+ # Connection presets: where each secret comes from
2
+
3
+ Create the connection first (Dashboard → **Connections** → **New connection**), copy its URL, and then follow the provider's row. "Setup tab" means the connection's Setup tab in Channlize.
4
+
5
+ | Preset | Register the URL in | Secret to paste into the Setup tab | Optional extras |
6
+ | --- | --- | --- | --- |
7
+ | **Stripe** | Developers → Webhooks (Workbench: Event destinations) → Add destination → *Your account*, *Snapshot* payload, the events the Setup tab lists → Webhook endpoint | The destination's **Signing secret** (`whsec_…`). Test mode has its own secret, so use a second connection | A restricted key (Customers and Products: Read) adds names, emails and plans |
8
+ | **GitHub** | Repo or org → Settings → Webhooks → Add webhook; content type `application/json`; events: Issues, Issue comments, Pull requests, Releases | **Generate** a secret in the Setup tab, save it, and paste the same value into GitHub's *Secret* | A fine-grained token (Issues: Read and write) for replying on GitHub |
9
+ | **Sentry** | Settings → Developer Settings → Custom Integrations → New **Internal Integration**: the Webhook URL, Alert Rule Action on, Issue & Event: Read, webhook `issue` | The integration's **Client Secret** | The integration **Token**, to match issues to customers; add the integration as an alert-rule action |
10
+ | **Vercel** | Team Settings → Webhooks → Create Webhook (Pro and Enterprise); `deployment.*` events (leave `deployment.ready` off) | The secret Vercel shows once | — |
11
+ | **Netlify** | Site configuration → Notifications → Deploy notifications → HTTP POST request, for Deploy started, succeeded and failed | **Generate** a secret in the Setup tab and use it as the **JWS secret token** | — |
12
+ | **Resend** | Webhooks → Add Endpoint; `email.received`, `email.bounced`, `email.complained`, `email.failed`, `email.delivered` | The endpoint's **Signing secret** (`whsec_…`) | A Full access API key (needed to read email bodies); *Reply by email* from a verified domain |
13
+ | **Postmark** | Servers → server → Default Inbound Stream → Settings → Webhook. For alerts: outbound stream → Webhooks (Bounce, Spam Complaint) | Click **Generate the URL**: it embeds a password, shown once | The Server API token, for replies |
14
+ | **SendGrid** | Settings → Inbound Parse → Add Host & URL (MX to `mx.sendgrid.net`). For alerts: Mail Settings → Event Webhooks, signed | **Generate the URL** (it ends in `?key=`); for events, the **Verification Key** | An API key with Mail Send |
15
+ | **Mailgun** | Receiving → Create route → Forward to the URL. For alerts: Sending → Webhooks | The **HTTP webhook signing key** (Settings → API Security) | An API key, region and sending domain |
16
+ | **Twilio SMS & WhatsApp** | Phone number → Messaging Configuration → *A message comes in* → Webhook (POST), or the WhatsApp sender's incoming URL | The account **Auth Token** (Console → Account info) | The Account SID and a sender, for replies by SMS or WhatsApp |
17
+ | **Telegram** | Nothing to paste in Telegram: Channlize registers the webhook | The bot's **HTTP API token** from @BotFather, then **Register webhook** | *Reply on Telegram* |
18
+ | **Discord** | Developer Portal → the app → General Information → **Interactions Endpoint URL** | The **Application ID** and **Public Key**, then the bot token (Bot → Reset Token), then **Register /support** | Invite the bot with the `bot` and `applications.commands` scopes |
19
+ | **Calendly** | Nothing: Channlize creates the subscription (paid Calendly plan) | A **Personal access token** (Integrations & apps → API and webhooks), then **Create subscription** | — |
20
+ | **Cal.com** | Settings → Developer → Webhooks → New; the booking triggers | **Generate** a secret in the Setup tab and paste it into Cal.com's *Secret* | — |
21
+ | **Zapier, Make & n8n** | The tool's HTTP or webhook action, POSTing the [automation contract](automation-contract.md) | **Generate** a secret, sent as `Authorization: Bearer <secret>` | — |
22
+ | **Custom JSON** | Any sender | An HMAC-SHA256 secret (hex, base64 or `sha256=<hex>` in a configurable header, default `x-channlize-signature`) or a shared secret | Dotted paths for the event type, delivery ID and conversation fields |
23
+
24
+ Default mappings (each can be changed on the Events tab):
25
+
26
+ - **Stripe**: failed payments and disputes become urgent alerts. New subscriptions, plan changes and cancellations become alerts, and renewals are logged.
27
+ - **Sentry**: `issue.created`, alert rules and critical metric alerts become alerts, one per issue per hour, for the levels you choose (`error` and `fatal` by default).
28
+ - **GitHub**: issues from people outside the organization, or labelled `bug`, become conversations or alerts. Releases and pull requests are alerts or logs.
29
+ - **Email presets**: an inbound email becomes a conversation, and bounces and complaints become alerts.
30
+ - **Twilio, Telegram, Discord**: incoming messages become conversations, with optional two-way replies.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: channlize-log-tracking
3
+ description: Records logs in Channlize log tracking with trackEvent (browser, widget key), trackServerEvent (server key), useChannlizeAnalytics (React) or POST /v1/events, with info / warning / error severity, so errors and key actions show at /logs and can alert Slack. Use when the user wants to track errors, log app activity, send client or server logs to Channlize, or mentions trackEvent, trackServerEvent or Log tracking.
4
+ license: MIT
5
+ metadata:
6
+ package: "@channlize/core@^0.4.0"
7
+ ---
8
+
9
+ # Channlize log tracking
10
+
11
+ Logs are searchable lines with a name, a severity (`info`, `warning` or `error`) and properties. They appear at https://app.channlize.com/logs. Slack alerts for matching logs (minimum severity, name prefixes) are set up on that page.
12
+
13
+ **Logs or Events?** Use **log tracking** for a stream of things to search later (errors, page views, failed jobs). Use **Events** (`notify()`, the `channlize-notify-events` skill) for one Slack message per business event (a signup, a payment).
14
+
15
+ ## Checklist
16
+
17
+ 1. **Pick the side.**
18
+ - **Browser**: a widget key (`wk_…`, public). The source is `client_sdk`.
19
+ - **Server**: a server key (`ch_live_…`, secret) and the project ID. The source is `server_api`.
20
+ 2. **Install**: `npm install @channlize/core`, or `@channlize/react` for React apps, which re-exports it.
21
+ 3. **Add the code** (below). Use stable, dotted names, such as `checkout.failed` or `job.import.error`, so alert prefixes work.
22
+ 4. **Verify**: trigger the code path once, then open https://app.channlize.com/logs and filter by name or severity.
23
+
24
+ ## Browser
25
+
26
+ ```ts
27
+ import { ChannlizeClient } from '@channlize/core';
28
+
29
+ const channlize = new ChannlizeClient({ apiKey: 'wk_…', projectId: '…' });
30
+
31
+ await channlize.trackEvent('checkout.failed', {
32
+ severity: 'error',
33
+ properties: { step: 'payment', code: err.code },
34
+ distinctId: user?.id, // optional: groups logs per user
35
+ });
36
+ // pageUrl and userAgent are filled from the browser when omitted.
37
+ ```
38
+
39
+ React, inside `<ChannlizeProvider>`:
40
+
41
+ ```tsx
42
+ 'use client';
43
+ import { useChannlizeAnalytics } from '@channlize/react';
44
+
45
+ export function BuyButton() {
46
+ const { track } = useChannlizeAnalytics();
47
+ return <button onClick={() => track('cta.clicked', { properties: { section: 'hero' } })}>Buy</button>;
48
+ }
49
+ ```
50
+
51
+ The project's rate limit applies to browser logs: a 429 means too many per minute.
52
+
53
+ ## Server
54
+
55
+ ```ts
56
+ import { ChannlizeClient } from '@channlize/core';
57
+
58
+ // apiKey (the public widget key) is required by the constructor.
59
+ export const channlize = new ChannlizeClient({
60
+ apiKey: process.env.CHANNLIZE_WIDGET_KEY!,
61
+ projectId: process.env.CHANNLIZE_PROJECT_ID!,
62
+ serverApiKey: process.env.CHANNLIZE_SERVER_API_KEY!, // ch_live_…, write scope
63
+ });
64
+
65
+ await channlize.trackServerEvent('job.import.error', {
66
+ severity: 'error',
67
+ properties: { jobId, message: String(err) },
68
+ });
69
+ ```
70
+
71
+ Without the SDK:
72
+
73
+ ```bash
74
+ curl -X POST https://api.channlize.com/v1/events \
75
+ -H "Authorization: Bearer $CHANNLIZE_SERVER_API_KEY" \
76
+ -H "Content-Type: application/json" \
77
+ -d '{"projectId":"'"$CHANNLIZE_PROJECT_ID"'","name":"job.import.error","severity":"error","properties":{"jobId":"42"}}'
78
+ ```
79
+
80
+ The name has 1 to 255 characters. `projectId` is the project UUID.
81
+
82
+ ## Tracking errors
83
+
84
+ - Report from **one** place, such as an error boundary, a global `window.onerror` / `unhandledrejection` handler, or the server's error middleware, rather than from every `catch`.
85
+ - Never let tracking throw into the app: `.catch(() => {})` on the returned promise.
86
+ - Keep properties small and free of secrets and personal data (no tokens, passwords or full request bodies).
87
+ - Deduplicate noisy loops: track once per error type and request, not once per retry.
88
+
89
+ ## Pitfalls
90
+
91
+ - `trackServerEvent` throws `serverApiKey is required` without `serverApiKey`. A `wk_…` key there gets a 401.
92
+ - Never ship the server key to the browser. For browser logs, `trackEvent` with the widget key is the right call.
93
+ - A 403 means the server key lacks the `write` scope.
94
+ - Logs don't post to Slack unless an alert rule matches on https://app.channlize.com/logs.
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: channlize-mcp-setup
3
+ description: Configures the Channlize MCP server (@channlize/mcp) in Claude Code, Claude Desktop, Cursor, VS Code (Copilot agent mode) or Windsurf, with a server API key and project ID, so the assistant can read conversations, contacts, logs and Events and send Events to Slack. Use when the user wants to connect Channlize to an AI assistant, add the Channlize MCP server, or fix an MCP server that lists no tools or fails with 401 or 403.
4
+ license: MIT
5
+ compatibility: Requires Node.js 20 or later (npx) on the machine that runs the AI client.
6
+ metadata:
7
+ package: "@channlize/mcp@^0.4.0"
8
+ ---
9
+
10
+ # Set up the Channlize MCP server
11
+
12
+ `@channlize/mcp` runs locally with `npx -y @channlize/mcp`, over stdio by default. It exposes 13 tools with a server key (5 more visitor-side tools with a widget key), 4 resources and 6 prompts.
13
+
14
+ ## Checklist
15
+
16
+ 1. **Check Node**: `node -v` must print 20 or later.
17
+ 2. **Create a server key** at https://app.channlize.com/integration/api-keys#server-keys:
18
+ - `read` scope to explore and triage (list and get conversations, contacts, logs, Event deliveries);
19
+ - `write` scope only if the assistant should post to Slack (`notify_event`, `track_log`, `create_conversation`, `create_contact`).
20
+ Use one key per client, so each can be revoked. **The user pastes the key into the config themselves. Never echo it, commit it, or ask for it in the chat.**
21
+ 3. **Get the project ID** from the same page (optional: the default is the organization's first project).
22
+ 4. **Add the server** to the client (below), then restart the client.
23
+ 5. **Verify**: ask "Use the Channlize get_project tool". It should return the project name, the key's permissions and the Slack status. In Claude Code, `claude mcp list` or `/mcp` shows the server as connected.
24
+
25
+ ## Claude Code
26
+
27
+ ```bash
28
+ claude mcp add channlize \
29
+ --env CHANNLIZE_SERVER_API_KEY=ch_live_… \
30
+ --env CHANNLIZE_PROJECT_ID=<project-id> \
31
+ -- npx -y @channlize/mcp
32
+ ```
33
+
34
+ Add `--scope user` for every project. `--scope project` writes `.mcp.json` to the repo, so with that scope keep the key out of the file: use `"CHANNLIZE_SERVER_API_KEY": "${CHANNLIZE_SERVER_API_KEY}"` and export the variable in the shell.
35
+
36
+ ## Claude Desktop, Cursor, Windsurf (`mcpServers` format)
37
+
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "channlize": {
42
+ "command": "npx",
43
+ "args": ["-y", "@channlize/mcp"],
44
+ "env": {
45
+ "CHANNLIZE_SERVER_API_KEY": "ch_live_…",
46
+ "CHANNLIZE_PROJECT_ID": "<project-id>"
47
+ }
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ | Client | File |
54
+ | --- | --- |
55
+ | Claude Desktop | macOS `~/Library/Application Support/Claude/claude_desktop_config.json`, Windows `%APPDATA%\Claude\claude_desktop_config.json` |
56
+ | Cursor | `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project) |
57
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
58
+
59
+ Merge the `channlize` entry into an existing `mcpServers` object; don't replace other servers. Add project-level files that hold a key to `.gitignore`.
60
+
61
+ ## VS Code (GitHub Copilot agent mode)
62
+
63
+ `.vscode/mcp.json`. VS Code prompts for the key once and stores it securely, so the file can be committed:
64
+
65
+ ```json
66
+ {
67
+ "inputs": [
68
+ { "type": "promptString", "id": "channlize-key", "description": "Channlize server API key (ch_live_…)", "password": true }
69
+ ],
70
+ "servers": {
71
+ "channlize": {
72
+ "type": "stdio",
73
+ "command": "npx",
74
+ "args": ["-y", "@channlize/mcp"],
75
+ "env": { "CHANNLIZE_SERVER_API_KEY": "${input:channlize-key}", "CHANNLIZE_PROJECT_ID": "<project-id>" }
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ ## Streamable HTTP (clients that connect by URL)
82
+
83
+ ```bash
84
+ CHANNLIZE_SERVER_API_KEY=ch_live_… npx -y @channlize/mcp --transport http --port 3333
85
+ # → http://127.0.0.1:3333/mcp (localhost only; anyone who reaches the port acts with the key)
86
+ ```
87
+
88
+ ## Settings
89
+
90
+ `CHANNLIZE_SERVER_API_KEY` (`ch_live_…`), `CHANNLIZE_WIDGET_KEY` (`wk_…`, optional, for the visitor tools), `CHANNLIZE_API_KEY` (either kind, detected by its prefix), `CHANNLIZE_PROJECT_ID`, `CHANNLIZE_BASE_URL` (default `https://api.channlize.com`) and `CHANNLIZE_TIMEOUT` (ms, default 10000). Each has a flag; `npx -y @channlize/mcp --help` lists them.
91
+
92
+ ## What it can do
93
+
94
+ - Tools: `get_project`, `get_analytics`, `list_conversations`, `get_conversation`, `create_conversation`, `list_contacts`, `get_contact`, `create_contact`, `notify_event`, `list_event_definitions`, `list_event_deliveries`, `query_logs` and `track_log`.
95
+ - Prompts: `triage-conversations`, `summarize-conversation`, `check-events`, `setup-events`, `setup-live-chat` and `integrate-contact-form`.
96
+ - Resources: `channlize://project` and `channlize://docs/{quick-start,react-components,events}`.
97
+ - It **cannot** reply to a conversation or change its status or priority. The team does that in Slack or the dashboard. For triage, use the `channlize-support-triage` skill.
98
+
99
+ ## Troubleshooting
100
+
101
+ | Symptom | Fix |
102
+ | --- | --- |
103
+ | No tools listed / "needs a server API key" | Set `CHANNLIZE_SERVER_API_KEY` in the client config and restart the client |
104
+ | "holds a widget key (wk_…)" | A widget key was given as the server key. Use `ch_live_…`; widget keys go in `CHANNLIZE_WIDGET_KEY` |
105
+ | 401 Invalid API key | Mistyped, revoked or expired. Create a new key |
106
+ | 403 lacks required permission | The tool needs the `write` scope |
107
+ | 404 Project not found | The project ID is not in the key's organization. Fix it or remove it |
108
+ | Server exits at once | Node is older than 20, or `npx` is not on the client's `PATH` (use the absolute path from `which npx`) |
109
+ | Changes ignored | Restart the client after editing its config file |
110
+
111
+ Debug with `npx @modelcontextprotocol/inspector npx -y @channlize/mcp`.
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: channlize-notify-events
3
+ description: Sends server-side Channlize Events to Slack with notify() / createNotifier() from @channlize/core (signups, subscriptions, payments, deploys), with typed event keys, idempotency keys and the CHANNLIZE_SERVER_API_KEY + CHANNLIZE_PROJECT_ID env vars. Use when the user wants a Slack message when something happens in their app, mentions notify, createNotifier, Events or /v1/notify, or asks to alert the team on a signup or payment.
4
+ license: MIT
5
+ metadata:
6
+ package: "@channlize/core@^0.4.0"
7
+ ---
8
+
9
+ # Channlize Events: notify Slack from your server
10
+
11
+ An **Event** is a Slack message that your backend posts when something happens. Each event key, such as `user.subscribed`, has its own Slack channel, message template (`{{field}}` placeholders filled from `data`) and on/off switch, set at https://app.channlize.com/events.
12
+
13
+ ## Checklist
14
+
15
+ 1. **Install** in the server package: `npm install @channlize/core` (0.4.0 or later).
16
+ 2. **Create a server key** with the `write` scope at https://app.channlize.com/integration/api-keys#server-keys. It is shown once. Ask the user to put it in the server environment themselves; never ask them to paste it into the chat.
17
+ 3. **Set env vars**, server only (`.env`, the hosting provider's secrets; never `NEXT_PUBLIC_` or `VITE_`):
18
+ ```bash
19
+ CHANNLIZE_SERVER_API_KEY=ch_live_… # CHANNLIZE_API_KEY also works
20
+ CHANNLIZE_PROJECT_ID=<project id>
21
+ ```
22
+ Add both names to `.env.example` without values.
23
+ 4. **Create one notifier module** and import it where events happen:
24
+ ```ts
25
+ // lib/notify.ts — server only
26
+ import { createNotifier } from '@channlize/core';
27
+
28
+ type AppEvents = {
29
+ 'user.signed_up': { email: string; plan: string };
30
+ 'invoice.paid': { amount: string; customer: string };
31
+ };
32
+
33
+ // Reads the env vars when called, so importing it never throws.
34
+ export const notify = createNotifier<AppEvents>();
35
+ ```
36
+ 5. **Call it after the action succeeded**, for example after the database write. Don't let a Slack hiccup break the user's request:
37
+ ```ts
38
+ await notify('invoice.paid', { amount: '$49.00', customer: user.email }, {
39
+ idempotencyKey: `invoice-${invoice.id}`, // retry-safe: posted once
40
+ }).catch((err) => console.error('channlize notify failed', err));
41
+ ```
42
+ In Next.js, call it from a Route Handler, a Server Action or a webhook handler, never from a `'use client'` file.
43
+ 6. **Configure the event**: the first call with a new key saves it as a **disabled draft** and answers `status: 'skipped'`. Open https://app.channlize.com/events, pick the channel, write the template (for example `:tada: *{{email}}* paid {{amount}}`), and enable it.
44
+ 7. **Verify**: trigger the action once, then check `res.status` (`'queued'` means it is posting) and **Events → Recent deliveries** in the dashboard. Make sure the Channlize bot is in the channel (`/invite @Channlize`).
45
+
46
+ ## API facts
47
+
48
+ - `notify(event, data?, options?)` returns `Promise<{ success, id, event, status: 'queued' | 'skipped' | 'sent' | 'failed', reason?, duplicate? }>`.
49
+ - Event keys match `^[a-z0-9][a-z0-9._-]*$`, with 100 characters at most: `user.subscribed`, `invoice_paid`, `signup-done`. An invalid key throws a `ValidationError` before any request.
50
+ - `options.idempotencyKey`: a key already used on the project returns the first delivery with `duplicate: true` and posts nothing. Derive it from your own ID (an invoice, order or user ID), never from `Date.now()`.
51
+ - `options.channel`: a Slack channel **ID** (`C0123…`), not a name, to override the event's channel for one call.
52
+ - `createNotifier({ serverApiKey, projectId, baseUrl, timeout })` overrides the env vars (`CHANNLIZE_BASE_URL`; 10 s timeout by default).
53
+ - App-wide types are an alternative to the type argument:
54
+ ```ts
55
+ declare module '@channlize/core' {
56
+ interface ChannlizeEvents { 'user.signed_up': { email: string; plan: string } }
57
+ }
58
+ ```
59
+ - With an existing client: `new ChannlizeClient({ apiKey: 'wk_…', projectId, serverApiKey }).notify(…)`.
60
+ - Without the SDK (any language):
61
+ ```bash
62
+ curl -X POST https://api.channlize.com/v1/notify \
63
+ -H "Authorization: Bearer $CHANNLIZE_SERVER_API_KEY" \
64
+ -H "Content-Type: application/json" \
65
+ -H "Idempotency-Key: invoice-in_1042" \
66
+ -d '{"projectId":"'"$CHANNLIZE_PROJECT_ID"'","event":"invoice.paid","data":{"amount":"$49"}}'
67
+ ```
68
+ It answers 202 with the same JSON as the SDK.
69
+
70
+ ## `skipped` reasons (no exception is thrown)
71
+
72
+ | `reason` says | Fix |
73
+ | --- | --- |
74
+ | seen for the first time and saved as a disabled draft | Configure and enable it under Events |
75
+ | is disabled | Enable it under Events |
76
+ | No Slack workspace is connected | Connect Slack under Channels & Routing (https://app.channlize.com/channels) |
77
+ | No Slack channel | Pick a channel for the event, or set a default channel under Channels & Routing |
78
+
79
+ ## Pitfalls
80
+
81
+ - **Never in the browser.** The server key would be public. Calling with a `wk_…` key throws `ValidationError: notify needs a server API key`. For browser-side signals, use log tracking (`channlize-log-tracking`).
82
+ - **403** means the key lacks the `write` scope. **401** means the key is wrong, revoked or expired.
83
+ - **Missing `CHANNLIZE_PROJECT_ID`** rejects with "A project ID is required" when the notifier is called, not when it is created.
84
+ - **Personal data**: `data` is shown in Slack. Send what the team needs, never passwords, tokens or card numbers.
85
+ - Await the call in serverless functions (Vercel, Netlify, Lambda), because the function can be frozen once it has answered.