@proveanything/smartlinks 1.13.10 → 1.13.11
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/dist/api/authKit.d.ts +1 -1
- package/dist/api/authKit.js +1 -1
- package/dist/api/interactions.d.ts +13 -8
- package/dist/api/interactions.js +13 -8
- package/dist/docs/API_SUMMARY.md +16 -16
- package/dist/docs/ai-guide-template.md +2 -0
- package/dist/docs/auth-kit.md +6 -4
- package/dist/docs/interactions.md +15 -1
- package/dist/docs/loyalty.md +2 -0
- package/dist/docs/overview.md +2 -0
- package/dist/docs/realtime.md +1 -0
- package/dist/openapi.yaml +0 -3
- package/dist/types/authKit.d.ts +2 -2
- package/docs/API_SUMMARY.md +16 -16
- package/docs/ai-guide-template.md +2 -0
- package/docs/auth-kit.md +6 -4
- package/docs/interactions.md +15 -1
- package/docs/loyalty.md +2 -0
- package/docs/overview.md +2 -0
- package/docs/realtime.md +1 -0
- package/openapi.yaml +0 -3
- package/package.json +1 -1
package/dist/api/authKit.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare namespace authKit {
|
|
|
28
28
|
/** Verify phone verification code (public). */
|
|
29
29
|
function verifyPhoneCode(clientId: string, phoneNumber: string, code: string): Promise<PhoneVerifyResponse>;
|
|
30
30
|
/** Send a WhatsApp verification deep-link (public). */
|
|
31
|
-
function sendWhatsApp(clientId: string, body
|
|
31
|
+
function sendWhatsApp(clientId: string, body?: SendWhatsAppRequest): Promise<SendWhatsAppResponse>;
|
|
32
32
|
/** Manually verify WhatsApp token if inbound webhook path is unavailable (public). */
|
|
33
33
|
function verifyWhatsApp(clientId: string, token: string, phoneNumber: string): Promise<VerifyWhatsAppResponse>;
|
|
34
34
|
/** Poll WhatsApp verification status for a token (public). */
|
package/dist/api/authKit.js
CHANGED
|
@@ -47,7 +47,7 @@ export var authKit;
|
|
|
47
47
|
}
|
|
48
48
|
authKit.verifyPhoneCode = verifyPhoneCode;
|
|
49
49
|
/** Send a WhatsApp verification deep-link (public). */
|
|
50
|
-
async function sendWhatsApp(clientId, body) {
|
|
50
|
+
async function sendWhatsApp(clientId, body = {}) {
|
|
51
51
|
return post(`/authkit/${encodeURIComponent(clientId)}/auth/whatsapp/send`, body);
|
|
52
52
|
}
|
|
53
53
|
authKit.sendWhatsApp = sendWhatsApp;
|
|
@@ -21,7 +21,10 @@ export declare namespace interactions {
|
|
|
21
21
|
function aggregateByOutcome(collectionId: string, body: AdminInteractionsAggregateRequest): Promise<AdminInteractionsAggregateResponse>;
|
|
22
22
|
/**
|
|
23
23
|
* POST /admin/collection/:collectionId/interactions/append
|
|
24
|
-
|
|
24
|
+
* Appends one interaction event.
|
|
25
|
+
*
|
|
26
|
+
* `interactionId` must reference an existing interaction type definition.
|
|
27
|
+
* This endpoint does not create interaction definitions.
|
|
25
28
|
*/
|
|
26
29
|
function appendEvent(collectionId: string, body: AppendInteractionBody): Promise<{
|
|
27
30
|
success: true;
|
|
@@ -30,13 +33,15 @@ export declare namespace interactions {
|
|
|
30
33
|
success: true;
|
|
31
34
|
}>;
|
|
32
35
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
* POST /api/v1/public/collection/:collectionId/interactions/submit
|
|
37
|
+
*
|
|
38
|
+
* Submits an interaction event from a public/client-side context.
|
|
39
|
+
* `interactionId` must reference an existing interaction type definition.
|
|
40
|
+
* This endpoint does not create interaction definitions.
|
|
41
|
+
* When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor
|
|
42
|
+
* `contactId` is required. Pass `anonId` inside `metadata` to enable
|
|
43
|
+
* device-level deduplication via `uniquePerAnonId`.
|
|
44
|
+
*/
|
|
40
45
|
function submitPublicEvent(collectionId: string, body: AppendInteractionBody): Promise<SubmitInteractionResponse | SubmitInteractionError>;
|
|
41
46
|
function create(collectionId: string, body: CreateInteractionTypeBody): Promise<InteractionTypeRecord>;
|
|
42
47
|
function list(collectionId: string, query?: ListInteractionTypesQuery): Promise<InteractionTypeList>;
|
package/dist/api/interactions.js
CHANGED
|
@@ -54,7 +54,10 @@ export var interactions;
|
|
|
54
54
|
// Deprecated endpoint removed: actorIdsByInteraction
|
|
55
55
|
/**
|
|
56
56
|
* POST /admin/collection/:collectionId/interactions/append
|
|
57
|
-
|
|
57
|
+
* Appends one interaction event.
|
|
58
|
+
*
|
|
59
|
+
* `interactionId` must reference an existing interaction type definition.
|
|
60
|
+
* This endpoint does not create interaction definitions.
|
|
58
61
|
*/
|
|
59
62
|
async function appendEvent(collectionId, body) {
|
|
60
63
|
if (!body.userId && !body.contactId) {
|
|
@@ -73,13 +76,15 @@ export var interactions;
|
|
|
73
76
|
}
|
|
74
77
|
interactions.updateEvent = updateEvent;
|
|
75
78
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
* POST /api/v1/public/collection/:collectionId/interactions/submit
|
|
80
|
+
*
|
|
81
|
+
* Submits an interaction event from a public/client-side context.
|
|
82
|
+
* `interactionId` must reference an existing interaction type definition.
|
|
83
|
+
* This endpoint does not create interaction definitions.
|
|
84
|
+
* When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor
|
|
85
|
+
* `contactId` is required. Pass `anonId` inside `metadata` to enable
|
|
86
|
+
* device-level deduplication via `uniquePerAnonId`.
|
|
87
|
+
*/
|
|
83
88
|
async function submitPublicEvent(collectionId, body) {
|
|
84
89
|
const path = `/public/collection/${encodeURIComponent(collectionId)}/interactions/submit`;
|
|
85
90
|
return post(path, body);
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.11 | Generated: 2026-05-13T07:57:31.015Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -3027,8 +3027,8 @@ interface EmailVerifyTokenResponse {
|
|
|
3027
3027
|
**SendWhatsAppRequest** (interface)
|
|
3028
3028
|
```typescript
|
|
3029
3029
|
interface SendWhatsAppRequest {
|
|
3030
|
-
phoneNumber
|
|
3031
|
-
redirectUrl
|
|
3030
|
+
phoneNumber?: string
|
|
3031
|
+
redirectUrl?: string
|
|
3032
3032
|
}
|
|
3033
3033
|
```
|
|
3034
3034
|
|
|
@@ -8192,7 +8192,7 @@ Send phone verification code (public).
|
|
|
8192
8192
|
**verifyPhoneCode**(clientId: string, phoneNumber: string, code: string) → `Promise<PhoneVerifyResponse>`
|
|
8193
8193
|
Verify phone verification code (public).
|
|
8194
8194
|
|
|
8195
|
-
**sendWhatsApp**(clientId: string, body: SendWhatsAppRequest) → `Promise<SendWhatsAppResponse>`
|
|
8195
|
+
**sendWhatsApp**(clientId: string, body: SendWhatsAppRequest = {}) → `Promise<SendWhatsAppResponse>`
|
|
8196
8196
|
Send a WhatsApp verification deep-link (public).
|
|
8197
8197
|
|
|
8198
8198
|
**verifyWhatsApp**(clientId: string, token: string, phoneNumber: string) → `Promise<VerifyWhatsAppResponse>`
|
|
@@ -8803,54 +8803,54 @@ Legacy-friendly alias for aggregate().
|
|
|
8803
8803
|
|
|
8804
8804
|
**appendEvent**(collectionId: string,
|
|
8805
8805
|
body: AppendInteractionBody) → `Promise<`
|
|
8806
|
-
POST /admin/collection/:collectionId/interactions/append Appends one interaction event.
|
|
8806
|
+
POST /admin/collection/:collectionId/interactions/append Appends one interaction event. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions.
|
|
8807
8807
|
|
|
8808
8808
|
**updateEvent**(collectionId: string,
|
|
8809
8809
|
body: UpdateInteractionBody) → `Promise<`
|
|
8810
|
-
POST /admin/collection/:collectionId/interactions/append Appends one interaction event.
|
|
8810
|
+
POST /admin/collection/:collectionId/interactions/append Appends one interaction event. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions.
|
|
8811
8811
|
|
|
8812
8812
|
**submitPublicEvent**(collectionId: string,
|
|
8813
8813
|
body: AppendInteractionBody) → `Promise<SubmitInteractionResponse | SubmitInteractionError>`
|
|
8814
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8814
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8815
8815
|
|
|
8816
8816
|
**create**(collectionId: string,
|
|
8817
8817
|
body: CreateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
|
|
8818
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8818
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8819
8819
|
|
|
8820
8820
|
**list**(collectionId: string,
|
|
8821
8821
|
query: ListInteractionTypesQuery = {}) → `Promise<InteractionTypeList>`
|
|
8822
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8822
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8823
8823
|
|
|
8824
8824
|
**get**(collectionId: string,
|
|
8825
8825
|
id: string) → `Promise<InteractionTypeRecord>`
|
|
8826
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8826
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8827
8827
|
|
|
8828
8828
|
**update**(collectionId: string,
|
|
8829
8829
|
id: string,
|
|
8830
8830
|
patchBody: UpdateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
|
|
8831
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8831
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8832
8832
|
|
|
8833
8833
|
**remove**(collectionId: string,
|
|
8834
8834
|
id: string) → `Promise<void>`
|
|
8835
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8835
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8836
8836
|
|
|
8837
8837
|
**publicCountsByOutcome**(collectionId: string,
|
|
8838
8838
|
body: PublicInteractionsCountsByOutcomeRequest,
|
|
8839
8839
|
authToken?: string) → `Promise<OutcomeCount[]>`
|
|
8840
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8840
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8841
8841
|
|
|
8842
8842
|
**publicMyInteractions**(collectionId: string,
|
|
8843
8843
|
body: PublicInteractionsByUserRequest,
|
|
8844
8844
|
authToken?: string) → `Promise<InteractionEventRow[]>`
|
|
8845
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8845
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8846
8846
|
|
|
8847
8847
|
**publicList**(collectionId: string,
|
|
8848
8848
|
query: ListInteractionTypesQuery = {}) → `Promise<InteractionTypeList>`
|
|
8849
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8849
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8850
8850
|
|
|
8851
8851
|
**publicGet**(collectionId: string,
|
|
8852
8852
|
id: string) → `Promise<InteractionTypeRecord>`
|
|
8853
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8853
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8854
8854
|
|
|
8855
8855
|
### jobs
|
|
8856
8856
|
|
|
@@ -225,6 +225,8 @@ await SL.appConfiguration.setConfig({
|
|
|
225
225
|
|
|
226
226
|
### Tracked Interactions
|
|
227
227
|
|
|
228
|
+
Use interaction IDs that are defined via `SL.interactions.create(...)` for the collection. Do not invent ad-hoc IDs in app code.
|
|
229
|
+
|
|
228
230
|
| Interaction ID | Description |
|
|
229
231
|
| -------------- | --------------------------------------------- |
|
|
230
232
|
| `page-view` | Tracks each time a user views the public page |
|
package/dist/docs/auth-kit.md
CHANGED
|
@@ -86,10 +86,12 @@ Use these flows when you want low-friction verification before or without full a
|
|
|
86
86
|
import { authKit } from '@proveanything/smartlinks';
|
|
87
87
|
|
|
88
88
|
// 1) Send WhatsApp verification deep link
|
|
89
|
-
const wa = await authKit.sendWhatsApp(clientId
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
const wa = await authKit.sendWhatsApp(clientId);
|
|
90
|
+
|
|
91
|
+
// Optional: pass redirect context only
|
|
92
|
+
// const wa = await authKit.sendWhatsApp(clientId, {
|
|
93
|
+
// redirectUrl: 'https://app.example.com/checkout/continue',
|
|
94
|
+
// });
|
|
93
95
|
|
|
94
96
|
// wa.waLink can be opened directly by the app/browser
|
|
95
97
|
// Poll status while user switches to WhatsApp and back
|
|
@@ -15,15 +15,19 @@ Interactions have two distinct layers:
|
|
|
15
15
|
| **Interaction Types** | Definitions stored in the database — configure an interaction's ID, permissions, and display metadata once per collection |
|
|
16
16
|
| **Interaction Events** | Individual event records logged each time a user performs that interaction |
|
|
17
17
|
|
|
18
|
+
Critical rule: event `interactionId` values must reference an existing interaction type definition in that collection. Do not generate random IDs in app code and submit events against them.
|
|
19
|
+
|
|
18
20
|
```text
|
|
19
21
|
┌──────────────────────────────────────────────────────────────────┐
|
|
20
22
|
│ Your App │
|
|
21
23
|
│ │
|
|
22
24
|
│ 1. Create type once: interactions.create(collectionId, { │
|
|
23
25
|
│ id: 'vote', permissions: { uniquePerUser: true } }) │
|
|
26
|
+
│ -> definition exists in platform │
|
|
24
27
|
│ │
|
|
25
28
|
│ 2. Log events: interactions.appendEvent(collectionId, { │
|
|
26
29
|
│ interactionId: 'vote', outcome: 'option-a', userId }) │
|
|
30
|
+
│ (must match the created definition ID) │
|
|
27
31
|
│ │
|
|
28
32
|
│ 3. Read results: interactions.countsByOutcome(collectionId, │
|
|
29
33
|
│ { interactionId: 'vote' }) │
|
|
@@ -31,6 +35,14 @@ Interactions have two distinct layers:
|
|
|
31
35
|
└──────────────────────────────────────────────────────────────────┘
|
|
32
36
|
```
|
|
33
37
|
|
|
38
|
+
### Required Workflow (Do Not Invent IDs)
|
|
39
|
+
|
|
40
|
+
1. Create an interaction type definition (admin endpoint) before recording any events.
|
|
41
|
+
2. Reuse that same definition ID for every `appendEvent` / `submitPublicEvent` call.
|
|
42
|
+
3. Treat unknown IDs as configuration errors, not as values your app should auto-create.
|
|
43
|
+
|
|
44
|
+
If your app currently hardcodes strings like `"poll"` or `"entry"`, make sure those IDs are actually created as interaction types during setup.
|
|
45
|
+
|
|
34
46
|
---
|
|
35
47
|
|
|
36
48
|
## Common Use Cases
|
|
@@ -101,6 +113,8 @@ const { items } = await SL.interactions.publicList(collectionId, { appId: 'my-ap
|
|
|
101
113
|
|
|
102
114
|
## Logging Events
|
|
103
115
|
|
|
116
|
+
Before logging events, ensure the referenced interaction type already exists. Event ingestion is not intended to create new interaction definitions.
|
|
117
|
+
|
|
104
118
|
### Admin Event Append
|
|
105
119
|
|
|
106
120
|
Use on the server side or in admin flows. Requires `userId` **or** `contactId`.
|
|
@@ -166,7 +180,7 @@ await SL.interactions.updateEvent(collectionId, {
|
|
|
166
180
|
|
|
167
181
|
| Field | Type | Required | Description |
|
|
168
182
|
|-------|------|----------|-------------|
|
|
169
|
-
| `interactionId` | string | ✅ |
|
|
183
|
+
| `interactionId` | string | ✅ | Existing interaction type ID (must already be defined in this collection) |
|
|
170
184
|
| `userId` or `contactId` | string | ✅ (one of) | The actor. `appendEvent` / `updateEvent` require one of these |
|
|
171
185
|
| `appId` | string | ❌ | Scopes the event to your app |
|
|
172
186
|
| `outcome` | string | ❌ | The result or choice — what `countsByOutcome()` aggregates |
|
package/dist/docs/loyalty.md
CHANGED
|
@@ -120,6 +120,8 @@ const { items } = await SL.loyalty.publicGetMineHistory(collectionId, schemeId,
|
|
|
120
120
|
|
|
121
121
|
Earning rules are the control plane that connects interactions to point awards. The server evaluates them automatically — your app never sets a point value directly.
|
|
122
122
|
|
|
123
|
+
Every `interactionId` in a loyalty rule must reference an existing interaction type definition in the same collection.
|
|
124
|
+
|
|
123
125
|
### Create a Rule
|
|
124
126
|
|
|
125
127
|
```typescript
|
package/dist/docs/overview.md
CHANGED
|
@@ -227,6 +227,8 @@ See `docs/ai.md` for complete documentation.
|
|
|
227
227
|
|
|
228
228
|
The `SL.interactions` namespace tracks user engagement — competition entries, votes, form submissions, warranty registrations. Events can trigger automated journeys and communications.
|
|
229
229
|
|
|
230
|
+
Important: create interaction type definitions first, then submit events using those existing IDs. Do not invent `interactionId` values in client code.
|
|
231
|
+
|
|
230
232
|
Key functions: `submitPublicEvent()`, `appendEvent()` (admin), `countsByOutcome()`, `query()`.
|
|
231
233
|
|
|
232
234
|
See `docs/interactions.md` for complete documentation.
|
package/dist/docs/realtime.md
CHANGED
|
@@ -590,6 +590,7 @@ When a user votes, publish to the channel:
|
|
|
590
590
|
```typescript
|
|
591
591
|
const submitVote = async (option: string) => {
|
|
592
592
|
// Record in SmartLinks
|
|
593
|
+
// 'poll' must already exist as an interaction type definition for this collection.
|
|
593
594
|
await SL.interactions.submitPublicEvent(collectionId, {
|
|
594
595
|
appId,
|
|
595
596
|
interactionId: 'poll',
|
package/dist/openapi.yaml
CHANGED
|
@@ -17871,9 +17871,6 @@ components:
|
|
|
17871
17871
|
type: string
|
|
17872
17872
|
redirectUrl:
|
|
17873
17873
|
type: string
|
|
17874
|
-
required:
|
|
17875
|
-
- phoneNumber
|
|
17876
|
-
- redirectUrl
|
|
17877
17874
|
SendWhatsAppResponse:
|
|
17878
17875
|
type: object
|
|
17879
17876
|
properties:
|
package/dist/types/authKit.d.ts
CHANGED
|
@@ -77,8 +77,8 @@ export interface EmailVerifyTokenResponse {
|
|
|
77
77
|
}
|
|
78
78
|
export type VerifyStatus = 'pending' | 'verified' | 'failed' | 'expired' | 'unknown';
|
|
79
79
|
export interface SendWhatsAppRequest {
|
|
80
|
-
phoneNumber
|
|
81
|
-
redirectUrl
|
|
80
|
+
phoneNumber?: string;
|
|
81
|
+
redirectUrl?: string;
|
|
82
82
|
}
|
|
83
83
|
export interface SendWhatsAppResponse {
|
|
84
84
|
waLink: string;
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.11 | Generated: 2026-05-13T07:57:31.015Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -3027,8 +3027,8 @@ interface EmailVerifyTokenResponse {
|
|
|
3027
3027
|
**SendWhatsAppRequest** (interface)
|
|
3028
3028
|
```typescript
|
|
3029
3029
|
interface SendWhatsAppRequest {
|
|
3030
|
-
phoneNumber
|
|
3031
|
-
redirectUrl
|
|
3030
|
+
phoneNumber?: string
|
|
3031
|
+
redirectUrl?: string
|
|
3032
3032
|
}
|
|
3033
3033
|
```
|
|
3034
3034
|
|
|
@@ -8192,7 +8192,7 @@ Send phone verification code (public).
|
|
|
8192
8192
|
**verifyPhoneCode**(clientId: string, phoneNumber: string, code: string) → `Promise<PhoneVerifyResponse>`
|
|
8193
8193
|
Verify phone verification code (public).
|
|
8194
8194
|
|
|
8195
|
-
**sendWhatsApp**(clientId: string, body: SendWhatsAppRequest) → `Promise<SendWhatsAppResponse>`
|
|
8195
|
+
**sendWhatsApp**(clientId: string, body: SendWhatsAppRequest = {}) → `Promise<SendWhatsAppResponse>`
|
|
8196
8196
|
Send a WhatsApp verification deep-link (public).
|
|
8197
8197
|
|
|
8198
8198
|
**verifyWhatsApp**(clientId: string, token: string, phoneNumber: string) → `Promise<VerifyWhatsAppResponse>`
|
|
@@ -8803,54 +8803,54 @@ Legacy-friendly alias for aggregate().
|
|
|
8803
8803
|
|
|
8804
8804
|
**appendEvent**(collectionId: string,
|
|
8805
8805
|
body: AppendInteractionBody) → `Promise<`
|
|
8806
|
-
POST /admin/collection/:collectionId/interactions/append Appends one interaction event.
|
|
8806
|
+
POST /admin/collection/:collectionId/interactions/append Appends one interaction event. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions.
|
|
8807
8807
|
|
|
8808
8808
|
**updateEvent**(collectionId: string,
|
|
8809
8809
|
body: UpdateInteractionBody) → `Promise<`
|
|
8810
|
-
POST /admin/collection/:collectionId/interactions/append Appends one interaction event.
|
|
8810
|
+
POST /admin/collection/:collectionId/interactions/append Appends one interaction event. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions.
|
|
8811
8811
|
|
|
8812
8812
|
**submitPublicEvent**(collectionId: string,
|
|
8813
8813
|
body: AppendInteractionBody) → `Promise<SubmitInteractionResponse | SubmitInteractionError>`
|
|
8814
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8814
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8815
8815
|
|
|
8816
8816
|
**create**(collectionId: string,
|
|
8817
8817
|
body: CreateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
|
|
8818
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8818
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8819
8819
|
|
|
8820
8820
|
**list**(collectionId: string,
|
|
8821
8821
|
query: ListInteractionTypesQuery = {}) → `Promise<InteractionTypeList>`
|
|
8822
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8822
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8823
8823
|
|
|
8824
8824
|
**get**(collectionId: string,
|
|
8825
8825
|
id: string) → `Promise<InteractionTypeRecord>`
|
|
8826
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8826
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8827
8827
|
|
|
8828
8828
|
**update**(collectionId: string,
|
|
8829
8829
|
id: string,
|
|
8830
8830
|
patchBody: UpdateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
|
|
8831
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8831
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8832
8832
|
|
|
8833
8833
|
**remove**(collectionId: string,
|
|
8834
8834
|
id: string) → `Promise<void>`
|
|
8835
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8835
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8836
8836
|
|
|
8837
8837
|
**publicCountsByOutcome**(collectionId: string,
|
|
8838
8838
|
body: PublicInteractionsCountsByOutcomeRequest,
|
|
8839
8839
|
authToken?: string) → `Promise<OutcomeCount[]>`
|
|
8840
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8840
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8841
8841
|
|
|
8842
8842
|
**publicMyInteractions**(collectionId: string,
|
|
8843
8843
|
body: PublicInteractionsByUserRequest,
|
|
8844
8844
|
authToken?: string) → `Promise<InteractionEventRow[]>`
|
|
8845
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8845
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8846
8846
|
|
|
8847
8847
|
**publicList**(collectionId: string,
|
|
8848
8848
|
query: ListInteractionTypesQuery = {}) → `Promise<InteractionTypeList>`
|
|
8849
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8849
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8850
8850
|
|
|
8851
8851
|
**publicGet**(collectionId: string,
|
|
8852
8852
|
id: string) → `Promise<InteractionTypeRecord>`
|
|
8853
|
-
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8853
|
+
POST /api/v1/public/collection/:collectionId/interactions/submit Submits an interaction event from a public/client-side context. `interactionId` must reference an existing interaction type definition. This endpoint does not create interaction definitions. When the interaction has `allowAnonymousSubmit: true`, neither `userId` nor `contactId` is required. Pass `anonId` inside `metadata` to enable device-level deduplication via `uniquePerAnonId`.
|
|
8854
8854
|
|
|
8855
8855
|
### jobs
|
|
8856
8856
|
|
|
@@ -225,6 +225,8 @@ await SL.appConfiguration.setConfig({
|
|
|
225
225
|
|
|
226
226
|
### Tracked Interactions
|
|
227
227
|
|
|
228
|
+
Use interaction IDs that are defined via `SL.interactions.create(...)` for the collection. Do not invent ad-hoc IDs in app code.
|
|
229
|
+
|
|
228
230
|
| Interaction ID | Description |
|
|
229
231
|
| -------------- | --------------------------------------------- |
|
|
230
232
|
| `page-view` | Tracks each time a user views the public page |
|
package/docs/auth-kit.md
CHANGED
|
@@ -86,10 +86,12 @@ Use these flows when you want low-friction verification before or without full a
|
|
|
86
86
|
import { authKit } from '@proveanything/smartlinks';
|
|
87
87
|
|
|
88
88
|
// 1) Send WhatsApp verification deep link
|
|
89
|
-
const wa = await authKit.sendWhatsApp(clientId
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
const wa = await authKit.sendWhatsApp(clientId);
|
|
90
|
+
|
|
91
|
+
// Optional: pass redirect context only
|
|
92
|
+
// const wa = await authKit.sendWhatsApp(clientId, {
|
|
93
|
+
// redirectUrl: 'https://app.example.com/checkout/continue',
|
|
94
|
+
// });
|
|
93
95
|
|
|
94
96
|
// wa.waLink can be opened directly by the app/browser
|
|
95
97
|
// Poll status while user switches to WhatsApp and back
|
package/docs/interactions.md
CHANGED
|
@@ -15,15 +15,19 @@ Interactions have two distinct layers:
|
|
|
15
15
|
| **Interaction Types** | Definitions stored in the database — configure an interaction's ID, permissions, and display metadata once per collection |
|
|
16
16
|
| **Interaction Events** | Individual event records logged each time a user performs that interaction |
|
|
17
17
|
|
|
18
|
+
Critical rule: event `interactionId` values must reference an existing interaction type definition in that collection. Do not generate random IDs in app code and submit events against them.
|
|
19
|
+
|
|
18
20
|
```text
|
|
19
21
|
┌──────────────────────────────────────────────────────────────────┐
|
|
20
22
|
│ Your App │
|
|
21
23
|
│ │
|
|
22
24
|
│ 1. Create type once: interactions.create(collectionId, { │
|
|
23
25
|
│ id: 'vote', permissions: { uniquePerUser: true } }) │
|
|
26
|
+
│ -> definition exists in platform │
|
|
24
27
|
│ │
|
|
25
28
|
│ 2. Log events: interactions.appendEvent(collectionId, { │
|
|
26
29
|
│ interactionId: 'vote', outcome: 'option-a', userId }) │
|
|
30
|
+
│ (must match the created definition ID) │
|
|
27
31
|
│ │
|
|
28
32
|
│ 3. Read results: interactions.countsByOutcome(collectionId, │
|
|
29
33
|
│ { interactionId: 'vote' }) │
|
|
@@ -31,6 +35,14 @@ Interactions have two distinct layers:
|
|
|
31
35
|
└──────────────────────────────────────────────────────────────────┘
|
|
32
36
|
```
|
|
33
37
|
|
|
38
|
+
### Required Workflow (Do Not Invent IDs)
|
|
39
|
+
|
|
40
|
+
1. Create an interaction type definition (admin endpoint) before recording any events.
|
|
41
|
+
2. Reuse that same definition ID for every `appendEvent` / `submitPublicEvent` call.
|
|
42
|
+
3. Treat unknown IDs as configuration errors, not as values your app should auto-create.
|
|
43
|
+
|
|
44
|
+
If your app currently hardcodes strings like `"poll"` or `"entry"`, make sure those IDs are actually created as interaction types during setup.
|
|
45
|
+
|
|
34
46
|
---
|
|
35
47
|
|
|
36
48
|
## Common Use Cases
|
|
@@ -101,6 +113,8 @@ const { items } = await SL.interactions.publicList(collectionId, { appId: 'my-ap
|
|
|
101
113
|
|
|
102
114
|
## Logging Events
|
|
103
115
|
|
|
116
|
+
Before logging events, ensure the referenced interaction type already exists. Event ingestion is not intended to create new interaction definitions.
|
|
117
|
+
|
|
104
118
|
### Admin Event Append
|
|
105
119
|
|
|
106
120
|
Use on the server side or in admin flows. Requires `userId` **or** `contactId`.
|
|
@@ -166,7 +180,7 @@ await SL.interactions.updateEvent(collectionId, {
|
|
|
166
180
|
|
|
167
181
|
| Field | Type | Required | Description |
|
|
168
182
|
|-------|------|----------|-------------|
|
|
169
|
-
| `interactionId` | string | ✅ |
|
|
183
|
+
| `interactionId` | string | ✅ | Existing interaction type ID (must already be defined in this collection) |
|
|
170
184
|
| `userId` or `contactId` | string | ✅ (one of) | The actor. `appendEvent` / `updateEvent` require one of these |
|
|
171
185
|
| `appId` | string | ❌ | Scopes the event to your app |
|
|
172
186
|
| `outcome` | string | ❌ | The result or choice — what `countsByOutcome()` aggregates |
|
package/docs/loyalty.md
CHANGED
|
@@ -120,6 +120,8 @@ const { items } = await SL.loyalty.publicGetMineHistory(collectionId, schemeId,
|
|
|
120
120
|
|
|
121
121
|
Earning rules are the control plane that connects interactions to point awards. The server evaluates them automatically — your app never sets a point value directly.
|
|
122
122
|
|
|
123
|
+
Every `interactionId` in a loyalty rule must reference an existing interaction type definition in the same collection.
|
|
124
|
+
|
|
123
125
|
### Create a Rule
|
|
124
126
|
|
|
125
127
|
```typescript
|
package/docs/overview.md
CHANGED
|
@@ -227,6 +227,8 @@ See `docs/ai.md` for complete documentation.
|
|
|
227
227
|
|
|
228
228
|
The `SL.interactions` namespace tracks user engagement — competition entries, votes, form submissions, warranty registrations. Events can trigger automated journeys and communications.
|
|
229
229
|
|
|
230
|
+
Important: create interaction type definitions first, then submit events using those existing IDs. Do not invent `interactionId` values in client code.
|
|
231
|
+
|
|
230
232
|
Key functions: `submitPublicEvent()`, `appendEvent()` (admin), `countsByOutcome()`, `query()`.
|
|
231
233
|
|
|
232
234
|
See `docs/interactions.md` for complete documentation.
|
package/docs/realtime.md
CHANGED
|
@@ -590,6 +590,7 @@ When a user votes, publish to the channel:
|
|
|
590
590
|
```typescript
|
|
591
591
|
const submitVote = async (option: string) => {
|
|
592
592
|
// Record in SmartLinks
|
|
593
|
+
// 'poll' must already exist as an interaction type definition for this collection.
|
|
593
594
|
await SL.interactions.submitPublicEvent(collectionId, {
|
|
594
595
|
appId,
|
|
595
596
|
interactionId: 'poll',
|
package/openapi.yaml
CHANGED
|
@@ -17871,9 +17871,6 @@ components:
|
|
|
17871
17871
|
type: string
|
|
17872
17872
|
redirectUrl:
|
|
17873
17873
|
type: string
|
|
17874
|
-
required:
|
|
17875
|
-
- phoneNumber
|
|
17876
|
-
- redirectUrl
|
|
17877
17874
|
SendWhatsAppResponse:
|
|
17878
17875
|
type: object
|
|
17879
17876
|
properties:
|