@kirimdev/sdk 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -98
- package/dist/generated/schema.d.ts +70 -3
- package/openapi.json +204 -5
- package/package.json +63 -63
package/README.md
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
# @kirimdev/sdk
|
|
2
|
-
|
|
3
|
-
Official TypeScript SDK for the [Kirimdev](https://kirimdev.com) Public API.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @kirimdev/sdk
|
|
9
|
-
# or
|
|
10
|
-
bun add @kirimdev/sdk
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Quickstart
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { Kirim } from '@kirimdev/sdk'
|
|
17
|
-
|
|
18
|
-
const kirim = new Kirim({ apiKey: process.env.KIRIM_API_KEY! })
|
|
19
|
-
|
|
20
|
-
// Scope to a WhatsApp phone number (Meta `business_phone_number_id`).
|
|
21
|
-
// Look it up via `kirim.accounts.list()` if you don't have it handy.
|
|
22
|
-
const phone = kirim.phoneNumbers('106540352242922')
|
|
23
|
-
|
|
24
|
-
// Send a message
|
|
25
|
-
const msg = await phone.messages.send({
|
|
26
|
-
messaging_product: 'whatsapp',
|
|
27
|
-
to: '628123456789',
|
|
28
|
-
type: 'text',
|
|
29
|
-
text: { body: 'Halo dari SDK!' },
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
// Paginate
|
|
33
|
-
for await (const m of phone.messages.list({ limit: 50 })) {
|
|
34
|
-
console.log(m.id, m.status)
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Webhook verification
|
|
39
|
-
|
|
40
|
-
`verifyWebhookSignature` parses the `X-Kirim-Signature` header (Stripe-style
|
|
41
|
-
`t=<unix>,v1=<hex>` format), checks the timestamp against a tolerance window,
|
|
42
|
-
verifies the HMAC-SHA256 against one or more active secrets (supports rotation),
|
|
43
|
-
and returns the parsed JSON body. It **throws** on every failure mode — never
|
|
44
|
-
returns `false`. Uses Web Crypto so it runs unchanged on Node 18+, Bun, Deno,
|
|
45
|
-
and edge runtimes.
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
import { verifyWebhookSignature, InvalidSignatureError } from '@kirimdev/sdk/webhooks'
|
|
49
|
-
|
|
50
|
-
export async function POST(req: Request) {
|
|
51
|
-
const rawBody = await req.text()
|
|
52
|
-
try {
|
|
53
|
-
const event = await verifyWebhookSignature({
|
|
54
|
-
rawBody,
|
|
55
|
-
signatureHeader: req.headers.get('x-kirim-signature'),
|
|
56
|
-
secrets: [process.env.KIRIM_WEBHOOK_SECRET!],
|
|
57
|
-
})
|
|
58
|
-
// event is KirimWebhookEvent — narrow on event.type or event.object
|
|
59
|
-
return new Response('ok')
|
|
60
|
-
} catch (err) {
|
|
61
|
-
if (err instanceof InvalidSignatureError) return new Response('bad sig', { status: 401 })
|
|
62
|
-
throw err
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Errors thrown (all extend `KirimWebhookError`):
|
|
68
|
-
|
|
69
|
-
- `InvalidSignatureError` — header missing/malformed, or no `v1=` matched any provided secret
|
|
70
|
-
- `SignatureExpiredError` — `|now - t|` exceeds `toleranceSeconds` (default 300s)
|
|
71
|
-
- `MalformedPayloadError` — signature matched but body is not valid JSON
|
|
72
|
-
|
|
73
|
-
## Features
|
|
74
|
-
|
|
75
|
-
- Full coverage of the Kirimdev `/v1` API (~35 endpoints)
|
|
76
|
-
- Type-safe — generated from the live OpenAPI 3.1 spec
|
|
77
|
-
- Automatic retries with exponential backoff (429, 5xx, network errors)
|
|
78
|
-
- Automatic `Idempotency-Key` injection for POST requests
|
|
79
|
-
- Async iterator pagination (`for await ... of kirim.messages.list(...)`)
|
|
80
|
-
- Typed error class hierarchy keyed off stable API error codes
|
|
81
|
-
- Webhook HMAC-SHA256 verifier
|
|
82
|
-
- Zero Node-specific dependencies — works in Node 18+, Bun, Deno
|
|
83
|
-
|
|
84
|
-
## Configuration
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
new Kirim({
|
|
88
|
-
apiKey: 'kdv_live_...', // required
|
|
89
|
-
baseUrl: 'https://api.kirimdev.com/v1', // optional
|
|
90
|
-
timeout: 30_000, // ms, default 30s
|
|
91
|
-
maxRetries: 2, // default 2
|
|
92
|
-
fetch: globalThis.fetch, // injectable for testing
|
|
93
|
-
})
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## License
|
|
97
|
-
|
|
98
|
-
MIT
|
|
1
|
+
# @kirimdev/sdk
|
|
2
|
+
|
|
3
|
+
Official TypeScript SDK for the [Kirimdev](https://kirimdev.com) Public API.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @kirimdev/sdk
|
|
9
|
+
# or
|
|
10
|
+
bun add @kirimdev/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quickstart
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Kirim } from '@kirimdev/sdk'
|
|
17
|
+
|
|
18
|
+
const kirim = new Kirim({ apiKey: process.env.KIRIM_API_KEY! })
|
|
19
|
+
|
|
20
|
+
// Scope to a WhatsApp phone number (Meta `business_phone_number_id`).
|
|
21
|
+
// Look it up via `kirim.accounts.list()` if you don't have it handy.
|
|
22
|
+
const phone = kirim.phoneNumbers('106540352242922')
|
|
23
|
+
|
|
24
|
+
// Send a message
|
|
25
|
+
const msg = await phone.messages.send({
|
|
26
|
+
messaging_product: 'whatsapp',
|
|
27
|
+
to: '628123456789',
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: { body: 'Halo dari SDK!' },
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Paginate
|
|
33
|
+
for await (const m of phone.messages.list({ limit: 50 })) {
|
|
34
|
+
console.log(m.id, m.status)
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Webhook verification
|
|
39
|
+
|
|
40
|
+
`verifyWebhookSignature` parses the `X-Kirim-Signature` header (Stripe-style
|
|
41
|
+
`t=<unix>,v1=<hex>` format), checks the timestamp against a tolerance window,
|
|
42
|
+
verifies the HMAC-SHA256 against one or more active secrets (supports rotation),
|
|
43
|
+
and returns the parsed JSON body. It **throws** on every failure mode — never
|
|
44
|
+
returns `false`. Uses Web Crypto so it runs unchanged on Node 18+, Bun, Deno,
|
|
45
|
+
and edge runtimes.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { verifyWebhookSignature, InvalidSignatureError } from '@kirimdev/sdk/webhooks'
|
|
49
|
+
|
|
50
|
+
export async function POST(req: Request) {
|
|
51
|
+
const rawBody = await req.text()
|
|
52
|
+
try {
|
|
53
|
+
const event = await verifyWebhookSignature({
|
|
54
|
+
rawBody,
|
|
55
|
+
signatureHeader: req.headers.get('x-kirim-signature'),
|
|
56
|
+
secrets: [process.env.KIRIM_WEBHOOK_SECRET!],
|
|
57
|
+
})
|
|
58
|
+
// event is KirimWebhookEvent — narrow on event.type or event.object
|
|
59
|
+
return new Response('ok')
|
|
60
|
+
} catch (err) {
|
|
61
|
+
if (err instanceof InvalidSignatureError) return new Response('bad sig', { status: 401 })
|
|
62
|
+
throw err
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Errors thrown (all extend `KirimWebhookError`):
|
|
68
|
+
|
|
69
|
+
- `InvalidSignatureError` — header missing/malformed, or no `v1=` matched any provided secret
|
|
70
|
+
- `SignatureExpiredError` — `|now - t|` exceeds `toleranceSeconds` (default 300s)
|
|
71
|
+
- `MalformedPayloadError` — signature matched but body is not valid JSON
|
|
72
|
+
|
|
73
|
+
## Features
|
|
74
|
+
|
|
75
|
+
- Full coverage of the Kirimdev `/v1` API (~35 endpoints)
|
|
76
|
+
- Type-safe — generated from the live OpenAPI 3.1 spec
|
|
77
|
+
- Automatic retries with exponential backoff (429, 5xx, network errors)
|
|
78
|
+
- Automatic `Idempotency-Key` injection for POST requests
|
|
79
|
+
- Async iterator pagination (`for await ... of kirim.messages.list(...)`)
|
|
80
|
+
- Typed error class hierarchy keyed off stable API error codes
|
|
81
|
+
- Webhook HMAC-SHA256 verifier
|
|
82
|
+
- Zero Node-specific dependencies — works in Node 18+, Bun, Deno
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
new Kirim({
|
|
88
|
+
apiKey: 'kdv_live_...', // required
|
|
89
|
+
baseUrl: 'https://api.kirimdev.com/v1', // optional
|
|
90
|
+
timeout: 30_000, // ms, default 30s
|
|
91
|
+
maxRetries: 2, // default 2
|
|
92
|
+
fetch: globalThis.fetch, // injectable for testing
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
MIT
|
|
@@ -216,6 +216,7 @@ export interface paths {
|
|
|
216
216
|
};
|
|
217
217
|
header?: never;
|
|
218
218
|
path: {
|
|
219
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
219
220
|
phone_number_id: string;
|
|
220
221
|
};
|
|
221
222
|
cookie?: never;
|
|
@@ -300,9 +301,11 @@ export interface paths {
|
|
|
300
301
|
parameters: {
|
|
301
302
|
query?: never;
|
|
302
303
|
header?: {
|
|
304
|
+
/** @description Optional idempotency token. See /docs/idempotency. */
|
|
303
305
|
"idempotency-key"?: string;
|
|
304
306
|
};
|
|
305
307
|
path: {
|
|
308
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
306
309
|
phone_number_id: string;
|
|
307
310
|
};
|
|
308
311
|
cookie?: never;
|
|
@@ -395,7 +398,7 @@ export interface paths {
|
|
|
395
398
|
code: string;
|
|
396
399
|
policy?: string;
|
|
397
400
|
};
|
|
398
|
-
components?: {
|
|
401
|
+
components?: ({
|
|
399
402
|
/** @enum {string} */
|
|
400
403
|
type: "header" | "body" | "button";
|
|
401
404
|
/** @enum {string} */
|
|
@@ -404,7 +407,9 @@ export interface paths {
|
|
|
404
407
|
parameters?: {
|
|
405
408
|
[key: string]: unknown;
|
|
406
409
|
}[];
|
|
407
|
-
}
|
|
410
|
+
} & {
|
|
411
|
+
[key: string]: unknown;
|
|
412
|
+
})[];
|
|
408
413
|
};
|
|
409
414
|
} | {
|
|
410
415
|
/** @enum {string} */
|
|
@@ -503,6 +508,51 @@ export interface paths {
|
|
|
503
508
|
};
|
|
504
509
|
}[];
|
|
505
510
|
};
|
|
511
|
+
} | {
|
|
512
|
+
/** @enum {string} */
|
|
513
|
+
type: "reply_buttons";
|
|
514
|
+
header?: {
|
|
515
|
+
/** @enum {string} */
|
|
516
|
+
type: "text";
|
|
517
|
+
text: string;
|
|
518
|
+
} | {
|
|
519
|
+
/** @enum {string} */
|
|
520
|
+
type: "image";
|
|
521
|
+
image: {
|
|
522
|
+
/** Format: uri */
|
|
523
|
+
link: string;
|
|
524
|
+
};
|
|
525
|
+
} | {
|
|
526
|
+
/** @enum {string} */
|
|
527
|
+
type: "video";
|
|
528
|
+
video: {
|
|
529
|
+
/** Format: uri */
|
|
530
|
+
link: string;
|
|
531
|
+
};
|
|
532
|
+
} | {
|
|
533
|
+
/** @enum {string} */
|
|
534
|
+
type: "document";
|
|
535
|
+
document: {
|
|
536
|
+
/** Format: uri */
|
|
537
|
+
link: string;
|
|
538
|
+
};
|
|
539
|
+
};
|
|
540
|
+
body: {
|
|
541
|
+
text: string;
|
|
542
|
+
};
|
|
543
|
+
footer?: {
|
|
544
|
+
text: string;
|
|
545
|
+
};
|
|
546
|
+
action: {
|
|
547
|
+
buttons: {
|
|
548
|
+
/** @enum {string} */
|
|
549
|
+
type: "reply";
|
|
550
|
+
reply: {
|
|
551
|
+
id: string;
|
|
552
|
+
title: string;
|
|
553
|
+
};
|
|
554
|
+
}[];
|
|
555
|
+
};
|
|
506
556
|
};
|
|
507
557
|
} | {
|
|
508
558
|
/** @enum {string} */
|
|
@@ -616,6 +666,7 @@ export interface paths {
|
|
|
616
666
|
query?: never;
|
|
617
667
|
header?: never;
|
|
618
668
|
path: {
|
|
669
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
619
670
|
phone_number_id: string;
|
|
620
671
|
id: string;
|
|
621
672
|
};
|
|
@@ -717,6 +768,7 @@ export interface paths {
|
|
|
717
768
|
};
|
|
718
769
|
header?: never;
|
|
719
770
|
path: {
|
|
771
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
720
772
|
phone_number_id: string;
|
|
721
773
|
};
|
|
722
774
|
cookie?: never;
|
|
@@ -811,6 +863,7 @@ export interface paths {
|
|
|
811
863
|
};
|
|
812
864
|
header?: never;
|
|
813
865
|
path: {
|
|
866
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
814
867
|
phone_number_id: string;
|
|
815
868
|
name: string;
|
|
816
869
|
};
|
|
@@ -962,7 +1015,7 @@ export interface paths {
|
|
|
962
1015
|
put?: never;
|
|
963
1016
|
/**
|
|
964
1017
|
* Create a webhook subscription
|
|
965
|
-
* @description Create a webhook subscription. The response carries `initial_secret` ONCE — store it server-side immediately;
|
|
1018
|
+
* @description Create a webhook subscription. The response carries `initial_secret` ONCE — store it server-side immediately; Kirimdev cannot show it again.
|
|
966
1019
|
*/
|
|
967
1020
|
post: {
|
|
968
1021
|
parameters: {
|
|
@@ -1866,6 +1919,7 @@ export interface paths {
|
|
|
1866
1919
|
};
|
|
1867
1920
|
header?: never;
|
|
1868
1921
|
path: {
|
|
1922
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
1869
1923
|
phone_number_id: string;
|
|
1870
1924
|
};
|
|
1871
1925
|
cookie?: never;
|
|
@@ -1958,6 +2012,7 @@ export interface paths {
|
|
|
1958
2012
|
query?: never;
|
|
1959
2013
|
header?: never;
|
|
1960
2014
|
path: {
|
|
2015
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
1961
2016
|
phone_number_id: string;
|
|
1962
2017
|
id: string;
|
|
1963
2018
|
};
|
|
@@ -2044,6 +2099,7 @@ export interface paths {
|
|
|
2044
2099
|
query?: never;
|
|
2045
2100
|
header?: never;
|
|
2046
2101
|
path: {
|
|
2102
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2047
2103
|
phone_number_id: string;
|
|
2048
2104
|
id: string;
|
|
2049
2105
|
};
|
|
@@ -2147,6 +2203,7 @@ export interface paths {
|
|
|
2147
2203
|
};
|
|
2148
2204
|
header?: never;
|
|
2149
2205
|
path: {
|
|
2206
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2150
2207
|
phone_number_id: string;
|
|
2151
2208
|
};
|
|
2152
2209
|
cookie?: never;
|
|
@@ -2228,6 +2285,7 @@ export interface paths {
|
|
|
2228
2285
|
query?: never;
|
|
2229
2286
|
header?: never;
|
|
2230
2287
|
path: {
|
|
2288
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2231
2289
|
phone_number_id: string;
|
|
2232
2290
|
};
|
|
2233
2291
|
cookie?: never;
|
|
@@ -2330,6 +2388,7 @@ export interface paths {
|
|
|
2330
2388
|
query?: never;
|
|
2331
2389
|
header?: never;
|
|
2332
2390
|
path: {
|
|
2391
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2333
2392
|
phone_number_id: string;
|
|
2334
2393
|
id: string;
|
|
2335
2394
|
};
|
|
@@ -2413,6 +2472,7 @@ export interface paths {
|
|
|
2413
2472
|
query?: never;
|
|
2414
2473
|
header?: never;
|
|
2415
2474
|
path: {
|
|
2475
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2416
2476
|
phone_number_id: string;
|
|
2417
2477
|
id: string;
|
|
2418
2478
|
};
|
|
@@ -2496,6 +2556,7 @@ export interface paths {
|
|
|
2496
2556
|
query?: never;
|
|
2497
2557
|
header?: never;
|
|
2498
2558
|
path: {
|
|
2559
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2499
2560
|
phone_number_id: string;
|
|
2500
2561
|
id: string;
|
|
2501
2562
|
};
|
|
@@ -2596,6 +2657,7 @@ export interface paths {
|
|
|
2596
2657
|
query?: never;
|
|
2597
2658
|
header?: never;
|
|
2598
2659
|
path: {
|
|
2660
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2599
2661
|
phone_number_id: string;
|
|
2600
2662
|
id: string;
|
|
2601
2663
|
};
|
|
@@ -2694,6 +2756,7 @@ export interface paths {
|
|
|
2694
2756
|
query?: never;
|
|
2695
2757
|
header?: never;
|
|
2696
2758
|
path: {
|
|
2759
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2697
2760
|
phone_number_id: string;
|
|
2698
2761
|
id: string;
|
|
2699
2762
|
};
|
|
@@ -2794,6 +2857,7 @@ export interface paths {
|
|
|
2794
2857
|
query?: never;
|
|
2795
2858
|
header?: never;
|
|
2796
2859
|
path: {
|
|
2860
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2797
2861
|
phone_number_id: string;
|
|
2798
2862
|
id: string;
|
|
2799
2863
|
label_id: string;
|
|
@@ -2890,6 +2954,7 @@ export interface paths {
|
|
|
2890
2954
|
query?: never;
|
|
2891
2955
|
header?: never;
|
|
2892
2956
|
path: {
|
|
2957
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2893
2958
|
phone_number_id: string;
|
|
2894
2959
|
};
|
|
2895
2960
|
cookie?: never;
|
|
@@ -2991,6 +3056,7 @@ export interface paths {
|
|
|
2991
3056
|
query?: never;
|
|
2992
3057
|
header?: never;
|
|
2993
3058
|
path: {
|
|
3059
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
2994
3060
|
phone_number_id: string;
|
|
2995
3061
|
id: string;
|
|
2996
3062
|
};
|
|
@@ -3091,6 +3157,7 @@ export interface paths {
|
|
|
3091
3157
|
query?: never;
|
|
3092
3158
|
header?: never;
|
|
3093
3159
|
path: {
|
|
3160
|
+
/** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
|
|
3094
3161
|
phone_number_id: string;
|
|
3095
3162
|
id: string;
|
|
3096
3163
|
label_id: string;
|
package/openapi.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"openapi": "3.1.0",
|
|
3
3
|
"info": {
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "Kirimdev Public API",
|
|
5
5
|
"version": "1.0.0",
|
|
6
6
|
"description": "Self-service REST API for sending WhatsApp messages, subscribing to events, and managing your inbox programmatically. See docs.kirimdev.com for guides and reference.",
|
|
7
7
|
"contact": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"name": "Templates",
|
|
33
|
-
"description": "List and inspect Meta-approved templates synced to your
|
|
33
|
+
"description": "List and inspect Meta-approved templates synced to your Kirimdev org."
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"name": "Conversations",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"name": "Labels",
|
|
45
|
-
"description": "Coloured tags for contacts and conversations. Team-scoped per
|
|
45
|
+
"description": "Coloured tags for contacts and conversations. Team-scoped per Kirimdev's internal model."
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"name": "Webhook Subscriptions",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"type": "http",
|
|
60
60
|
"scheme": "bearer",
|
|
61
61
|
"bearerFormat": "API Key",
|
|
62
|
-
"description": "
|
|
62
|
+
"description": "Kirimdev Public API key. Format: `kdv_live_<24-char base64url>`. Issue keys in Settings → API Keys."
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"schemas": {
|
|
@@ -2845,6 +2845,205 @@
|
|
|
2845
2845
|
"action"
|
|
2846
2846
|
],
|
|
2847
2847
|
"title": "Carousel"
|
|
2848
|
+
},
|
|
2849
|
+
{
|
|
2850
|
+
"type": "object",
|
|
2851
|
+
"properties": {
|
|
2852
|
+
"type": {
|
|
2853
|
+
"type": "string",
|
|
2854
|
+
"enum": [
|
|
2855
|
+
"reply_buttons"
|
|
2856
|
+
]
|
|
2857
|
+
},
|
|
2858
|
+
"header": {
|
|
2859
|
+
"oneOf": [
|
|
2860
|
+
{
|
|
2861
|
+
"type": "object",
|
|
2862
|
+
"properties": {
|
|
2863
|
+
"type": {
|
|
2864
|
+
"type": "string",
|
|
2865
|
+
"enum": [
|
|
2866
|
+
"text"
|
|
2867
|
+
]
|
|
2868
|
+
},
|
|
2869
|
+
"text": {
|
|
2870
|
+
"type": "string",
|
|
2871
|
+
"minLength": 1,
|
|
2872
|
+
"maxLength": 60
|
|
2873
|
+
}
|
|
2874
|
+
},
|
|
2875
|
+
"required": [
|
|
2876
|
+
"type",
|
|
2877
|
+
"text"
|
|
2878
|
+
],
|
|
2879
|
+
"title": "Text header"
|
|
2880
|
+
},
|
|
2881
|
+
{
|
|
2882
|
+
"type": "object",
|
|
2883
|
+
"properties": {
|
|
2884
|
+
"type": {
|
|
2885
|
+
"type": "string",
|
|
2886
|
+
"enum": [
|
|
2887
|
+
"image"
|
|
2888
|
+
]
|
|
2889
|
+
},
|
|
2890
|
+
"image": {
|
|
2891
|
+
"type": "object",
|
|
2892
|
+
"properties": {
|
|
2893
|
+
"link": {
|
|
2894
|
+
"type": "string",
|
|
2895
|
+
"format": "uri"
|
|
2896
|
+
}
|
|
2897
|
+
},
|
|
2898
|
+
"required": [
|
|
2899
|
+
"link"
|
|
2900
|
+
]
|
|
2901
|
+
}
|
|
2902
|
+
},
|
|
2903
|
+
"required": [
|
|
2904
|
+
"type",
|
|
2905
|
+
"image"
|
|
2906
|
+
],
|
|
2907
|
+
"title": "Image header"
|
|
2908
|
+
},
|
|
2909
|
+
{
|
|
2910
|
+
"type": "object",
|
|
2911
|
+
"properties": {
|
|
2912
|
+
"type": {
|
|
2913
|
+
"type": "string",
|
|
2914
|
+
"enum": [
|
|
2915
|
+
"video"
|
|
2916
|
+
]
|
|
2917
|
+
},
|
|
2918
|
+
"video": {
|
|
2919
|
+
"type": "object",
|
|
2920
|
+
"properties": {
|
|
2921
|
+
"link": {
|
|
2922
|
+
"type": "string",
|
|
2923
|
+
"format": "uri"
|
|
2924
|
+
}
|
|
2925
|
+
},
|
|
2926
|
+
"required": [
|
|
2927
|
+
"link"
|
|
2928
|
+
]
|
|
2929
|
+
}
|
|
2930
|
+
},
|
|
2931
|
+
"required": [
|
|
2932
|
+
"type",
|
|
2933
|
+
"video"
|
|
2934
|
+
],
|
|
2935
|
+
"title": "Video header"
|
|
2936
|
+
},
|
|
2937
|
+
{
|
|
2938
|
+
"type": "object",
|
|
2939
|
+
"properties": {
|
|
2940
|
+
"type": {
|
|
2941
|
+
"type": "string",
|
|
2942
|
+
"enum": [
|
|
2943
|
+
"document"
|
|
2944
|
+
]
|
|
2945
|
+
},
|
|
2946
|
+
"document": {
|
|
2947
|
+
"type": "object",
|
|
2948
|
+
"properties": {
|
|
2949
|
+
"link": {
|
|
2950
|
+
"type": "string",
|
|
2951
|
+
"format": "uri"
|
|
2952
|
+
}
|
|
2953
|
+
},
|
|
2954
|
+
"required": [
|
|
2955
|
+
"link"
|
|
2956
|
+
]
|
|
2957
|
+
}
|
|
2958
|
+
},
|
|
2959
|
+
"required": [
|
|
2960
|
+
"type",
|
|
2961
|
+
"document"
|
|
2962
|
+
],
|
|
2963
|
+
"title": "Document header"
|
|
2964
|
+
}
|
|
2965
|
+
]
|
|
2966
|
+
},
|
|
2967
|
+
"body": {
|
|
2968
|
+
"type": "object",
|
|
2969
|
+
"properties": {
|
|
2970
|
+
"text": {
|
|
2971
|
+
"type": "string",
|
|
2972
|
+
"minLength": 1,
|
|
2973
|
+
"maxLength": 1024
|
|
2974
|
+
}
|
|
2975
|
+
},
|
|
2976
|
+
"required": [
|
|
2977
|
+
"text"
|
|
2978
|
+
]
|
|
2979
|
+
},
|
|
2980
|
+
"footer": {
|
|
2981
|
+
"type": "object",
|
|
2982
|
+
"properties": {
|
|
2983
|
+
"text": {
|
|
2984
|
+
"type": "string",
|
|
2985
|
+
"minLength": 1,
|
|
2986
|
+
"maxLength": 60
|
|
2987
|
+
}
|
|
2988
|
+
},
|
|
2989
|
+
"required": [
|
|
2990
|
+
"text"
|
|
2991
|
+
]
|
|
2992
|
+
},
|
|
2993
|
+
"action": {
|
|
2994
|
+
"type": "object",
|
|
2995
|
+
"properties": {
|
|
2996
|
+
"buttons": {
|
|
2997
|
+
"type": "array",
|
|
2998
|
+
"items": {
|
|
2999
|
+
"type": "object",
|
|
3000
|
+
"properties": {
|
|
3001
|
+
"type": {
|
|
3002
|
+
"type": "string",
|
|
3003
|
+
"enum": [
|
|
3004
|
+
"reply"
|
|
3005
|
+
]
|
|
3006
|
+
},
|
|
3007
|
+
"reply": {
|
|
3008
|
+
"type": "object",
|
|
3009
|
+
"properties": {
|
|
3010
|
+
"id": {
|
|
3011
|
+
"type": "string",
|
|
3012
|
+
"minLength": 1,
|
|
3013
|
+
"maxLength": 256
|
|
3014
|
+
},
|
|
3015
|
+
"title": {
|
|
3016
|
+
"type": "string",
|
|
3017
|
+
"minLength": 1,
|
|
3018
|
+
"maxLength": 20
|
|
3019
|
+
}
|
|
3020
|
+
},
|
|
3021
|
+
"required": [
|
|
3022
|
+
"id",
|
|
3023
|
+
"title"
|
|
3024
|
+
]
|
|
3025
|
+
}
|
|
3026
|
+
},
|
|
3027
|
+
"required": [
|
|
3028
|
+
"type",
|
|
3029
|
+
"reply"
|
|
3030
|
+
]
|
|
3031
|
+
},
|
|
3032
|
+
"minItems": 1,
|
|
3033
|
+
"maxItems": 3
|
|
3034
|
+
}
|
|
3035
|
+
},
|
|
3036
|
+
"required": [
|
|
3037
|
+
"buttons"
|
|
3038
|
+
]
|
|
3039
|
+
}
|
|
3040
|
+
},
|
|
3041
|
+
"required": [
|
|
3042
|
+
"type",
|
|
3043
|
+
"body",
|
|
3044
|
+
"action"
|
|
3045
|
+
],
|
|
3046
|
+
"title": "Reply buttons"
|
|
2848
3047
|
}
|
|
2849
3048
|
]
|
|
2850
3049
|
}
|
|
@@ -3534,7 +3733,7 @@
|
|
|
3534
3733
|
"Webhook Subscriptions"
|
|
3535
3734
|
],
|
|
3536
3735
|
"summary": "Create a webhook subscription",
|
|
3537
|
-
"description": "Create a webhook subscription. The response carries `initial_secret` ONCE — store it server-side immediately;
|
|
3736
|
+
"description": "Create a webhook subscription. The response carries `initial_secret` ONCE — store it server-side immediately; Kirimdev cannot show it again.",
|
|
3538
3737
|
"security": [
|
|
3539
3738
|
{
|
|
3540
3739
|
"bearerAuth": []
|
package/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kirimdev/sdk",
|
|
3
|
-
"version": "3.0
|
|
4
|
-
"description": "Official TypeScript SDK for the Kirimdev Public API.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public",
|
|
9
|
-
"registry": "https://registry.npmjs.org/"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"kirim",
|
|
13
|
-
"whatsapp",
|
|
14
|
-
"whatsapp-business",
|
|
15
|
-
"sdk",
|
|
16
|
-
"api-client"
|
|
17
|
-
],
|
|
18
|
-
"files": [
|
|
19
|
-
"dist",
|
|
20
|
-
"openapi.json",
|
|
21
|
-
"README.md",
|
|
22
|
-
"LICENSE"
|
|
23
|
-
],
|
|
24
|
-
"main": "./dist/index.js",
|
|
25
|
-
"module": "./dist/index.js",
|
|
26
|
-
"types": "./dist/index.d.ts",
|
|
27
|
-
"exports": {
|
|
28
|
-
".": {
|
|
29
|
-
"types": "./dist/index.d.ts",
|
|
30
|
-
"import": "./dist/index.js"
|
|
31
|
-
},
|
|
32
|
-
"./webhooks": {
|
|
33
|
-
"types": "./dist/webhooks.d.ts",
|
|
34
|
-
"import": "./dist/webhooks.js"
|
|
35
|
-
},
|
|
36
|
-
"./package.json": "./package.json"
|
|
37
|
-
},
|
|
38
|
-
"engines": {
|
|
39
|
-
"node": ">=18"
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"prebuild": "bun scripts/ensure-types.ts",
|
|
43
|
-
"build": "tsc -p tsconfig.build.json && bun scripts/copy-generated.ts",
|
|
44
|
-
"pretypecheck": "bun scripts/ensure-types.ts",
|
|
45
|
-
"typecheck": "tsc --noEmit",
|
|
46
|
-
"pretest": "bun scripts/ensure-types.ts",
|
|
47
|
-
"test": "bun test",
|
|
48
|
-
"lint": "tsc --noEmit",
|
|
49
|
-
"sync": "bun scripts/sync-openapi.ts && bun scripts/generate-types.ts",
|
|
50
|
-
"generate-types": "bun scripts/generate-types.ts",
|
|
51
|
-
"check:drift": "bun scripts/check-drift.ts",
|
|
52
|
-
"prepublishOnly": "bun run typecheck && bun run test && bun run build && bun scripts/verify-dist.ts"
|
|
53
|
-
},
|
|
54
|
-
"dependencies": {
|
|
55
|
-
"openapi-fetch": "^0.13.0"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@kirimdev/tsconfig": "workspace:*",
|
|
59
|
-
"@types/bun": "latest",
|
|
60
|
-
"openapi-typescript": "^7.4.0",
|
|
61
|
-
"typescript": "^5.8.0"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@kirimdev/sdk",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "Official TypeScript SDK for the Kirimdev Public API.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"registry": "https://registry.npmjs.org/"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"kirim",
|
|
13
|
+
"whatsapp",
|
|
14
|
+
"whatsapp-business",
|
|
15
|
+
"sdk",
|
|
16
|
+
"api-client"
|
|
17
|
+
],
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"openapi.json",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./webhooks": {
|
|
33
|
+
"types": "./dist/webhooks.d.ts",
|
|
34
|
+
"import": "./dist/webhooks.js"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"prebuild": "bun scripts/ensure-types.ts",
|
|
43
|
+
"build": "tsc -p tsconfig.build.json && bun scripts/copy-generated.ts",
|
|
44
|
+
"pretypecheck": "bun scripts/ensure-types.ts",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"pretest": "bun scripts/ensure-types.ts",
|
|
47
|
+
"test": "bun test",
|
|
48
|
+
"lint": "tsc --noEmit",
|
|
49
|
+
"sync": "bun scripts/sync-openapi.ts && bun scripts/generate-types.ts",
|
|
50
|
+
"generate-types": "bun scripts/generate-types.ts",
|
|
51
|
+
"check:drift": "bun scripts/check-drift.ts",
|
|
52
|
+
"prepublishOnly": "bun run typecheck && bun run test && bun run build && bun scripts/verify-dist.ts"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"openapi-fetch": "^0.13.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@kirimdev/tsconfig": "workspace:*",
|
|
59
|
+
"@types/bun": "latest",
|
|
60
|
+
"openapi-typescript": "^7.4.0",
|
|
61
|
+
"typescript": "^5.8.0"
|
|
62
|
+
}
|
|
63
|
+
}
|