theleadrouter-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/.claude/skills/admin-guide/SKILL.md +351 -0
  2. package/.claude/skills/buyer-guide/SKILL.md +405 -0
  3. package/.claude/skills/partner-guide/SKILL.md +352 -0
  4. package/.claude/skills/welcome/SKILL.md +351 -0
  5. package/CLAUDE.md +238 -0
  6. package/LICENSE +21 -0
  7. package/README.md +166 -0
  8. package/dist/api-client.d.ts +10 -0
  9. package/dist/api-client.d.ts.map +1 -0
  10. package/dist/api-client.js +64 -0
  11. package/dist/api-client.js.map +1 -0
  12. package/dist/auth-adapter.d.ts +33 -0
  13. package/dist/auth-adapter.d.ts.map +1 -0
  14. package/dist/auth-adapter.js +87 -0
  15. package/dist/auth-adapter.js.map +1 -0
  16. package/dist/bin/iscale-mcp.d.ts +3 -0
  17. package/dist/bin/iscale-mcp.d.ts.map +1 -0
  18. package/dist/bin/iscale-mcp.js +7 -0
  19. package/dist/bin/iscale-mcp.js.map +1 -0
  20. package/dist/build-registry.d.ts +3 -0
  21. package/dist/build-registry.d.ts.map +1 -0
  22. package/dist/build-registry.js +15 -0
  23. package/dist/build-registry.js.map +1 -0
  24. package/dist/index.d.ts +12 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +34 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/register.d.ts +4 -0
  29. package/dist/register.d.ts.map +1 -0
  30. package/dist/register.js +23 -0
  31. package/dist/register.js.map +1 -0
  32. package/dist/registry.d.ts +50 -0
  33. package/dist/registry.d.ts.map +1 -0
  34. package/dist/registry.js +78 -0
  35. package/dist/registry.js.map +1 -0
  36. package/dist/tools/buyers.d.ts +4 -0
  37. package/dist/tools/buyers.d.ts.map +1 -0
  38. package/dist/tools/buyers.js +61 -0
  39. package/dist/tools/buyers.js.map +1 -0
  40. package/dist/tools/campaigns.d.ts +4 -0
  41. package/dist/tools/campaigns.d.ts.map +1 -0
  42. package/dist/tools/campaigns.js +45 -0
  43. package/dist/tools/campaigns.js.map +1 -0
  44. package/dist/tools/compliance.d.ts +4 -0
  45. package/dist/tools/compliance.d.ts.map +1 -0
  46. package/dist/tools/compliance.js +28 -0
  47. package/dist/tools/compliance.js.map +1 -0
  48. package/dist/tools/composite.d.ts +3 -0
  49. package/dist/tools/composite.d.ts.map +1 -0
  50. package/dist/tools/composite.js +337 -0
  51. package/dist/tools/composite.js.map +1 -0
  52. package/dist/tools/contracts.d.ts +4 -0
  53. package/dist/tools/contracts.d.ts.map +1 -0
  54. package/dist/tools/contracts.js +48 -0
  55. package/dist/tools/contracts.js.map +1 -0
  56. package/dist/tools/generated/api-keys.gen.d.ts +3 -0
  57. package/dist/tools/generated/api-keys.gen.d.ts.map +1 -0
  58. package/dist/tools/generated/api-keys.gen.js +49 -0
  59. package/dist/tools/generated/api-keys.gen.js.map +1 -0
  60. package/dist/tools/generated/audit-logs.gen.d.ts +3 -0
  61. package/dist/tools/generated/audit-logs.gen.d.ts.map +1 -0
  62. package/dist/tools/generated/audit-logs.gen.js +59 -0
  63. package/dist/tools/generated/audit-logs.gen.js.map +1 -0
  64. package/dist/tools/generated/auth.gen.d.ts +3 -0
  65. package/dist/tools/generated/auth.gen.d.ts.map +1 -0
  66. package/dist/tools/generated/auth.gen.js +195 -0
  67. package/dist/tools/generated/auth.gen.js.map +1 -0
  68. package/dist/tools/generated/blocked-lists.gen.d.ts +3 -0
  69. package/dist/tools/generated/blocked-lists.gen.d.ts.map +1 -0
  70. package/dist/tools/generated/blocked-lists.gen.js +146 -0
  71. package/dist/tools/generated/blocked-lists.gen.js.map +1 -0
  72. package/dist/tools/generated/buyers.gen.d.ts +3 -0
  73. package/dist/tools/generated/buyers.gen.d.ts.map +1 -0
  74. package/dist/tools/generated/buyers.gen.js +153 -0
  75. package/dist/tools/generated/buyers.gen.js.map +1 -0
  76. package/dist/tools/generated/calls.gen.d.ts +3 -0
  77. package/dist/tools/generated/calls.gen.d.ts.map +1 -0
  78. package/dist/tools/generated/calls.gen.js +106 -0
  79. package/dist/tools/generated/calls.gen.js.map +1 -0
  80. package/dist/tools/generated/campaigns.gen.d.ts +3 -0
  81. package/dist/tools/generated/campaigns.gen.d.ts.map +1 -0
  82. package/dist/tools/generated/campaigns.gen.js +274 -0
  83. package/dist/tools/generated/campaigns.gen.js.map +1 -0
  84. package/dist/tools/generated/catalog.json +7096 -0
  85. package/dist/tools/generated/compliance.gen.d.ts +3 -0
  86. package/dist/tools/generated/compliance.gen.d.ts.map +1 -0
  87. package/dist/tools/generated/compliance.gen.js +119 -0
  88. package/dist/tools/generated/compliance.gen.js.map +1 -0
  89. package/dist/tools/generated/consent.gen.d.ts +3 -0
  90. package/dist/tools/generated/consent.gen.d.ts.map +1 -0
  91. package/dist/tools/generated/consent.gen.js +109 -0
  92. package/dist/tools/generated/consent.gen.js.map +1 -0
  93. package/dist/tools/generated/contacts.gen.d.ts +3 -0
  94. package/dist/tools/generated/contacts.gen.d.ts.map +1 -0
  95. package/dist/tools/generated/contacts.gen.js +88 -0
  96. package/dist/tools/generated/contacts.gen.js.map +1 -0
  97. package/dist/tools/generated/contracts.gen.d.ts +3 -0
  98. package/dist/tools/generated/contracts.gen.d.ts.map +1 -0
  99. package/dist/tools/generated/contracts.gen.js +306 -0
  100. package/dist/tools/generated/contracts.gen.js.map +1 -0
  101. package/dist/tools/generated/delivery-test.gen.d.ts +3 -0
  102. package/dist/tools/generated/delivery-test.gen.d.ts.map +1 -0
  103. package/dist/tools/generated/delivery-test.gen.js +17 -0
  104. package/dist/tools/generated/delivery-test.gen.js.map +1 -0
  105. package/dist/tools/generated/discovery.gen.d.ts +3 -0
  106. package/dist/tools/generated/discovery.gen.d.ts.map +1 -0
  107. package/dist/tools/generated/discovery.gen.js +17 -0
  108. package/dist/tools/generated/discovery.gen.js.map +1 -0
  109. package/dist/tools/generated/disposition-codes.gen.d.ts +3 -0
  110. package/dist/tools/generated/disposition-codes.gen.d.ts.map +1 -0
  111. package/dist/tools/generated/disposition-codes.gen.js +30 -0
  112. package/dist/tools/generated/disposition-codes.gen.js.map +1 -0
  113. package/dist/tools/generated/email-templates.gen.d.ts +3 -0
  114. package/dist/tools/generated/email-templates.gen.d.ts.map +1 -0
  115. package/dist/tools/generated/email-templates.gen.js +108 -0
  116. package/dist/tools/generated/email-templates.gen.js.map +1 -0
  117. package/dist/tools/generated/engagements.gen.d.ts +3 -0
  118. package/dist/tools/generated/engagements.gen.d.ts.map +1 -0
  119. package/dist/tools/generated/engagements.gen.js +208 -0
  120. package/dist/tools/generated/engagements.gen.js.map +1 -0
  121. package/dist/tools/generated/enrollments.gen.d.ts +3 -0
  122. package/dist/tools/generated/enrollments.gen.d.ts.map +1 -0
  123. package/dist/tools/generated/enrollments.gen.js +82 -0
  124. package/dist/tools/generated/enrollments.gen.js.map +1 -0
  125. package/dist/tools/generated/events.gen.d.ts +3 -0
  126. package/dist/tools/generated/events.gen.d.ts.map +1 -0
  127. package/dist/tools/generated/events.gen.js +20 -0
  128. package/dist/tools/generated/events.gen.js.map +1 -0
  129. package/dist/tools/generated/index.d.ts +3 -0
  130. package/dist/tools/generated/index.d.ts.map +1 -0
  131. package/dist/tools/generated/index.js +86 -0
  132. package/dist/tools/generated/index.js.map +1 -0
  133. package/dist/tools/generated/intake-centers.gen.d.ts +3 -0
  134. package/dist/tools/generated/intake-centers.gen.d.ts.map +1 -0
  135. package/dist/tools/generated/intake-centers.gen.js +196 -0
  136. package/dist/tools/generated/intake-centers.gen.js.map +1 -0
  137. package/dist/tools/generated/integrations.gen.d.ts +3 -0
  138. package/dist/tools/generated/integrations.gen.d.ts.map +1 -0
  139. package/dist/tools/generated/integrations.gen.js +290 -0
  140. package/dist/tools/generated/integrations.gen.js.map +1 -0
  141. package/dist/tools/generated/ivr.gen.d.ts +3 -0
  142. package/dist/tools/generated/ivr.gen.d.ts.map +1 -0
  143. package/dist/tools/generated/ivr.gen.js +97 -0
  144. package/dist/tools/generated/ivr.gen.js.map +1 -0
  145. package/dist/tools/generated/leads.gen.d.ts +3 -0
  146. package/dist/tools/generated/leads.gen.d.ts.map +1 -0
  147. package/dist/tools/generated/leads.gen.js +592 -0
  148. package/dist/tools/generated/leads.gen.js.map +1 -0
  149. package/dist/tools/generated/number-pool.gen.d.ts +3 -0
  150. package/dist/tools/generated/number-pool.gen.d.ts.map +1 -0
  151. package/dist/tools/generated/number-pool.gen.js +62 -0
  152. package/dist/tools/generated/number-pool.gen.js.map +1 -0
  153. package/dist/tools/generated/offers.gen.d.ts +3 -0
  154. package/dist/tools/generated/offers.gen.d.ts.map +1 -0
  155. package/dist/tools/generated/offers.gen.js +407 -0
  156. package/dist/tools/generated/offers.gen.js.map +1 -0
  157. package/dist/tools/generated/organizations.gen.d.ts +3 -0
  158. package/dist/tools/generated/organizations.gen.d.ts.map +1 -0
  159. package/dist/tools/generated/organizations.gen.js +161 -0
  160. package/dist/tools/generated/organizations.gen.js.map +1 -0
  161. package/dist/tools/generated/partners.gen.d.ts +3 -0
  162. package/dist/tools/generated/partners.gen.d.ts.map +1 -0
  163. package/dist/tools/generated/partners.gen.js +121 -0
  164. package/dist/tools/generated/partners.gen.js.map +1 -0
  165. package/dist/tools/generated/payouts.gen.d.ts +3 -0
  166. package/dist/tools/generated/payouts.gen.d.ts.map +1 -0
  167. package/dist/tools/generated/payouts.gen.js +92 -0
  168. package/dist/tools/generated/payouts.gen.js.map +1 -0
  169. package/dist/tools/generated/people.gen.d.ts +3 -0
  170. package/dist/tools/generated/people.gen.d.ts.map +1 -0
  171. package/dist/tools/generated/people.gen.js +354 -0
  172. package/dist/tools/generated/people.gen.js.map +1 -0
  173. package/dist/tools/generated/posting-log.gen.d.ts +3 -0
  174. package/dist/tools/generated/posting-log.gen.d.ts.map +1 -0
  175. package/dist/tools/generated/posting-log.gen.js +150 -0
  176. package/dist/tools/generated/posting-log.gen.js.map +1 -0
  177. package/dist/tools/generated/refunds.gen.d.ts +3 -0
  178. package/dist/tools/generated/refunds.gen.d.ts.map +1 -0
  179. package/dist/tools/generated/refunds.gen.js +91 -0
  180. package/dist/tools/generated/refunds.gen.js.map +1 -0
  181. package/dist/tools/generated/reports.gen.d.ts +3 -0
  182. package/dist/tools/generated/reports.gen.d.ts.map +1 -0
  183. package/dist/tools/generated/reports.gen.js +38 -0
  184. package/dist/tools/generated/reports.gen.js.map +1 -0
  185. package/dist/tools/generated/sessions.gen.d.ts +3 -0
  186. package/dist/tools/generated/sessions.gen.d.ts.map +1 -0
  187. package/dist/tools/generated/sessions.gen.js +90 -0
  188. package/dist/tools/generated/sessions.gen.js.map +1 -0
  189. package/dist/tools/generated/settings.gen.d.ts +3 -0
  190. package/dist/tools/generated/settings.gen.d.ts.map +1 -0
  191. package/dist/tools/generated/settings.gen.js +473 -0
  192. package/dist/tools/generated/settings.gen.js.map +1 -0
  193. package/dist/tools/generated/telephony.gen.d.ts +3 -0
  194. package/dist/tools/generated/telephony.gen.d.ts.map +1 -0
  195. package/dist/tools/generated/telephony.gen.js +170 -0
  196. package/dist/tools/generated/telephony.gen.js.map +1 -0
  197. package/dist/tools/generated/tenants.gen.d.ts +3 -0
  198. package/dist/tools/generated/tenants.gen.d.ts.map +1 -0
  199. package/dist/tools/generated/tenants.gen.js +223 -0
  200. package/dist/tools/generated/tenants.gen.js.map +1 -0
  201. package/dist/tools/generated/tracking-numbers.gen.d.ts +3 -0
  202. package/dist/tools/generated/tracking-numbers.gen.d.ts.map +1 -0
  203. package/dist/tools/generated/tracking-numbers.gen.js +131 -0
  204. package/dist/tools/generated/tracking-numbers.gen.js.map +1 -0
  205. package/dist/tools/generated/transactions.gen.d.ts +3 -0
  206. package/dist/tools/generated/transactions.gen.d.ts.map +1 -0
  207. package/dist/tools/generated/transactions.gen.js +62 -0
  208. package/dist/tools/generated/transactions.gen.js.map +1 -0
  209. package/dist/tools/generated/users.gen.d.ts +3 -0
  210. package/dist/tools/generated/users.gen.d.ts.map +1 -0
  211. package/dist/tools/generated/users.gen.js +339 -0
  212. package/dist/tools/generated/users.gen.js.map +1 -0
  213. package/dist/tools/generated/vertical-groups.gen.d.ts +3 -0
  214. package/dist/tools/generated/vertical-groups.gen.d.ts.map +1 -0
  215. package/dist/tools/generated/vertical-groups.gen.js +243 -0
  216. package/dist/tools/generated/vertical-groups.gen.js.map +1 -0
  217. package/dist/tools/generated/verticals.gen.d.ts +3 -0
  218. package/dist/tools/generated/verticals.gen.d.ts.map +1 -0
  219. package/dist/tools/generated/verticals.gen.js +164 -0
  220. package/dist/tools/generated/verticals.gen.js.map +1 -0
  221. package/dist/tools/leads.d.ts +4 -0
  222. package/dist/tools/leads.d.ts.map +1 -0
  223. package/dist/tools/leads.js +69 -0
  224. package/dist/tools/leads.js.map +1 -0
  225. package/dist/tools/offers.d.ts +4 -0
  226. package/dist/tools/offers.d.ts.map +1 -0
  227. package/dist/tools/offers.js +33 -0
  228. package/dist/tools/offers.js.map +1 -0
  229. package/dist/tools/partners.d.ts +4 -0
  230. package/dist/tools/partners.d.ts.map +1 -0
  231. package/dist/tools/partners.js +30 -0
  232. package/dist/tools/partners.js.map +1 -0
  233. package/dist/tools/people.d.ts +4 -0
  234. package/dist/tools/people.d.ts.map +1 -0
  235. package/dist/tools/people.js +42 -0
  236. package/dist/tools/people.js.map +1 -0
  237. package/dist/tools/reports.d.ts +4 -0
  238. package/dist/tools/reports.d.ts.map +1 -0
  239. package/dist/tools/reports.js +67 -0
  240. package/dist/tools/reports.js.map +1 -0
  241. package/dist/tools/ui.d.ts +3 -0
  242. package/dist/tools/ui.d.ts.map +1 -0
  243. package/dist/tools/ui.js +108 -0
  244. package/dist/tools/ui.js.map +1 -0
  245. package/dist/tools/verticals.d.ts +4 -0
  246. package/dist/tools/verticals.d.ts.map +1 -0
  247. package/dist/tools/verticals.js +25 -0
  248. package/dist/tools/verticals.js.map +1 -0
  249. package/dist/types.d.ts +19 -0
  250. package/dist/types.d.ts.map +1 -0
  251. package/dist/types.js +2 -0
  252. package/dist/types.js.map +1 -0
  253. package/package.json +67 -0
