@proveanything/smartlinks 1.13.6 → 1.13.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -14
- package/dist/README.md +15 -10
- package/dist/api/analytics.js +6 -3
- package/dist/api/appObjects.d.ts +5 -2
- package/dist/api/appObjects.js +5 -2
- package/dist/api/authKit.d.ts +13 -1
- package/dist/api/authKit.js +34 -0
- package/dist/api/comms.d.ts +1 -1
- package/dist/api/comms.js +14 -3
- package/dist/docs/API_SUMMARY.md +254 -32
- package/dist/docs/auth-kit.md +55 -0
- package/dist/docs/comms.md +4 -4
- package/dist/docs/interactions.md +200 -0
- package/dist/docs/overview.md +2 -0
- package/dist/openapi.yaml +532 -35
- package/dist/types/appObjects.d.ts +5 -0
- package/dist/types/authKit.d.ts +57 -0
- package/dist/types/comms.d.ts +6 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/interaction.d.ts +97 -0
- package/docs/API_SUMMARY.md +254 -32
- package/docs/auth-kit.md +55 -0
- package/docs/comms.md +4 -4
- package/docs/interactions.md +200 -0
- package/docs/overview.md +2 -0
- package/openapi.yaml +532 -35
- package/package.json +1 -1
package/dist/types/comms.d.ts
CHANGED
|
@@ -280,7 +280,7 @@ export interface SubscriptionsResolveResponse {
|
|
|
280
280
|
* No broadcast record is created; the send is logged directly to the
|
|
281
281
|
* contact's communication history with sourceType: 'transactional'.
|
|
282
282
|
*
|
|
283
|
-
* POST /admin/collection/:collectionId/comm
|
|
283
|
+
* POST /admin/collection/:collectionId/comm/send
|
|
284
284
|
*/
|
|
285
285
|
export interface TransactionalSendRequest {
|
|
286
286
|
/** CRM contact UUID */
|
|
@@ -290,9 +290,9 @@ export interface TransactionalSendRequest {
|
|
|
290
290
|
/**
|
|
291
291
|
* Channel to send on. Defaults to 'preferred', which auto-selects the
|
|
292
292
|
* contact's best available channel respecting consent, suppression, and
|
|
293
|
-
|
|
293
|
+
* template availability.
|
|
294
294
|
*/
|
|
295
|
-
channel?: 'email' | 'sms' | 'push' | 'wallet' | 'preferred';
|
|
295
|
+
channel?: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred';
|
|
296
296
|
/** Extra Liquid variables merged into the top-level render context */
|
|
297
297
|
props?: Record<string, unknown>;
|
|
298
298
|
/** Context objects to hydrate into the Liquid template */
|
|
@@ -320,8 +320,8 @@ export interface TransactionalSendRequest {
|
|
|
320
320
|
export interface TransactionalSendResponse {
|
|
321
321
|
ok: true;
|
|
322
322
|
/** The channel the message was actually sent on */
|
|
323
|
-
channel: 'email' | 'sms' | 'push' | 'wallet';
|
|
324
|
-
/** Provider message ID (email/SMS); absent for push/wallet */
|
|
323
|
+
channel: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet';
|
|
324
|
+
/** Provider message ID (email/SMS/WhatsApp); absent for push/wallet */
|
|
325
325
|
messageId?: string;
|
|
326
326
|
}
|
|
327
327
|
export interface TransactionalSendError {
|
|
@@ -333,6 +333,7 @@ export interface TransactionalSendError {
|
|
|
333
333
|
* - `transactional.no_channel_available`
|
|
334
334
|
* - `transactional.email_missing`
|
|
335
335
|
* - `transactional.phone_missing`
|
|
336
|
+
* - `transactional.whatsapp_missing`
|
|
336
337
|
* - `transactional.no_push_methods`
|
|
337
338
|
* - `transactional.no_wallet_methods`
|
|
338
339
|
*/
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -185,6 +185,7 @@ export interface InteractionTypeRecord {
|
|
|
185
185
|
display?: InteractionDisplay;
|
|
186
186
|
scopes?: Record<string, InteractionDisplay>;
|
|
187
187
|
interactionType?: string;
|
|
188
|
+
effects?: InteractionEffect[];
|
|
188
189
|
[key: string]: unknown;
|
|
189
190
|
};
|
|
190
191
|
createdAt: string;
|
|
@@ -218,3 +219,99 @@ export interface SubmitInteractionError {
|
|
|
218
219
|
error: 'FORBIDDEN';
|
|
219
220
|
reason: 'not_public' | 'auth_required' | 'duplicate' | 'duplicate_anon' | 'disabled' | 'before_start' | 'after_end' | 'origin_forbidden';
|
|
220
221
|
}
|
|
222
|
+
export type EffectType = 'loyalty' | 'transactional' | 'webhook' | 'tag' | 'appRecord' | 'segment';
|
|
223
|
+
export interface InteractionEffect {
|
|
224
|
+
type: EffectType;
|
|
225
|
+
config?: EffectConfig;
|
|
226
|
+
}
|
|
227
|
+
export type EffectConfig = LoyaltyEffectConfig | TransactionalEffectConfig | WebhookEffectConfig | TagEffectConfig | AppRecordEffectConfig | SegmentEffectConfig;
|
|
228
|
+
/** No config required — earning rules are driven by the interactionId */
|
|
229
|
+
export interface LoyaltyEffectConfig {
|
|
230
|
+
[key: string]: never;
|
|
231
|
+
}
|
|
232
|
+
export interface TransactionalEffectConfig {
|
|
233
|
+
/** Required. Firestore template ID */
|
|
234
|
+
templateId: string;
|
|
235
|
+
/**
|
|
236
|
+
* Channel to use.
|
|
237
|
+
* Default: 'preferred' — auto-selects the contact's best available channel.
|
|
238
|
+
*/
|
|
239
|
+
channel?: 'email' | 'sms' | 'push' | 'whatsapp' | 'wallet' | 'preferred';
|
|
240
|
+
/** Additional Liquid variables. Supports {{token}} interpolation. */
|
|
241
|
+
props?: Record<string, unknown>;
|
|
242
|
+
/** Hydration directives. productId/proofId default to the event's own values. */
|
|
243
|
+
include?: {
|
|
244
|
+
productId?: string;
|
|
245
|
+
proofId?: string;
|
|
246
|
+
user?: boolean;
|
|
247
|
+
appCase?: string;
|
|
248
|
+
appThread?: string;
|
|
249
|
+
appRecord?: string;
|
|
250
|
+
};
|
|
251
|
+
/** Override the appId logged on the comms event row. */
|
|
252
|
+
appId?: string;
|
|
253
|
+
}
|
|
254
|
+
export interface WebhookEffectConfig {
|
|
255
|
+
/** Required. Target URL. Supports {{token}} interpolation. */
|
|
256
|
+
url: string;
|
|
257
|
+
/** HTTP verb. Default: 'POST' */
|
|
258
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
259
|
+
/** Additional HTTP headers. Supports {{token}} interpolation on values. */
|
|
260
|
+
headers?: Record<string, string>;
|
|
261
|
+
/** JSON body template. Supports {{token}} interpolation on string values. */
|
|
262
|
+
body?: Record<string, unknown>;
|
|
263
|
+
/** Request timeout in milliseconds. Default: 10000 */
|
|
264
|
+
timeout?: number;
|
|
265
|
+
}
|
|
266
|
+
export interface TagEffectConfig {
|
|
267
|
+
/** One or more tag strings to add or remove. Supports {{token}} interpolation. */
|
|
268
|
+
tags: string[];
|
|
269
|
+
/** Default: 'add' */
|
|
270
|
+
action?: 'add' | 'remove';
|
|
271
|
+
}
|
|
272
|
+
export interface AppRecordEffectConfig {
|
|
273
|
+
/** Override the appId for the created record. */
|
|
274
|
+
appId?: string;
|
|
275
|
+
/** Record type identifier. Default: 'default' */
|
|
276
|
+
recordType?: string;
|
|
277
|
+
/**
|
|
278
|
+
* Singleton cardinality key. At most one record per recordType+singletonPer will
|
|
279
|
+
* exist per scope. Common values: 'contact', 'product', 'proof', 'global'
|
|
280
|
+
*/
|
|
281
|
+
singletonPer?: string;
|
|
282
|
+
/** Data object stored on the record. Supports {{token}} interpolation. */
|
|
283
|
+
data?: Record<string, unknown>;
|
|
284
|
+
/** Override scope anchors. Defaults to the event's own ids. */
|
|
285
|
+
anchors?: {
|
|
286
|
+
productId?: string;
|
|
287
|
+
proofId?: string;
|
|
288
|
+
variantId?: string;
|
|
289
|
+
batchId?: string;
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
export interface SegmentEffectConfig {
|
|
293
|
+
/** Required. UUID of the static segment to modify */
|
|
294
|
+
segmentId: string;
|
|
295
|
+
/** Default: 'add' */
|
|
296
|
+
action?: 'add' | 'remove';
|
|
297
|
+
}
|
|
298
|
+
/** Shape of the event context used for {{token}} interpolation in effect configs */
|
|
299
|
+
export interface InteractionEventContext {
|
|
300
|
+
eventId: string | null;
|
|
301
|
+
collectionId: string;
|
|
302
|
+
appId: string | null;
|
|
303
|
+
interactionId: string | null;
|
|
304
|
+
contactId: string | null;
|
|
305
|
+
userId: string | null;
|
|
306
|
+
productId: string | null;
|
|
307
|
+
proofId: string | null;
|
|
308
|
+
variantId: string | null;
|
|
309
|
+
batchId: string | null;
|
|
310
|
+
outcome: string | null;
|
|
311
|
+
eventType: string | null;
|
|
312
|
+
source: string | null;
|
|
313
|
+
timestamp: string | null;
|
|
314
|
+
metadata: Record<string, unknown>;
|
|
315
|
+
broadcastId: string | null;
|
|
316
|
+
journeyId: string | null;
|
|
317
|
+
}
|
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.9 | Generated: 2026-05-12T11:17:48.753Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -1725,7 +1725,7 @@ interface ListQueryParams {
|
|
|
1725
1725
|
offset?: number // default 0
|
|
1726
1726
|
sort?: string // field:asc or field:desc
|
|
1727
1727
|
includeDeleted?: boolean // admin only
|
|
1728
|
-
status?: string // exact or in:a,b,c
|
|
1728
|
+
status?: string // exact or in:a,b,c. For app.records on public/owner endpoints, only active records are returned.
|
|
1729
1729
|
productId?: string
|
|
1730
1730
|
createdAt?: string // gte:2024-01-01, lte:2024-12-31, or ISO date string
|
|
1731
1731
|
updatedAt?: string // same format
|
|
@@ -3024,6 +3024,98 @@ interface EmailVerifyTokenResponse {
|
|
|
3024
3024
|
}
|
|
3025
3025
|
```
|
|
3026
3026
|
|
|
3027
|
+
**SendWhatsAppRequest** (interface)
|
|
3028
|
+
```typescript
|
|
3029
|
+
interface SendWhatsAppRequest {
|
|
3030
|
+
phoneNumber: string
|
|
3031
|
+
redirectUrl: string
|
|
3032
|
+
}
|
|
3033
|
+
```
|
|
3034
|
+
|
|
3035
|
+
**SendWhatsAppResponse** (interface)
|
|
3036
|
+
```typescript
|
|
3037
|
+
interface SendWhatsAppResponse {
|
|
3038
|
+
waLink: string
|
|
3039
|
+
code: string
|
|
3040
|
+
token: string
|
|
3041
|
+
expiresAt: string
|
|
3042
|
+
}
|
|
3043
|
+
```
|
|
3044
|
+
|
|
3045
|
+
**VerifyWhatsAppResponse** (interface)
|
|
3046
|
+
```typescript
|
|
3047
|
+
interface VerifyWhatsAppResponse {
|
|
3048
|
+
success: boolean
|
|
3049
|
+
verified: boolean
|
|
3050
|
+
redirectUrl?: string | null
|
|
3051
|
+
}
|
|
3052
|
+
```
|
|
3053
|
+
|
|
3054
|
+
**WhatsAppStatusResponse** (interface)
|
|
3055
|
+
```typescript
|
|
3056
|
+
interface WhatsAppStatusResponse {
|
|
3057
|
+
ok: boolean
|
|
3058
|
+
status: VerifyStatus
|
|
3059
|
+
verified: boolean
|
|
3060
|
+
redirectUrl?: string | null
|
|
3061
|
+
phoneNumber?: string | null
|
|
3062
|
+
updatedAt?: unknown
|
|
3063
|
+
}
|
|
3064
|
+
```
|
|
3065
|
+
|
|
3066
|
+
**SendSmsVerifyRequest** (interface)
|
|
3067
|
+
```typescript
|
|
3068
|
+
interface SendSmsVerifyRequest {
|
|
3069
|
+
phoneNumber: string
|
|
3070
|
+
redirectUrl: string
|
|
3071
|
+
ctaText?: string
|
|
3072
|
+
}
|
|
3073
|
+
```
|
|
3074
|
+
|
|
3075
|
+
**SendSmsVerifyResponse** (interface)
|
|
3076
|
+
```typescript
|
|
3077
|
+
interface SendSmsVerifyResponse {
|
|
3078
|
+
success: boolean
|
|
3079
|
+
expiresAt: string
|
|
3080
|
+
}
|
|
3081
|
+
```
|
|
3082
|
+
|
|
3083
|
+
**VerifySmsResponse** (interface)
|
|
3084
|
+
```typescript
|
|
3085
|
+
interface VerifySmsResponse {
|
|
3086
|
+
verified: boolean
|
|
3087
|
+
redirectUrl?: string | null
|
|
3088
|
+
phoneNumber?: string | null
|
|
3089
|
+
}
|
|
3090
|
+
```
|
|
3091
|
+
|
|
3092
|
+
**UpsertContactRequest** (interface)
|
|
3093
|
+
```typescript
|
|
3094
|
+
interface UpsertContactRequest {
|
|
3095
|
+
collectionId?: string
|
|
3096
|
+
phone?: string
|
|
3097
|
+
email?: string
|
|
3098
|
+
name?: string
|
|
3099
|
+
firstName?: string
|
|
3100
|
+
lastName?: string
|
|
3101
|
+
displayName?: string
|
|
3102
|
+
source?: string
|
|
3103
|
+
customFields?: Record<string, unknown>
|
|
3104
|
+
externalIds?: Record<string, unknown>
|
|
3105
|
+
}
|
|
3106
|
+
```
|
|
3107
|
+
|
|
3108
|
+
**UpsertContactResponse** (interface)
|
|
3109
|
+
```typescript
|
|
3110
|
+
interface UpsertContactResponse {
|
|
3111
|
+
ok: boolean
|
|
3112
|
+
collectionId: string
|
|
3113
|
+
contactId: string
|
|
3114
|
+
userId: string | null
|
|
3115
|
+
created: boolean
|
|
3116
|
+
}
|
|
3117
|
+
```
|
|
3118
|
+
|
|
3027
3119
|
**AuthKitBrandingConfig** (interface)
|
|
3028
3120
|
```typescript
|
|
3029
3121
|
interface AuthKitBrandingConfig {
|
|
@@ -3053,6 +3145,8 @@ interface AuthKitConfig {
|
|
|
3053
3145
|
}
|
|
3054
3146
|
```
|
|
3055
3147
|
|
|
3148
|
+
**VerifyStatus** = `'pending' | 'verified' | 'failed' | 'expired' | 'unknown'`
|
|
3149
|
+
|
|
3056
3150
|
### batch
|
|
3057
3151
|
|
|
3058
3152
|
**FirebaseTimestamp** (interface)
|
|
@@ -3820,8 +3914,8 @@ interface TransactionalSendRequest {
|
|
|
3820
3914
|
templateId: string
|
|
3821
3915
|
* Channel to send on. Defaults to 'preferred', which auto-selects the
|
|
3822
3916
|
* contact's best available channel respecting consent, suppression, and
|
|
3823
|
-
* template availability
|
|
3824
|
-
channel?: 'email' | 'sms' | 'push' | 'wallet' | 'preferred'
|
|
3917
|
+
* template availability.
|
|
3918
|
+
channel?: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred'
|
|
3825
3919
|
props?: Record<string, unknown>
|
|
3826
3920
|
include?: {
|
|
3827
3921
|
collection?: boolean
|
|
@@ -3841,7 +3935,7 @@ interface TransactionalSendRequest {
|
|
|
3841
3935
|
```typescript
|
|
3842
3936
|
interface TransactionalSendResponse {
|
|
3843
3937
|
ok: true
|
|
3844
|
-
channel: 'email' | 'sms' | 'push' | 'wallet'
|
|
3938
|
+
channel: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet'
|
|
3845
3939
|
messageId?: string
|
|
3846
3940
|
}
|
|
3847
3941
|
```
|
|
@@ -3856,6 +3950,7 @@ interface TransactionalSendError {
|
|
|
3856
3950
|
* - `transactional.no_channel_available`
|
|
3857
3951
|
* - `transactional.email_missing`
|
|
3858
3952
|
* - `transactional.phone_missing`
|
|
3953
|
+
* - `transactional.whatsapp_missing`
|
|
3859
3954
|
* - `transactional.no_push_methods`
|
|
3860
3955
|
* - `transactional.no_wallet_methods`
|
|
3861
3956
|
error: string
|
|
@@ -4129,7 +4224,7 @@ export interface SubscriptionsResolveResponse {
|
|
|
4129
4224
|
* No broadcast record is created; the send is logged directly to the
|
|
4130
4225
|
* contact's communication history with sourceType: 'transactional'.
|
|
4131
4226
|
*
|
|
4132
|
-
* POST /admin/collection/:collectionId/comm
|
|
4227
|
+
* POST /admin/collection/:collectionId/comm/send
|
|
4133
4228
|
*/
|
|
4134
4229
|
export interface TransactionalSendRequest {
|
|
4135
4230
|
/** CRM contact UUID */
|
|
@@ -4139,9 +4234,9 @@ export interface TransactionalSendRequest {
|
|
|
4139
4234
|
/**
|
|
4140
4235
|
* Channel to send on. Defaults to 'preferred', which auto-selects the
|
|
4141
4236
|
* contact's best available channel respecting consent, suppression, and
|
|
4142
|
-
|
|
4237
|
+
* template availability.
|
|
4143
4238
|
*/
|
|
4144
|
-
|
|
4239
|
+
channel?: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred'
|
|
4145
4240
|
/** Extra Liquid variables merged into the top-level render context */
|
|
4146
4241
|
props?: Record<string, unknown>
|
|
4147
4242
|
/** Context objects to hydrate into the Liquid template */
|
|
@@ -4170,8 +4265,8 @@ export interface TransactionalSendRequest {
|
|
|
4170
4265
|
export interface TransactionalSendResponse {
|
|
4171
4266
|
ok: true
|
|
4172
4267
|
/** The channel the message was actually sent on */
|
|
4173
|
-
channel: 'email' | 'sms' | 'push' | 'wallet'
|
|
4174
|
-
/** Provider message ID (email/SMS); absent for push/wallet */
|
|
4268
|
+
channel: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet'
|
|
4269
|
+
/** Provider message ID (email/SMS/WhatsApp); absent for push/wallet */
|
|
4175
4270
|
messageId?: string
|
|
4176
4271
|
}
|
|
4177
4272
|
|
|
@@ -4184,6 +4279,7 @@ export interface TransactionalSendError {
|
|
|
4184
4279
|
* - `transactional.no_channel_available`
|
|
4185
4280
|
* - `transactional.email_missing`
|
|
4186
4281
|
* - `transactional.phone_missing`
|
|
4282
|
+
* - `transactional.whatsapp_missing`
|
|
4187
4283
|
* - `transactional.no_push_methods`
|
|
4188
4284
|
* - `transactional.no_wallet_methods`
|
|
4189
4285
|
*/
|
|
@@ -5361,8 +5457,9 @@ interface InteractionTypeRecord {
|
|
|
5361
5457
|
permissions?: InteractionPermissions
|
|
5362
5458
|
data?: {
|
|
5363
5459
|
display?: InteractionDisplay
|
|
5364
|
-
scopes?: Record<string, InteractionDisplay
|
|
5460
|
+
scopes?: Record<string, InteractionDisplay>
|
|
5365
5461
|
interactionType?: string
|
|
5462
|
+
effects?: InteractionEffect[]
|
|
5366
5463
|
[key: string]: unknown
|
|
5367
5464
|
}
|
|
5368
5465
|
createdAt: string
|
|
@@ -5430,6 +5527,113 @@ interface SubmitInteractionError {
|
|
|
5430
5527
|
}
|
|
5431
5528
|
```
|
|
5432
5529
|
|
|
5530
|
+
**InteractionEffect** (interface)
|
|
5531
|
+
```typescript
|
|
5532
|
+
interface InteractionEffect {
|
|
5533
|
+
type: EffectType
|
|
5534
|
+
config?: EffectConfig
|
|
5535
|
+
}
|
|
5536
|
+
```
|
|
5537
|
+
|
|
5538
|
+
**LoyaltyEffectConfig** (interface)
|
|
5539
|
+
```typescript
|
|
5540
|
+
interface LoyaltyEffectConfig {
|
|
5541
|
+
[key: string]: never
|
|
5542
|
+
}
|
|
5543
|
+
```
|
|
5544
|
+
|
|
5545
|
+
**TransactionalEffectConfig** (interface)
|
|
5546
|
+
```typescript
|
|
5547
|
+
interface TransactionalEffectConfig {
|
|
5548
|
+
templateId: string
|
|
5549
|
+
* Channel to use.
|
|
5550
|
+
* Default: 'preferred' — auto-selects the contact's best available channel.
|
|
5551
|
+
channel?: 'email' | 'sms' | 'push' | 'whatsapp' | 'wallet' | 'preferred'
|
|
5552
|
+
props?: Record<string, unknown>
|
|
5553
|
+
include?: {
|
|
5554
|
+
productId?: string
|
|
5555
|
+
proofId?: string
|
|
5556
|
+
user?: boolean
|
|
5557
|
+
appCase?: string
|
|
5558
|
+
appThread?: string
|
|
5559
|
+
appRecord?: string
|
|
5560
|
+
}
|
|
5561
|
+
appId?: string
|
|
5562
|
+
}
|
|
5563
|
+
```
|
|
5564
|
+
|
|
5565
|
+
**WebhookEffectConfig** (interface)
|
|
5566
|
+
```typescript
|
|
5567
|
+
interface WebhookEffectConfig {
|
|
5568
|
+
url: string
|
|
5569
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
|
|
5570
|
+
headers?: Record<string, string>
|
|
5571
|
+
body?: Record<string, unknown>
|
|
5572
|
+
timeout?: number
|
|
5573
|
+
}
|
|
5574
|
+
```
|
|
5575
|
+
|
|
5576
|
+
**TagEffectConfig** (interface)
|
|
5577
|
+
```typescript
|
|
5578
|
+
interface TagEffectConfig {
|
|
5579
|
+
tags: string[]
|
|
5580
|
+
action?: 'add' | 'remove'
|
|
5581
|
+
}
|
|
5582
|
+
```
|
|
5583
|
+
|
|
5584
|
+
**AppRecordEffectConfig** (interface)
|
|
5585
|
+
```typescript
|
|
5586
|
+
interface AppRecordEffectConfig {
|
|
5587
|
+
appId?: string
|
|
5588
|
+
recordType?: string
|
|
5589
|
+
* Singleton cardinality key. At most one record per recordType+singletonPer will
|
|
5590
|
+
* exist per scope. Common values: 'contact', 'product', 'proof', 'global'
|
|
5591
|
+
singletonPer?: string
|
|
5592
|
+
data?: Record<string, unknown>
|
|
5593
|
+
anchors?: {
|
|
5594
|
+
productId?: string
|
|
5595
|
+
proofId?: string
|
|
5596
|
+
variantId?: string
|
|
5597
|
+
batchId?: string
|
|
5598
|
+
}
|
|
5599
|
+
}
|
|
5600
|
+
```
|
|
5601
|
+
|
|
5602
|
+
**SegmentEffectConfig** (interface)
|
|
5603
|
+
```typescript
|
|
5604
|
+
interface SegmentEffectConfig {
|
|
5605
|
+
segmentId: string
|
|
5606
|
+
action?: 'add' | 'remove'
|
|
5607
|
+
}
|
|
5608
|
+
```
|
|
5609
|
+
|
|
5610
|
+
**InteractionEventContext** (interface)
|
|
5611
|
+
```typescript
|
|
5612
|
+
interface InteractionEventContext {
|
|
5613
|
+
eventId: string | null
|
|
5614
|
+
collectionId: string
|
|
5615
|
+
appId: string | null
|
|
5616
|
+
interactionId: string | null
|
|
5617
|
+
contactId: string | null
|
|
5618
|
+
userId: string | null
|
|
5619
|
+
productId: string | null
|
|
5620
|
+
proofId: string | null
|
|
5621
|
+
variantId: string | null
|
|
5622
|
+
batchId: string | null
|
|
5623
|
+
outcome: string | null
|
|
5624
|
+
eventType: string | null
|
|
5625
|
+
source: string | null
|
|
5626
|
+
timestamp: string | null
|
|
5627
|
+
metadata: Record<string, unknown>
|
|
5628
|
+
broadcastId: string | null
|
|
5629
|
+
journeyId: string | null
|
|
5630
|
+
}
|
|
5631
|
+
```
|
|
5632
|
+
|
|
5633
|
+
**EffectType** = ``
|
|
5634
|
+
|
|
5635
|
+
**EffectConfig** = ``
|
|
5636
|
+
|
|
5433
5637
|
### jobs
|
|
5434
5638
|
|
|
5435
5639
|
**Job** (interface)
|
|
@@ -7583,7 +7787,7 @@ Create a new record POST /records When called on the public endpoint (admin = fa
|
|
|
7583
7787
|
appId: string,
|
|
7584
7788
|
params?: RecordListQueryParams,
|
|
7585
7789
|
admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
|
|
7586
|
-
List records with optional query parameters GET /records
|
|
7790
|
+
List records with optional query parameters GET /records Public/owner callers only receive records with `status: "active"`. Admin callers can query all statuses (for example `draft`/`archived`).
|
|
7587
7791
|
|
|
7588
7792
|
**get**(collectionId: string,
|
|
7589
7793
|
appId: string,
|
|
@@ -7997,62 +8201,80 @@ Send phone verification code (public).
|
|
|
7997
8201
|
**verifyPhoneCode**(clientId: string, phoneNumber: string, code: string) → `Promise<PhoneVerifyResponse>`
|
|
7998
8202
|
Verify phone verification code (public).
|
|
7999
8203
|
|
|
8204
|
+
**sendWhatsApp**(clientId: string, body: SendWhatsAppRequest) → `Promise<SendWhatsAppResponse>`
|
|
8205
|
+
Send a WhatsApp verification deep-link (public).
|
|
8206
|
+
|
|
8207
|
+
**verifyWhatsApp**(clientId: string, token: string, phoneNumber: string) → `Promise<VerifyWhatsAppResponse>`
|
|
8208
|
+
Manually verify WhatsApp token if inbound webhook path is unavailable (public).
|
|
8209
|
+
|
|
8210
|
+
**getWhatsAppStatus**(clientId: string, token: string) → `Promise<WhatsAppStatusResponse>`
|
|
8211
|
+
Poll WhatsApp verification status for a token (public).
|
|
8212
|
+
|
|
8213
|
+
**sendSmsVerify**(clientId: string, body: SendSmsVerifyRequest) → `Promise<SendSmsVerifyResponse>`
|
|
8214
|
+
Send an SMS click-to-verify link (public).
|
|
8215
|
+
|
|
8216
|
+
**verifySms**(clientId: string, token: string, phoneNumber?: string) → `Promise<VerifySmsResponse>`
|
|
8217
|
+
Verify an SMS click-to-verify token via API (public).
|
|
8218
|
+
|
|
8219
|
+
**upsertContact**(clientId: string, body: UpsertContactRequest) → `Promise<UpsertContactResponse>`
|
|
8220
|
+
Upsert contact identity after lightweight verification (public).
|
|
8221
|
+
|
|
8000
8222
|
**requestPasswordReset**(clientId: string, data: { email: string; redirectUrl?: string; clientName?: string }) → `Promise<PasswordResetRequestResponse>`
|
|
8001
|
-
|
|
8223
|
+
Upsert contact identity after lightweight verification (public).
|
|
8002
8224
|
|
|
8003
8225
|
**verifyResetToken**(clientId: string, token: string) → `Promise<VerifyResetTokenResponse>`
|
|
8004
|
-
|
|
8226
|
+
Upsert contact identity after lightweight verification (public).
|
|
8005
8227
|
|
|
8006
8228
|
**completePasswordReset**(clientId: string, token: string, newPassword: string) → `Promise<PasswordResetCompleteResponse>`
|
|
8007
|
-
|
|
8229
|
+
Upsert contact identity after lightweight verification (public).
|
|
8008
8230
|
|
|
8009
8231
|
**sendEmailVerification**(clientId: string, data: { userId: string; email: string; redirectUrl?: string; clientName?: string }) → `Promise<EmailVerificationActionResponse>`
|
|
8010
|
-
|
|
8232
|
+
Upsert contact identity after lightweight verification (public).
|
|
8011
8233
|
|
|
8012
8234
|
**verifyEmail**(clientId: string, token: string) → `Promise<EmailVerifyTokenResponse>`
|
|
8013
|
-
|
|
8235
|
+
Upsert contact identity after lightweight verification (public).
|
|
8014
8236
|
|
|
8015
8237
|
**resendEmailVerification**(clientId: string, data: { userId: string; email: string; redirectUrl?: string; clientName?: string }) → `Promise<EmailVerificationActionResponse>`
|
|
8016
|
-
|
|
8238
|
+
Upsert contact identity after lightweight verification (public).
|
|
8017
8239
|
|
|
8018
8240
|
**getProfile**(clientId: string) → `Promise<UserProfile>`
|
|
8019
|
-
|
|
8241
|
+
Upsert contact identity after lightweight verification (public).
|
|
8020
8242
|
|
|
8021
8243
|
**updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<UserProfile>`
|
|
8022
|
-
|
|
8244
|
+
Upsert contact identity after lightweight verification (public).
|
|
8023
8245
|
|
|
8024
8246
|
**changePassword**(clientId: string, currentPassword: string, newPassword: string) → `Promise<SuccessResponse>`
|
|
8025
|
-
|
|
8247
|
+
Upsert contact identity after lightweight verification (public).
|
|
8026
8248
|
|
|
8027
8249
|
**changeEmail**(clientId: string, newEmail: string, password: string, redirectUrl: string) → `Promise<SuccessResponse>`
|
|
8028
|
-
|
|
8250
|
+
Upsert contact identity after lightweight verification (public).
|
|
8029
8251
|
|
|
8030
8252
|
**verifyEmailChange**(clientId: string, token: string) → `Promise<SuccessResponse>`
|
|
8031
|
-
|
|
8253
|
+
Upsert contact identity after lightweight verification (public).
|
|
8032
8254
|
|
|
8033
8255
|
**updatePhone**(clientId: string, phoneNumber: string, verificationCode: string) → `Promise<SuccessResponse>`
|
|
8034
|
-
|
|
8256
|
+
Upsert contact identity after lightweight verification (public).
|
|
8035
8257
|
|
|
8036
8258
|
**deleteAccount**(clientId: string, password: string, confirmText: string) → `Promise<SuccessResponse>`
|
|
8037
|
-
|
|
8259
|
+
Upsert contact identity after lightweight verification (public).
|
|
8038
8260
|
|
|
8039
8261
|
**load**(authKitId: string) → `Promise<AuthKitConfig>`
|
|
8040
|
-
|
|
8262
|
+
Upsert contact identity after lightweight verification (public).
|
|
8041
8263
|
|
|
8042
8264
|
**get**(collectionId: string, authKitId: string) → `Promise<AuthKitConfig>`
|
|
8043
|
-
|
|
8265
|
+
Upsert contact identity after lightweight verification (public).
|
|
8044
8266
|
|
|
8045
8267
|
**list**(collectionId: string, admin?: boolean) → `Promise<AuthKitConfig[]>`
|
|
8046
|
-
|
|
8268
|
+
Upsert contact identity after lightweight verification (public).
|
|
8047
8269
|
|
|
8048
8270
|
**create**(collectionId: string, data: any) → `Promise<AuthKitConfig>`
|
|
8049
|
-
|
|
8271
|
+
Upsert contact identity after lightweight verification (public).
|
|
8050
8272
|
|
|
8051
8273
|
**update**(collectionId: string, authKitId: string, data: any) → `Promise<AuthKitConfig>`
|
|
8052
|
-
|
|
8274
|
+
Upsert contact identity after lightweight verification (public).
|
|
8053
8275
|
|
|
8054
8276
|
**remove**(collectionId: string, authKitId: string) → `Promise<void>`
|
|
8055
|
-
|
|
8277
|
+
Upsert contact identity after lightweight verification (public).
|
|
8056
8278
|
|
|
8057
8279
|
### batch
|
|
8058
8280
|
|
|
@@ -8336,7 +8558,7 @@ Analytics: Recipients who performed an action, optionally with outcome. POST /ad
|
|
|
8336
8558
|
|
|
8337
8559
|
**sendTransactional**(collectionId: string,
|
|
8338
8560
|
body: TransactionalSendRequest) → `Promise<TransactionalSendResult>`
|
|
8339
|
-
Send a single transactional message to one contact using a template. No broadcast record is created. The send is logged to the contact's communication history with sourceType: 'transactional'. POST /admin/collection/:collectionId/comm
|
|
8561
|
+
Send a single transactional message to one contact using a template. No broadcast record is created. The send is logged to the contact's communication history with sourceType: 'transactional'. POST /admin/collection/:collectionId/comm/send ```typescript const result = await comms.sendTransactional(collectionId, { contactId: 'e4f2a1b0-...', templateId: 'warranty-update', channel: 'preferred', props: { claimRef: 'CLM-0042', decision: 'approved' }, include: { productId: 'prod-abc123', appCase: 'c9d1e2f3-...' }, ref: 'warranty-decision-notification', appId: 'warrantyApp', }) if (result.ok) { console.log(`Sent via ${result.channel}`, result.messageId) } else { console.error('Send failed:', result.error) } ```
|
|
8340
8562
|
|
|
8341
8563
|
**logCommunicationEvent**(collectionId: string,
|
|
8342
8564
|
body: LogCommunicationEventBody) → `Promise<AppendResult>`
|
package/docs/auth-kit.md
CHANGED
|
@@ -78,6 +78,61 @@ await authKit.sendPhoneCode(clientId, '+61400000000');
|
|
|
78
78
|
const session = await authKit.verifyPhoneCode(clientId, '+61400000000', '123456');
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
### Lightweight verification (WhatsApp + SMS)
|
|
82
|
+
|
|
83
|
+
Use these flows when you want low-friction verification before or without full account sign-in.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { authKit } from '@proveanything/smartlinks';
|
|
87
|
+
|
|
88
|
+
// 1) Send WhatsApp verification deep link
|
|
89
|
+
const wa = await authKit.sendWhatsApp(clientId, {
|
|
90
|
+
phoneNumber: '+447911123456',
|
|
91
|
+
redirectUrl: 'https://app.example.com/checkout/continue',
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// wa.waLink can be opened directly by the app/browser
|
|
95
|
+
// Poll status while user switches to WhatsApp and back
|
|
96
|
+
const status = await authKit.getWhatsAppStatus(clientId, wa.token);
|
|
97
|
+
|
|
98
|
+
// Optional fallback path if webhook confirmation is unavailable
|
|
99
|
+
await authKit.verifyWhatsApp(clientId, wa.token, '+447911123456');
|
|
100
|
+
|
|
101
|
+
// 2) Or send SMS click-to-verify link
|
|
102
|
+
await authKit.sendSmsVerify(clientId, {
|
|
103
|
+
phoneNumber: '+447911123456',
|
|
104
|
+
redirectUrl: 'https://app.example.com/raffle/checkout',
|
|
105
|
+
ctaText: 'Tap to continue',
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Optional API verification path
|
|
109
|
+
await authKit.verifySms(clientId, '<token>', '+447911123456');
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Contact bootstrap / durable identity
|
|
113
|
+
|
|
114
|
+
After verification, upsert contact identity and store `contactId` on downstream records (raffle ticket, bid, claim intent).
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
const contact = await authKit.upsertContact(clientId, {
|
|
118
|
+
phone: '+447911123456',
|
|
119
|
+
name: 'Jane Doe',
|
|
120
|
+
source: 'raffle-checkout',
|
|
121
|
+
customFields: { channelVerified: 'whatsapp' },
|
|
122
|
+
externalIds: { raffleSessionId: 'rfl_123' },
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Persist these on your business record
|
|
126
|
+
// contact.contactId, contact.collectionId, verified channel, verifiedAt
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Verification status values returned by `authKit.getWhatsAppStatus` are:
|
|
130
|
+
- `pending`
|
|
131
|
+
- `verified`
|
|
132
|
+
- `failed`
|
|
133
|
+
- `expired`
|
|
134
|
+
- `unknown`
|
|
135
|
+
|
|
81
136
|
### Google OAuth
|
|
82
137
|
|
|
83
138
|
```ts
|