@proveanything/smartlinks 1.13.5 → 1.13.8

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.
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.13.5 | Generated: 2026-05-09T11:54:02.443Z
3
+ Version: 1.13.8 | Generated: 2026-05-11T12:03:30.435Z
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 (priority: email → push → sms → wallet).
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.send
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
- * template availability (priority: email → push → sms → wallet).
4237
+ * template availability.
4143
4238
  */
4144
- channel?: 'email' | 'sms' | 'push' | 'wallet' | 'preferred'
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
  */
@@ -7583,7 +7679,7 @@ Create a new record POST /records When called on the public endpoint (admin = fa
7583
7679
  appId: string,
7584
7680
  params?: RecordListQueryParams,
7585
7681
  admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
7586
- List records with optional query parameters GET /records
7682
+ 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
7683
 
7588
7684
  **get**(collectionId: string,
7589
7685
  appId: string,
@@ -7997,62 +8093,80 @@ Send phone verification code (public).
7997
8093
  **verifyPhoneCode**(clientId: string, phoneNumber: string, code: string) → `Promise<PhoneVerifyResponse>`
7998
8094
  Verify phone verification code (public).
7999
8095
 
8096
+ **sendWhatsApp**(clientId: string, body: SendWhatsAppRequest) → `Promise<SendWhatsAppResponse>`
8097
+ Send a WhatsApp verification deep-link (public).
8098
+
8099
+ **verifyWhatsApp**(clientId: string, token: string, phoneNumber: string) → `Promise<VerifyWhatsAppResponse>`
8100
+ Manually verify WhatsApp token if inbound webhook path is unavailable (public).
8101
+
8102
+ **getWhatsAppStatus**(clientId: string, token: string) → `Promise<WhatsAppStatusResponse>`
8103
+ Poll WhatsApp verification status for a token (public).
8104
+
8105
+ **sendSmsVerify**(clientId: string, body: SendSmsVerifyRequest) → `Promise<SendSmsVerifyResponse>`
8106
+ Send an SMS click-to-verify link (public).
8107
+
8108
+ **verifySms**(clientId: string, token: string, phoneNumber?: string) → `Promise<VerifySmsResponse>`
8109
+ Verify an SMS click-to-verify token via API (public).
8110
+
8111
+ **upsertContact**(clientId: string, body: UpsertContactRequest) → `Promise<UpsertContactResponse>`
8112
+ Upsert contact identity after lightweight verification (public).
8113
+
8000
8114
  **requestPasswordReset**(clientId: string, data: { email: string; redirectUrl?: string; clientName?: string }) → `Promise<PasswordResetRequestResponse>`
8001
- Verify phone verification code (public).
8115
+ Upsert contact identity after lightweight verification (public).
8002
8116
 
8003
8117
  **verifyResetToken**(clientId: string, token: string) → `Promise<VerifyResetTokenResponse>`
8004
- Verify phone verification code (public).
8118
+ Upsert contact identity after lightweight verification (public).
8005
8119
 
8006
8120
  **completePasswordReset**(clientId: string, token: string, newPassword: string) → `Promise<PasswordResetCompleteResponse>`
8007
- Verify phone verification code (public).
8121
+ Upsert contact identity after lightweight verification (public).
8008
8122
 
8009
8123
  **sendEmailVerification**(clientId: string, data: { userId: string; email: string; redirectUrl?: string; clientName?: string }) → `Promise<EmailVerificationActionResponse>`
8010
- Verify phone verification code (public).
8124
+ Upsert contact identity after lightweight verification (public).
8011
8125
 
8012
8126
  **verifyEmail**(clientId: string, token: string) → `Promise<EmailVerifyTokenResponse>`
8013
- Verify phone verification code (public).
8127
+ Upsert contact identity after lightweight verification (public).
8014
8128
 
8015
8129
  **resendEmailVerification**(clientId: string, data: { userId: string; email: string; redirectUrl?: string; clientName?: string }) → `Promise<EmailVerificationActionResponse>`
8016
- Verify phone verification code (public).
8130
+ Upsert contact identity after lightweight verification (public).
8017
8131
 
8018
8132
  **getProfile**(clientId: string) → `Promise<UserProfile>`
8019
- Verify phone verification code (public).
8133
+ Upsert contact identity after lightweight verification (public).
8020
8134
 
8021
8135
  **updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<UserProfile>`
8022
- Verify phone verification code (public).
8136
+ Upsert contact identity after lightweight verification (public).
8023
8137
 
8024
8138
  **changePassword**(clientId: string, currentPassword: string, newPassword: string) → `Promise<SuccessResponse>`
8025
- Verify phone verification code (public).
8139
+ Upsert contact identity after lightweight verification (public).
8026
8140
 
8027
8141
  **changeEmail**(clientId: string, newEmail: string, password: string, redirectUrl: string) → `Promise<SuccessResponse>`
8028
- Verify phone verification code (public).
8142
+ Upsert contact identity after lightweight verification (public).
8029
8143
 
8030
8144
  **verifyEmailChange**(clientId: string, token: string) → `Promise<SuccessResponse>`
8031
- Verify phone verification code (public).
8145
+ Upsert contact identity after lightweight verification (public).
8032
8146
 
8033
8147
  **updatePhone**(clientId: string, phoneNumber: string, verificationCode: string) → `Promise<SuccessResponse>`
8034
- Verify phone verification code (public).
8148
+ Upsert contact identity after lightweight verification (public).
8035
8149
 
8036
8150
  **deleteAccount**(clientId: string, password: string, confirmText: string) → `Promise<SuccessResponse>`
8037
- Verify phone verification code (public).
8151
+ Upsert contact identity after lightweight verification (public).
8038
8152
 
8039
8153
  **load**(authKitId: string) → `Promise<AuthKitConfig>`
8040
- Verify phone verification code (public).
8154
+ Upsert contact identity after lightweight verification (public).
8041
8155
 
8042
8156
  **get**(collectionId: string, authKitId: string) → `Promise<AuthKitConfig>`
8043
- Verify phone verification code (public).
8157
+ Upsert contact identity after lightweight verification (public).
8044
8158
 
8045
8159
  **list**(collectionId: string, admin?: boolean) → `Promise<AuthKitConfig[]>`
8046
- Verify phone verification code (public).
8160
+ Upsert contact identity after lightweight verification (public).
8047
8161
 
8048
8162
  **create**(collectionId: string, data: any) → `Promise<AuthKitConfig>`
8049
- Verify phone verification code (public).
8163
+ Upsert contact identity after lightweight verification (public).
8050
8164
 
8051
8165
  **update**(collectionId: string, authKitId: string, data: any) → `Promise<AuthKitConfig>`
8052
- Verify phone verification code (public).
8166
+ Upsert contact identity after lightweight verification (public).
8053
8167
 
8054
8168
  **remove**(collectionId: string, authKitId: string) → `Promise<void>`
8055
- Verify phone verification code (public).
8169
+ Upsert contact identity after lightweight verification (public).
8056
8170
 
8057
8171
  ### batch
8058
8172
 
@@ -8336,7 +8450,7 @@ Analytics: Recipients who performed an action, optionally with outcome. POST /ad
8336
8450
 
8337
8451
  **sendTransactional**(collectionId: string,
8338
8452
  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.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) } ```
8453
+ 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
8454
 
8341
8455
  **logCommunicationEvent**(collectionId: string,
8342
8456
  body: LogCommunicationEventBody) → `Promise<AppendResult>`
@@ -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
@@ -19,7 +19,7 @@ This guide covers the full communications surface of the SDK: transactional send
19
19
 
20
20
  Sends a single 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'`.
21
21
 
22
- **Endpoint:** `POST /admin/collection/:collectionId/comm.send`
22
+ **Endpoint:** `POST /admin/collection/:collectionId/comm/send`
23
23
 
24
24
  ```typescript
25
25
  import { comms } from '@proveanything/smartlinks'
@@ -28,7 +28,7 @@ import type { TransactionalSendRequest } from '@proveanything/smartlinks'
28
28
  const result = await comms.sendTransactional('collectionId', {
29
29
  contactId: 'e4f2a1b0-...',
30
30
  templateId: 'warranty-update',
31
- channel: 'preferred', // 'email' | 'sms' | 'push' | 'wallet' | 'preferred' (default)
31
+ channel: 'preferred', // 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred' (default)
32
32
  props: { claimRef: 'CLM-0042', decision: 'approved' },
33
33
  include: {
34
34
  productId: 'prod-abc123', // hydrate product context into template
@@ -51,7 +51,7 @@ if (result.ok) {
51
51
  |-------|------|-------------|
52
52
  | `contactId` | `string` | **Required.** Contact to send to. |
53
53
  | `templateId` | `string` | **Required.** Template to render. |
54
- | `channel` | `'email' \| 'sms' \| 'push' \| 'wallet' \| 'preferred'` | Channel to send on. `'preferred'` (default) picks the contact's best available channel. |
54
+ | `channel` | `'email' \| 'sms' \| 'whatsapp' \| 'push' \| 'wallet' \| 'preferred'` | Channel to send on. `'preferred'` (default) picks the contact's best available channel. |
55
55
  | `props` | `Record<string, unknown>` | Extra variables merged into template rendering. |
56
56
  | `include` | object | Hydration flags — see table below. |
57
57
  | `ref` | `string` | Arbitrary reference string stored with the event. |
@@ -73,7 +73,7 @@ if (result.ok) {
73
73
 
74
74
  ```typescript
75
75
  // Success
76
- { ok: true; channel: 'email' | 'sms' | 'push' | 'wallet'; messageId?: string }
76
+ { ok: true; channel: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet'; messageId?: string }
77
77
 
78
78
  // Failure
79
79
  { ok: false; error: string }
@@ -43,6 +43,8 @@ Widgets and containers run in the parent's React tree (not iframes). Mobile Admi
43
43
 
44
44
  The SmartLinks SDK (`@proveanything/smartlinks`) includes comprehensive documentation in `node_modules/@proveanything/smartlinks/docs/`. **Always read these files for detailed implementation guidance.**
45
45
 
46
+ > Product endpoints: use `products` (plural) for new integrations. The older `product` (singular) namespace remains for backward compatibility and is deprecated.
47
+
46
48
  > **Minimum SDK version: `1.4.1`** — Ensure `@proveanything/smartlinks` is at least this version. If not, update with `npm install @proveanything/smartlinks@latest`.
47
49
 
48
50
  | Topic | File | When to Use |