@@ -0,0 +1,352 @@
1
+ ---
2
+ name: partner-guide
3
+ description: "Partner guide for iSCALE lead routing — submitting leads, managing campaigns, posting specs, the partner portal, API keys, sessions, co-registration. Use when integrating lead submission, checking campaign status, or using the partner portal."
4
+ user_invocable: true
5
+ allowed_tools:
6
+ - Bash
7
+ - Read
8
+ - Grep
9
+ - Glob
10
+ ---
11
+
12
+ # iSCALE Partner Guide
13
+
14
+ Guide for partners (affiliates, publishers, lead generators) who submit leads into iSCALE. Covers lead submission, campaign management, the partner portal, and API integration.
15
+
16
+ ## When to use
17
+ - Integrating lead submission into your system
18
+ - Understanding posting specs and required fields
19
+ - Managing campaigns in the partner portal
20
+ - Setting up API keys
21
+ - Using sessions for multi-step lead capture
22
+ - Setting up co-registration flows
23
+ - Checking lead status and payouts
24
+ - Troubleshooting rejected leads
25
+
26
+ ## How Lead Submission Works
27
+
28
+ You submit leads to iSCALE via API. Each campaign has a unique **posting key** (`lr_xxx`) that identifies your campaign and authorizes the submission.
29
+
30
+ ```
31
+ Your System → POST /api/v1/leads/submit → iSCALE Routing Engine → Buyer(s)
32
+ ```
33
+
34
+ 1. You submit a lead with the campaign's posting key
35
+ 2. iSCALE validates the lead data against required fields
36
+ 3. The routing engine evaluates which buyers want the lead
37
+ 4. Lead is delivered to winning buyer(s)
38
+ 5. You get paid based on your campaign's pricing (costPerLead or revshare)
39
+
40
+ ## Submitting Leads
41
+
42
+ ### Endpoint
43
+
44
+ ```
45
+ POST /api/v1/leads/submit
46
+ Authorization: Bearer lr_xxx
47
+ Content-Type: application/json
48
+ ```
49
+
50
+ Replace `lr_xxx` with your campaign's posting key.
51
+
52
+ ### Required Fields (Every Lead)
53
+
54
+ | Field | Type | Description |
55
+ |-------|------|-------------|
56
+ | campaignId | string | Campaign UUID or display ID |
57
+ | firstName | string | Lead's first name |
58
+ | lastName | string | Lead's last name |
59
+ | email | string | Valid email address |
60
+ | phone | string | Phone number (digits only, 10 chars) |
61
+ | zipCode | string | 5-digit zip code |
62
+ | ipAddress | string | Lead's IP address |
63
+ | tcpaConsent | boolean | Must be `true` |
64
+ | trustedFormCertUrl | string | TrustedForm certificate URL |
65
+
66
+ ### Optional Global Fields
67
+
68
+ | Field | Type | Description |
69
+ |-------|------|-------------|
70
+ | address | string | Street address |
71
+ | city | string | City |
72
+ | state | string | 2-letter state code ("CA", "TX") |
73
+ | dateOfBirth | string | YYYY-MM-DD format |
74
+ | sub1 — sub10 | string | Your tracking/sub-ID values |
75
+
76
+ ### Vertical Fields
77
+
78
+ Each vertical (lead category) has additional required or optional fields. For example, a Solar vertical might require:
79
+
80
+ | Field | Type |
81
+ |-------|------|
82
+ | utilityBill | number |
83
+ | homeOwner | boolean |
84
+ | roofType | string |
85
+
86
+ ### Campaign Fields
87
+
88
+ Some campaigns have additional fields beyond the vertical. Check the posting spec for the full list.
89
+
90
+ ### Example Request
91
+
92
+ ```json
93
+ {
94
+ "campaignId": "abc-123",
95
+ "firstName": "Jane",
96
+ "lastName": "Smith",
97
+ "email": "jane@example.com",
98
+ "phone": "5551234567",
99
+ "zipCode": "90210",
100
+ "state": "CA",
101
+ "ipAddress": "203.0.113.42",
102
+ "tcpaConsent": true,
103
+ "trustedFormCertUrl": "https://cert.trustedform.com/abc123",
104
+ "utilityBill": 150,
105
+ "homeOwner": true,
106
+ "sub1": "google",
107
+ "sub2": "campaign-42"
108
+ }
109
+ ```
110
+
111
+ ### Response — Success
112
+
113
+ ```json
114
+ {
115
+ "data": {
116
+ "id": "lead-uuid",
117
+ "shortId": "L-12345",
118
+ "status": "sold",
119
+ "revenue": "15.00",
120
+ "sales": [
121
+ {
122
+ "buyerId": "buyer-uuid",
123
+ "price": "15.00",
124
+ "deliveryStatus": "delivered"
125
+ }
126
+ ]
127
+ }
128
+ }
129
+ ```
130
+
131
+ ### Response — Rejection
132
+
133
+ ```json
134
+ {
135
+ "data": {
136
+ "id": "lead-uuid",
137
+ "shortId": "L-12346",
138
+ "status": "rejected",
139
+ "rejectionReason": "No matching contracts"
140
+ }
141
+ }
142
+ ```
143
+
144
+ ### Common Rejection Reasons
145
+
146
+ | Reason | What it means |
147
+ |--------|---------------|
148
+ | No matching contracts | No buyer contracts matched the lead's data |
149
+ | Duplicate lead | This person was already submitted recently |
150
+ | Cap exceeded | Campaign or buyer caps have been reached |
151
+ | Invalid field: [name] | A required field is missing or invalid |
152
+ | Campaign inactive | The campaign is paused or disabled |
153
+ | TCPA consent required | tcpaConsent must be `true` |
154
+ | Missing TrustedForm certificate | trustedFormCertUrl is required |
155
+
156
+ ## Getting Your Posting Spec
157
+
158
+ The posting spec tells you exactly what fields to send for a specific campaign.
159
+
160
+ ### Via API
161
+
162
+ ```
163
+ GET /api/v1/campaigns/{campaignId}/posting
164
+ Authorization: Bearer lr_xxx
165
+ ```
166
+
167
+ Returns:
168
+ ```json
169
+ {
170
+ "data": {
171
+ "postingUrl": "https://leads.iscale.com/api/v1/leads/submit",
172
+ "postingKey": "lr_xxx",
173
+ "requiredFields": ["firstName", "lastName", "email", "phone", ...],
174
+ "verticalFields": [...],
175
+ "campaignFields": [...],
176
+ "sampleBody": { ... }
177
+ }
178
+ }
179
+ ```
180
+
181
+ ### Via Partner Portal
182
+
183
+ Go to **Campaigns > [Your Campaign] > Posting Specs tab**. This shows all fields, types, and a sample request body.
184
+
185
+ ## Partner Portal
186
+
187
+ The partner portal gives you a dashboard to manage campaigns, view leads, and track payouts.
188
+
189
+ ### Accessing the Portal
190
+
191
+ - **URL:** Your iSCALE instance URL + `/partner` (e.g., `https://leads.iscale.com/partner`)
192
+ - **Auth:** Login with your partner account credentials
193
+
194
+ ### Portal Pages
195
+
196
+ | Page | What it shows |
197
+ |------|---------------|
198
+ | **Dashboard** | Overview stats — leads today, revenue, acceptance rate |
199
+ | **People** | Contacts across all your leads, with timeline |
200
+ | **Offers** | Available offers you can enroll in, plus your active campaigns |
201
+ | **Campaign Detail** | Overview, posting specs, leads for a specific campaign |
202
+ | **Payouts** | Payout history and upcoming payouts |
203
+ | **Posting Log** | Real-time log of every lead submission (success/failure) |
204
+ | **Settings** | Your profile, API keys |
205
+ | **Help** | Documentation and support |
206
+
207
+ ### Viewing Leads
208
+
209
+ Go to **People > Leads tab** to see all submitted leads with:
210
+ - Status (sold, rejected, pending, returned)
211
+ - Revenue earned
212
+ - Submission date
213
+ - Campaign name
214
+
215
+ Click a lead to see full details including delivery status.
216
+
217
+ ## API Keys
218
+
219
+ You can access the partner portal API programmatically using API keys.
220
+
221
+ ### Creating an API Key
222
+
223
+ 1. Go to **Settings** in the partner portal
224
+ 2. Click **Create API Key**
225
+ 3. Copy the key (shown once) — it starts with `lr_`
226
+
227
+ Or ask your admin to create one from the admin dashboard.
228
+
229
+ ### Using API Keys
230
+
231
+ ```
232
+ GET /api/partner/leads
233
+ Authorization: Bearer lr_your_partner_api_key
234
+ ```
235
+
236
+ ### Partner API Endpoints
237
+
238
+ | Endpoint | Method | Description |
239
+ |----------|--------|-------------|
240
+ | `/api/partner/campaigns` | GET | List your campaigns |
241
+ | `/api/partner/campaigns/{id}` | GET | Campaign detail + posting spec |
242
+ | `/api/partner/campaigns/sync` | GET | Lightweight change detection |
243
+ | `/api/partner/leads` | GET | List your leads (filterable) |
244
+ | `/api/partner/leads/{id}` | GET | Lead detail |
245
+ | `/api/partner/offers` | GET | Available offers |
246
+ | `/api/partner/offers/{id}` | GET | Offer detail |
247
+ | `/api/partner/payouts` | GET | Payout history |
248
+ | `/api/partner/settings` | GET/PUT | Your profile |
249
+ | `/api/partner/api-keys` | GET/POST | List/create API keys |
250
+ | `/api/partner/api-keys/{id}` | DELETE | Revoke an API key |
251
+
252
+ ## Sessions — Multi-Step Lead Capture
253
+
254
+ For multi-step funnels where you collect data across several pages, use the Sessions API.
255
+
256
+ ### How It Works
257
+
258
+ 1. **Create a session** — gets a session key
259
+ 2. **PATCH data** at each step — add fields as the user fills them in
260
+ 3. **Submit** on the final step — triggers routing
261
+
262
+ ### Flow
263
+
264
+ ```
265
+ Step 1: Create session (get sessionKey)
266
+ Step 2: PATCH { firstName, lastName, email }
267
+ Step 3: PATCH { phone, zipCode, utilityBill }
268
+ Step 4: Submit (triggers routing)
269
+ ```
270
+
271
+ ### Key Details
272
+
273
+ - Session key acts as a bearer token for subsequent requests
274
+ - Sessions expire after **24 hours**
275
+ - Each PATCH merges data — doesn't replace previous data
276
+ - Lead is only created on final submit
277
+
278
+ ## Co-Registration (Coreg)
279
+
280
+ Submit the same contact through multiple campaigns in a single session.
281
+
282
+ ### How It Works
283
+
284
+ 1. Submit primary lead (normal flow)
285
+ 2. Show coreg offers to the user (offers with `visibility: public`)
286
+ 3. For each accepted offer, submit a coreg lead with the same contact data
287
+ 4. Coreg leads are linked via `parentLeadId`
288
+
289
+ ### Flow
290
+
291
+ ```
292
+ Primary submit → Get coreg offers → Submit to each accepted offer → Close session
293
+ ```
294
+
295
+ ## Campaign Status
296
+
297
+ | Status | Meaning |
298
+ |--------|---------|
299
+ | `active` | Accepting leads |
300
+ | `paused` | Temporarily stopped — leads will be rejected |
301
+ | `inactive` | Disabled — no leads accepted |
302
+
303
+ If your campaign is paused or inactive, contact your admin.
304
+
305
+ ## Pricing Models
306
+
307
+ | Model | How you get paid |
308
+ |-------|-----------------|
309
+ | `fixed` | Fixed costPerLead for every accepted lead |
310
+ | `revshare` | Percentage of revenue from buyer payments |
311
+
312
+ ## Caps
313
+
314
+ Your campaign may have caps that limit volume:
315
+
316
+ | Cap | What it limits |
317
+ |-----|----------------|
318
+ | dailyCap | Max leads per day |
319
+ | weeklyCap | Max leads per week |
320
+ | monthlyCap | Max leads per month |
321
+
322
+ Caps reset at midnight in the campaign's timezone. Once hit, leads are rejected until the cap resets.
323
+
324
+ ## Troubleshooting
325
+
326
+ ### "Campaign inactive" rejection
327
+ Your campaign has been paused or disabled. Contact your admin.
328
+
329
+ ### "Invalid field" rejection
330
+ A required field is missing or in the wrong format. Check the posting spec for field types and required flags.
331
+
332
+ ### "Duplicate lead" rejection
333
+ This person (by email/phone) was already submitted recently. Each buyer has their own dedup window (typically 30 days).
334
+
335
+ ### "No matching contracts" rejection
336
+ No buyer contracts matched the lead's data. This could mean:
337
+ - Lead's state/zip doesn't match any buyer's geo filters
338
+ - Lead's demographics don't match buyer requirements
339
+ - All eligible buyers have hit their caps
340
+ - All eligible buyers are paused or out of balance
341
+
342
+ ### "Cap exceeded" rejection
343
+ Your campaign's daily/weekly/monthly cap has been reached. Wait for the cap to reset or ask your admin to increase it.
344
+
345
+ ### Leads showing "pending" status
346
+ The lead was accepted but delivery to the buyer is still in progress. Check back shortly — it should update to "sold" or "failed".
347
+
348
+ ### Not getting paid for leads
349
+ Check that:
350
+ - Leads have status "sold" (not "rejected" or "returned")
351
+ - Your payment cycle is set correctly
352
+ - Your balance reflects recent leads
@@ -0,0 +1,351 @@
1
+ ---
2
+ name: welcome
3
+ description: "First-time setup wizard for iSCALE + Claude Code. Detects your role, checks MCP connection, and walks you through getting started. Run this when you first clone the repo or are new to iSCALE."
4
+ user_invocable: true
5
+ allowed_tools:
6
+ - Bash
7
+ - Read
8
+ - Grep
9
+ - Glob
10
+ ---
11
+
12
+ # iSCALE Welcome Wizard
13
+
14
+ Interactive first-time setup for new iSCALE users. This skill detects your situation and walks you through everything step by step.
15
+
16
+ ## When this runs
17
+
18
+ - User says "get started", "set up", "I'm new", "help me get started", "walk me through"
19
+ - User runs `/welcome` explicitly
20
+ - First time opening Claude Code in this repo
21
+
22
+ ## Step 1: Welcome & Role Detection
23
+
24
+ Start by greeting the user and asking their role:
25
+
26
+ ```
27
+ Welcome to iSCALE Lead Routing!
28
+
29
+ I'll help you get set up. First, which best describes your role?
30
+
31
+ 1. **Admin** — I manage the platform (set up verticals, partners, buyers, offers, contracts)
32
+ 2. **Partner** — I submit leads into iSCALE (affiliate, publisher, lead generator)
33
+ 3. **Buyer** — I receive leads from iSCALE (advertiser, client, law firm)
34
+
35
+ Which one are you? (1, 2, or 3)
36
+ ```
37
+
38
+ ## Step 2: Check MCP Connection
39
+
40
+ After role selection, check if the MCP server is configured:
41
+
42
+ 1. Check if `.mcp.json` exists in the project root
43
+ 2. If it exists, check for an `iscale` entry with `ISCALE_API_URL` and `ISCALE_API_KEY`
44
+ 3. If not configured, walk them through setup:
45
+
46
+ ```
47
+ To connect Claude Code to your iSCALE instance, I need two things:
48
+
49
+ 1. **Your iSCALE URL** — the URL where you access iSCALE
50
+ (e.g., https://leads.iscale.com or https://your-company.iscale.com)
51
+
52
+ 2. **An API key** — you can get one from Settings > API Keys in the admin dashboard
53
+ (it starts with lr_)
54
+
55
+ Do you have these ready?
56
+ ```
57
+
58
+ If they have the info, write the `.mcp.json` config and tell them to restart Claude Code.
59
+
60
+ If they don't have an API key yet:
61
+ - **Admins:** "Go to Settings > API Keys in your admin dashboard and create one."
62
+ - **Partners:** "Ask your admin to create a partner API key for you, or go to Settings in your partner portal."
63
+ - **Buyers:** "Ask your admin to create a buyer API key for you, or go to Settings in your buyer portal."
64
+
65
+ ## Step 3: Role-Specific Walkthrough
66
+
67
+ Based on their role, run the appropriate guided walkthrough:
68
+
69
+ ### For Admins → Run the Admin Onboarding
70
+
71
+ ```
72
+ Great! You're set up as an admin. Here's what we'll cover:
73
+
74
+ 1. **How iSCALE works** — the big picture (2 min read)
75
+ 2. **Entity hierarchy** — what connects to what
76
+ 3. **Your first campaign** — step-by-step setup
77
+ 4. **Testing** — submit a test lead and verify routing
78
+ 5. **Day-to-day operations** — reports, troubleshooting, common tasks
79
+
80
+ Ready? Let's start with how iSCALE works.
81
+ ```
82
+
83
+ Then walk through each section interactively:
84
+
85
+ **Section 1: How iSCALE Works**
86
+ ```
87
+ iSCALE routes leads from partners to buyers. Here's the flow:
88
+
89
+ Partner submits lead → Campaign → Offer → Routing Engine → Contract(s) → Buyer(s)
90
+
91
+ Key concept: the **Offer** is the hub. It connects campaigns (lead sources)
92
+ to contracts (buyer agreements) and controls the distribution rules.
93
+
94
+ Think of it like an auction house:
95
+ - Partners are sellers bringing items (leads)
96
+ - Buyers are bidders with specific criteria (contracts)
97
+ - The Offer is the auction rules (who wins, how many winners)
98
+
99
+ Make sense? Say "next" to continue, or ask me anything.
100
+ ```
101
+
102
+ **Section 2: Entity Hierarchy**
103
+ ```
104
+ Here's what you need to set up, in order:
105
+
106
+ 1. Vertical (lead category — "Solar", "Medicare", etc.)
107
+ └── defines what fields leads have
108
+
109
+ 2. Partner (who sends you leads)
110
+ └── Campaign (their specific program, has a posting key)
111
+
112
+ 3. Buyer (who buys leads)
113
+ └── Contract (what they want: filters, caps, price)
114
+
115
+ 4. Offer (connects campaigns ↔ contracts)
116
+ └── distribution rules: exclusive? multisell? highest price wins?
117
+
118
+ Each entity depends on the one above it. You can't create a campaign
119
+ without a partner, or a contract without a buyer.
120
+
121
+ Ready to set up your first campaign? Say "next".
122
+ ```
123
+
124
+ **Section 3: First Campaign Setup**
125
+ ```
126
+ Let's set up a complete campaign. I'll walk you through each step.
127
+
128
+ What vertical (lead type) are you working with?
129
+ Examples: Solar, Medicare, Auto Insurance, Mass Tort, Home Services
130
+
131
+ (If you already have verticals set up, I can check — just say "check my verticals")
132
+ ```
133
+
134
+ Then guide them through creating each entity in order, using the MCP tools if connected, or giving them step-by-step UI instructions if not.
135
+
136
+ **Section 4: Testing**
137
+ ```
138
+ Now let's test the flow. I'll help you:
139
+
140
+ 1. Get the posting spec for your new campaign
141
+ 2. Submit a test lead
142
+ 3. Verify it routed correctly
143
+ 4. Check the routing waterfall to see what happened
144
+
145
+ Ready to test?
146
+ ```
147
+
148
+ **Section 5: Day-to-Day**
149
+ ```
150
+ You're all set! Here are the things you'll do most often:
151
+
152
+ - "Show me today's leads" — quick overview
153
+ - "Why didn't lead L-12345 route?" — troubleshoot routing
154
+ - "What's buyer X's balance?" — check billing
155
+ - "Pull a revenue report for this week" — reporting
156
+ - "Pause contract C-456" — manage entities
157
+
158
+ You can also run /admin-guide anytime for the full reference.
159
+
160
+ Any questions?
161
+ ```
162
+
163
+ ### For Partners → Run the Partner Onboarding
164
+
165
+ ```
166
+ Great! You're set up as a partner. Here's what we'll cover:
167
+
168
+ 1. **How lead submission works** — the big picture
169
+ 2. **Your campaigns** — what's available to you
170
+ 3. **Posting specs** — exactly what fields to send
171
+ 4. **Your first test lead** — submit one and see what happens
172
+ 5. **Day-to-day** — checking leads, payouts, troubleshooting
173
+
174
+ Ready? Let's go.
175
+ ```
176
+
177
+ **Section 1: How Lead Submission Works**
178
+ ```
179
+ You submit leads to iSCALE via API. Here's how it works:
180
+
181
+ Your system → POST to iSCALE API → Routing engine finds buyers → You get paid
182
+
183
+ Each of your campaigns has a **posting key** (starts with lr_).
184
+ This key identifies your campaign and authorizes the submission.
185
+
186
+ You send a JSON body with the lead's info (name, email, phone, etc.)
187
+ and iSCALE tells you immediately if the lead was accepted or rejected.
188
+
189
+ Make sense? Say "next" to continue.
190
+ ```
191
+
192
+ **Section 2: Your Campaigns**
193
+ If MCP is connected, use `list_campaigns` to show their campaigns:
194
+ ```
195
+ Here are your active campaigns:
196
+
197
+ Campaign: Solar Leads West Coast (C-123)
198
+ Vertical: Solar
199
+ Posting Key: lr_abc***
200
+ Caps: 100/day, 500/week
201
+
202
+ Campaign: Medicare AEP (C-456)
203
+ Vertical: Medicare
204
+ Posting Key: lr_def***
205
+ Caps: 50/day
206
+
207
+ Want to see the posting spec for one of these?
208
+ ```
209
+
210
+ If not connected, tell them where to find this info in the portal.
211
+
212
+ **Section 3: Posting Spec**
213
+ ```
214
+ Let's look at exactly what fields you need to send.
215
+ Which campaign do you want to integrate first?
216
+ ```
217
+
218
+ Then show the full posting spec with required fields, types, and a copy-paste sample request.
219
+
220
+ **Section 4: First Test Lead**
221
+ ```
222
+ Let's submit a test lead. I'll generate a sample request for you.
223
+
224
+ ⚠️ This will create a REAL lead in the system (with test data).
225
+ Your admin can delete it afterward.
226
+
227
+ Want me to generate the curl command, or do you want to submit via your own system?
228
+ ```
229
+
230
+ **Section 5: Day-to-Day**
231
+ ```
232
+ You're all set! Here's what you'll use most:
233
+
234
+ - "Show me my leads from today" — check submissions
235
+ - "Why was my last lead rejected?" — troubleshoot rejections
236
+ - "What's my posting spec for campaign X?" — quick reference
237
+ - "Show me my payouts" — check earnings
238
+
239
+ You can run /partner-guide anytime for the full reference.
240
+ ```
241
+
242
+ ### For Buyers → Run the Buyer Onboarding
243
+
244
+ ```
245
+ Great! You're set up as a buyer. Here's what we'll cover:
246
+
247
+ 1. **How you receive leads** — the big picture
248
+ 2. **Your contracts** — what's configured for you
249
+ 3. **Filters & caps** — controlling what you receive
250
+ 4. **Delivery** — how leads reach your system
251
+ 5. **Day-to-day** — checking leads, billing, returns
252
+
253
+ Ready? Let's go.
254
+ ```
255
+
256
+ **Section 1: How You Receive Leads**
257
+ ```
258
+ Partners submit leads into iSCALE. The routing engine checks your
259
+ contracts — if a lead matches your criteria, it's delivered to you.
260
+
261
+ Lead comes in → Routing engine checks your filters → Match? → Delivered to you
262
+
263
+ You only pay for leads that pass ALL your checks:
264
+ ✓ Geographic filters (states/zips you want)
265
+ ✓ Demographic filters (age range, etc.)
266
+ ✓ Custom filters (vertical-specific criteria)
267
+ ✓ Caps not exceeded (daily/weekly/monthly limits)
268
+ ✓ Not a duplicate (if dedup is enabled)
269
+
270
+ Make sense? Say "next" to continue.
271
+ ```
272
+
273
+ **Section 2: Your Contracts**
274
+ If MCP is connected, use `list_contracts` to show their contracts:
275
+ ```
276
+ Here are your active contracts:
277
+
278
+ Contract: Solar CA/TX (CT-123)
279
+ Vertical: Solar
280
+ Price: $15.00/lead
281
+ Geo: CA, TX only
282
+ Caps: 50/day, 200/week
283
+
284
+ Contract: Medicare National (CT-456)
285
+ Vertical: Medicare
286
+ Price: $25.00/lead
287
+ Geo: All states
288
+ Caps: 100/day
289
+
290
+ Want to adjust any of these?
291
+ ```
292
+
293
+ **Section 3: Filters & Caps**
294
+ ```
295
+ Your contracts control exactly what leads you receive:
296
+
297
+ **Geographic filters** — which states/zips
298
+ Example: Only CA, TX, FL leads; or only 902xx zip codes
299
+
300
+ **Demographic filters** — age range, etc.
301
+ Example: Ages 25-65 only
302
+
303
+ **Custom filters** — vertical-specific criteria
304
+ Example: homeOwner = true, utilityBill > $100
305
+
306
+ **Caps** — volume limits
307
+ Example: Max 50 leads/day, $1000/day spend
308
+
309
+ **Schedule** — operating hours
310
+ Example: Mon-Fri 9am-5pm Pacific (empty = 24/7)
311
+
312
+ Want to see or adjust the filters on any of your contracts?
313
+ ```
314
+
315
+ **Section 4: Delivery**
316
+ ```
317
+ When a lead matches your contract, it's delivered to your system.
318
+
319
+ Delivery methods:
320
+ - **HTTP POST** — JSON payload to your endpoint (most common)
321
+ - **HTTP GET** — data as query parameters
322
+ - **Email** — lead data sent to an email address
323
+
324
+ Your delivery endpoint and field mapping are configured on your
325
+ contract or intake center.
326
+
327
+ Is your delivery endpoint already set up, or do you need help configuring it?
328
+ ```
329
+
330
+ **Section 5: Day-to-Day**
331
+ ```
332
+ You're all set! Here's what you'll use most:
333
+
334
+ - "Show me leads I received today" — check incoming leads
335
+ - "What's my balance?" — check billing
336
+ - "Return lead L-12345" — return a bad lead
337
+ - "Which contracts are hitting caps?" — monitor volume
338
+ - "Pause contract CT-456" — stop receiving leads temporarily
339
+
340
+ You can run /buyer-guide anytime for the full reference.
341
+ ```
342
+
343
+ ## Conversation Style
344
+
345
+ Throughout the walkthrough:
346
+ - Use plain language, not jargon (explain terms the first time)
347
+ - Keep each section short — max 10 lines of text before asking "ready for next?"
348
+ - Let the user ask questions at any point
349
+ - If MCP is connected, show real data from their instance
350
+ - If not connected, give UI directions ("go to Partners > Create")
351
+ - Don't dump everything at once — this is a conversation, not a manual