@kirimdev/sdk 3.6.0 → 3.8.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.
@@ -294,7 +294,7 @@ export interface paths {
294
294
  * Send a WhatsApp message or mark inbound as read
295
295
  * @description Meta-style messages endpoint. Two operations share the same path, distinguished by the request body:
296
296
  *
297
- * **Outbound send** — body has a `type` field (`text`, `image`, `document`, `video`, `audio`, `template`, `interactive`). Body shape mirrors the Meta WhatsApp Cloud API; media variants accept either `link` (hosted URL) or `id` (Meta uploaded media). The sender is the WhatsApp account identified by `phone_number_id` in the URL path; there is no `from` field in the body. Pass `Idempotency-Key` to safely retry on network failure.
297
+ * **Outbound send** — body has a `type` field (`text`, `image`, `document`, `video`, `audio`, `template`, `interactive`). Body shape mirrors the Meta WhatsApp Cloud API; media variants accept either `link` (hosted URL) or `id` (Meta uploaded media). Optional top-level `context: { message_id }` creates a contextual reply — pass the inbound wamid from your webhook (`messages[0].id`), not a Kirim `msg_*` id. The sender is the WhatsApp account identified by `phone_number_id` in the URL path; there is no `from` field in the body. Pass `Idempotency-Key` to safely retry on network failure.
298
298
  *
299
299
  * **Read receipt** — body has `status: "read"` + `message_id` (the inbound wamid from your webhook). Sends a read receipt back to the sender so the double-tick turns blue on their phone. Optional `typing_indicator: { type: "text" }` shows a typing bubble alongside the receipt; Meta auto-dismisses after ~25 seconds or on first outbound message.
300
300
  *
@@ -321,6 +321,14 @@ export interface paths {
321
321
  /** @enum {string} */
322
322
  recipient_type?: "individual";
323
323
  to: string;
324
+ /** Reply context */
325
+ context?: {
326
+ /**
327
+ * @description Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.
328
+ * @example wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA
329
+ */
330
+ message_id: string;
331
+ };
324
332
  /** @enum {string} */
325
333
  type: "text";
326
334
  text: {
@@ -333,6 +341,14 @@ export interface paths {
333
341
  /** @enum {string} */
334
342
  recipient_type?: "individual";
335
343
  to: string;
344
+ /** Reply context */
345
+ context?: {
346
+ /**
347
+ * @description Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.
348
+ * @example wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA
349
+ */
350
+ message_id: string;
351
+ };
336
352
  /** @enum {string} */
337
353
  type: "image";
338
354
  image: {
@@ -348,6 +364,14 @@ export interface paths {
348
364
  /** @enum {string} */
349
365
  recipient_type?: "individual";
350
366
  to: string;
367
+ /** Reply context */
368
+ context?: {
369
+ /**
370
+ * @description Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.
371
+ * @example wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA
372
+ */
373
+ message_id: string;
374
+ };
351
375
  /** @enum {string} */
352
376
  type: "document";
353
377
  document: {
@@ -363,6 +387,14 @@ export interface paths {
363
387
  /** @enum {string} */
364
388
  recipient_type?: "individual";
365
389
  to: string;
390
+ /** Reply context */
391
+ context?: {
392
+ /**
393
+ * @description Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.
394
+ * @example wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA
395
+ */
396
+ message_id: string;
397
+ };
366
398
  /** @enum {string} */
367
399
  type: "video";
368
400
  video: {
@@ -378,6 +410,14 @@ export interface paths {
378
410
  /** @enum {string} */
379
411
  recipient_type?: "individual";
380
412
  to: string;
413
+ /** Reply context */
414
+ context?: {
415
+ /**
416
+ * @description Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.
417
+ * @example wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA
418
+ */
419
+ message_id: string;
420
+ };
381
421
  /** @enum {string} */
382
422
  type: "audio";
383
423
  audio: {
@@ -394,6 +434,14 @@ export interface paths {
394
434
  /** @enum {string} */
395
435
  recipient_type?: "individual";
396
436
  to: string;
437
+ /** Reply context */
438
+ context?: {
439
+ /**
440
+ * @description Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.
441
+ * @example wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA
442
+ */
443
+ message_id: string;
444
+ };
397
445
  /** @enum {string} */
398
446
  type: "template";
399
447
  template: {
@@ -421,6 +469,14 @@ export interface paths {
421
469
  /** @enum {string} */
422
470
  recipient_type?: "individual";
423
471
  to: string;
472
+ /** Reply context */
473
+ context?: {
474
+ /**
475
+ * @description Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.
476
+ * @example wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA
477
+ */
478
+ message_id: string;
479
+ };
424
480
  /** @enum {string} */
425
481
  type: "interactive";
426
482
  interactive: {
@@ -947,6 +1003,15 @@ export interface paths {
947
1003
  "application/json": components["schemas"]["ApiErrorEnvelope"];
948
1004
  };
949
1005
  };
1006
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
1007
+ 409: {
1008
+ headers: {
1009
+ [name: string]: unknown;
1010
+ };
1011
+ content: {
1012
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1013
+ };
1014
+ };
950
1015
  /** @description Semantic failure (e.g. idempotency key reuse) */
951
1016
  422: {
952
1017
  headers: {
@@ -1642,7 +1707,7 @@ export interface paths {
1642
1707
  "application/json": components["schemas"]["ApiErrorEnvelope"];
1643
1708
  };
1644
1709
  };
1645
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
1710
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
1646
1711
  409: {
1647
1712
  headers: {
1648
1713
  [name: string]: unknown;
@@ -2002,7 +2067,7 @@ export interface paths {
2002
2067
  "application/json": components["schemas"]["ApiErrorEnvelope"];
2003
2068
  };
2004
2069
  };
2005
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
2070
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
2006
2071
  409: {
2007
2072
  headers: {
2008
2073
  [name: string]: unknown;
@@ -2111,7 +2176,7 @@ export interface paths {
2111
2176
  "application/json": components["schemas"]["ApiErrorEnvelope"];
2112
2177
  };
2113
2178
  };
2114
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
2179
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
2115
2180
  409: {
2116
2181
  headers: {
2117
2182
  [name: string]: unknown;
@@ -4547,7 +4612,7 @@ export interface paths {
4547
4612
  "application/json": components["schemas"]["ApiErrorEnvelope"];
4548
4613
  };
4549
4614
  };
4550
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
4615
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
4551
4616
  409: {
4552
4617
  headers: {
4553
4618
  [name: string]: unknown;
@@ -4646,7 +4711,7 @@ export interface paths {
4646
4711
  "application/json": components["schemas"]["ApiErrorEnvelope"];
4647
4712
  };
4648
4713
  };
4649
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
4714
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
4650
4715
  409: {
4651
4716
  headers: {
4652
4717
  [name: string]: unknown;
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION: "3.6.0";
1
+ export declare const SDK_VERSION: "3.8.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -2,5 +2,5 @@
2
2
  // Regenerated on every prebuild / pretypecheck / pretest from
3
3
  // package.json so the User-Agent header stays in sync with the
4
4
  // published version.
5
- export const SDK_VERSION = "3.6.0";
5
+ export const SDK_VERSION = "3.8.0";
6
6
  //# sourceMappingURL=version.js.map
@@ -3,4 +3,4 @@
3
3
  // package.json so the User-Agent header stays in sync with the
4
4
  // published version.
5
5
 
6
- export const SDK_VERSION = "3.6.0" as const
6
+ export const SDK_VERSION = "3.8.0" as const
@@ -25,8 +25,8 @@ export declare class TemplatesResource {
25
25
  * Returns the created template with `status: "pending"`. Meta reviews
26
26
  * asynchronously, so poll {@link retrieve} (or {@link sync}) for the
27
27
  * eventual `approved` / `rejected` status. A `name`+`language` pair that
28
- * already exists for the account throws `InvalidRequestError`
29
- * (`invalid_field_value`, `param: "name"`).
28
+ * already exists for the account throws `ConflictError`
29
+ * (`template_already_exists`, HTTP 409, `param: "name"`).
30
30
  */
31
31
  create(params: CreateTemplateParams, options?: RequestOptions): Promise<Template>;
32
32
  /**
@@ -38,8 +38,8 @@ export class TemplatesResource {
38
38
  * Returns the created template with `status: "pending"`. Meta reviews
39
39
  * asynchronously, so poll {@link retrieve} (or {@link sync}) for the
40
40
  * eventual `approved` / `rejected` status. A `name`+`language` pair that
41
- * already exists for the account throws `InvalidRequestError`
42
- * (`invalid_field_value`, `param: "name"`).
41
+ * already exists for the account throws `ConflictError`
42
+ * (`template_already_exists`, HTTP 409, `param: "name"`).
43
43
  */
44
44
  create(params, options) {
45
45
  return this.http.requestData({
@@ -49,10 +49,10 @@ export interface VerifyOptions {
49
49
  }
50
50
  export declare function verifyWebhookSignature(opts: VerifyOptions): Promise<unknown>;
51
51
  /**
52
- * Native Kirim event envelope (server emits `conversation.*` and
53
- * `contact.*` in this shape). The `message.received` and `message.status`
54
- * events are forwarded VERBATIM from Meta's webhook body and do NOT use
55
- * this envelope — see `MetaPassthroughBody` below.
52
+ * Native Kirim event envelope (server emits `message.sent`, `conversation.*`,
53
+ * `contact.*`, and `customer.*` in this shape). The `message.received` and
54
+ * `message.status` events are forwarded VERBATIM from Meta's webhook body and
55
+ * do NOT use this envelope — see `MetaPassthroughBody` below.
56
56
  */
57
57
  export interface KirimEventEnvelope<TType extends string, TData> {
58
58
  id: string;
@@ -80,13 +80,75 @@ export type ContactUpdatedEvent = KirimEventEnvelope<'contact.updated', {
80
80
  object: 'contact';
81
81
  [k: string]: unknown;
82
82
  }>;
83
- export type KirimNativeWebhookEvent = ConversationAssignedEvent | ConversationClosedEvent | ContactCreatedEvent | ContactUpdatedEvent;
83
+ export interface MessageSentPayload {
84
+ session: string;
85
+ direction: 'outbound';
86
+ from_me: true;
87
+ timestamp: string;
88
+ message: {
89
+ id: string;
90
+ provider_id: string | null;
91
+ type: string;
92
+ body: string | null;
93
+ from: string | null;
94
+ to: string | null;
95
+ status: string;
96
+ source: string;
97
+ reply_to_provider_id: string | null;
98
+ template_name?: string | null;
99
+ template_language?: string | null;
100
+ };
101
+ conversation: {
102
+ id: string;
103
+ status: string;
104
+ } | null;
105
+ contact: {
106
+ id: string;
107
+ phone_number: string | null;
108
+ name: string | null;
109
+ };
110
+ meta: {
111
+ phone_number_id: string;
112
+ display_phone_number: string | null;
113
+ provider: 'kirimdev';
114
+ };
115
+ broadcast?: {
116
+ id: string;
117
+ name: string | null;
118
+ };
119
+ }
120
+ export type MessageSentEvent = KirimEventEnvelope<'message.sent', MessageSentPayload>;
121
+ export type KirimNativeWebhookEvent = MessageSentEvent | ConversationAssignedEvent | ConversationClosedEvent | ContactCreatedEvent | ContactUpdatedEvent;
84
122
  /**
85
123
  * Meta passthrough body — `message.received` and `message.status`
86
- * deliveries forward Meta's WhatsApp Cloud webhook payload unchanged.
124
+ * deliveries forward Meta's WhatsApp Cloud webhook payload shape.
125
+ * `message.received` may also include an optional top-level `kirim`
126
+ * block with Kirimdev resource ids, conversation labels, and media URL.
87
127
  * Callers should branch on `X-Kirim-Event` to decide whether to parse
88
128
  * the body as `KirimNativeWebhookEvent` or `MetaPassthroughBody`.
89
129
  */
130
+ export type MessageReceivedMediaStatus = 'ready' | 'failed' | 'unavailable' | 'pending';
131
+ export interface MessageReceivedKirimContext {
132
+ conversation_id: string;
133
+ contact_id: string;
134
+ message_id: string;
135
+ phone_number_id: string;
136
+ labels: Array<{
137
+ id: string;
138
+ name: string;
139
+ color: string;
140
+ }>;
141
+ conversation: {
142
+ status: string;
143
+ assigned_to: string | null;
144
+ };
145
+ contact: {
146
+ name: string | null;
147
+ phone_number: string | null;
148
+ };
149
+ media_url: string | null;
150
+ media_status: MessageReceivedMediaStatus | null;
151
+ }
90
152
  export interface MetaPassthroughBody {
91
153
  object: 'whatsapp_business_account';
92
154
  entry: Array<{
@@ -96,6 +158,8 @@ export interface MetaPassthroughBody {
96
158
  field: 'messages' | string;
97
159
  }>;
98
160
  }>;
161
+ /** Present on `message.received` — Kirimdev routing context. Safe to ignore. */
162
+ kirim?: MessageReceivedKirimContext;
99
163
  }
100
164
  export type KirimWebhookEvent = KirimNativeWebhookEvent | MetaPassthroughBody;
101
165
  //# sourceMappingURL=webhooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,qBAAsB,SAAQ,iBAAiB;gBAC9C,OAAO,SAA8B;CAIlD;AAED,qBAAa,qBAAsB,SAAQ,iBAAiB;gBAC9C,OAAO,SAAyD;CAI7E;AAED,qBAAa,qBAAsB,SAAQ,iBAAiB;gBAC9C,OAAO,SAAsC;CAI1D;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAC1C,O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AAM,CAAA;KAAE,CAAC,CAAA;IAC1D,YAAY,EAAE;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAC3B,CAAA;IACD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAC5B,CAAA;IACD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,YAAY,EAAE,0BAA0B,GAAG,IAAI,CAAA;CAChD;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,2BAA2B,CAAA;IACnC,KAAK,EAAE,KAAK,CAAC;QACX,EAAE,EAAE,MAAM,CAAA;QACV,OAAO,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,OAAO,CAAC;YAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAA;SAAE,CAAC,CAAA;KAC/D,CAAC,CAAA;IACF,gFAAgF;IAChF,KAAK,CAAC,EAAE,2BAA2B,CAAA;CACpC;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,mBAAmB,CAAA"}
package/openapi.json CHANGED
@@ -2559,7 +2559,7 @@
2559
2559
  "Messages"
2560
2560
  ],
2561
2561
  "summary": "Send a WhatsApp message or mark inbound as read",
2562
- "description": "Meta-style messages endpoint. Two operations share the same path, distinguished by the request body:\n\n**Outbound send** — body has a `type` field (`text`, `image`, `document`, `video`, `audio`, `template`, `interactive`). Body shape mirrors the Meta WhatsApp Cloud API; media variants accept either `link` (hosted URL) or `id` (Meta uploaded media). The sender is the WhatsApp account identified by `phone_number_id` in the URL path; there is no `from` field in the body. Pass `Idempotency-Key` to safely retry on network failure.\n\n**Read receipt** — body has `status: \"read\"` + `message_id` (the inbound wamid from your webhook). Sends a read receipt back to the sender so the double-tick turns blue on their phone. Optional `typing_indicator: { type: \"text\" }` shows a typing bubble alongside the receipt; Meta auto-dismisses after ~25 seconds or on first outbound message.\n\n**Pre-send validation** — the API performs compliance checks before queuing the send. A 422 response with `error.code` set to `marketing_opted_out` indicates the recipient has stopped marketing messages from your business (the customer did this via the WhatsApp app menu — webhook `user_preferences` notifies you of the change). `account_restricted` indicates Meta has restricted your WhatsApp account; check the account status via the dashboard. `consent_required` indicates the recipient has not opted in. `customer_suspended` indicates the operator has suspended (or archived) the customer that owns this WhatsApp account; sends are blocked until the customer is unsuspended via the dashboard. `upstream_error` indicates the WhatsApp account is disconnected. None of these are retryable until the underlying condition changes.",
2562
+ "description": "Meta-style messages endpoint. Two operations share the same path, distinguished by the request body:\n\n**Outbound send** — body has a `type` field (`text`, `image`, `document`, `video`, `audio`, `template`, `interactive`). Body shape mirrors the Meta WhatsApp Cloud API; media variants accept either `link` (hosted URL) or `id` (Meta uploaded media). Optional top-level `context: { message_id }` creates a contextual reply — pass the inbound wamid from your webhook (`messages[0].id`), not a Kirim `msg_*` id. The sender is the WhatsApp account identified by `phone_number_id` in the URL path; there is no `from` field in the body. Pass `Idempotency-Key` to safely retry on network failure.\n\n**Read receipt** — body has `status: \"read\"` + `message_id` (the inbound wamid from your webhook). Sends a read receipt back to the sender so the double-tick turns blue on their phone. Optional `typing_indicator: { type: \"text\" }` shows a typing bubble alongside the receipt; Meta auto-dismisses after ~25 seconds or on first outbound message.\n\n**Pre-send validation** — the API performs compliance checks before queuing the send. A 422 response with `error.code` set to `marketing_opted_out` indicates the recipient has stopped marketing messages from your business (the customer did this via the WhatsApp app menu — webhook `user_preferences` notifies you of the change). `account_restricted` indicates Meta has restricted your WhatsApp account; check the account status via the dashboard. `consent_required` indicates the recipient has not opted in. `customer_suspended` indicates the operator has suspended (or archived) the customer that owns this WhatsApp account; sends are blocked until the customer is unsuspended via the dashboard. `upstream_error` indicates the WhatsApp account is disconnected. None of these are retryable until the underlying condition changes.",
2563
2563
  "security": [
2564
2564
  {
2565
2565
  "bearerAuth": []
@@ -2612,6 +2612,21 @@
2612
2612
  "to": {
2613
2613
  "type": "string"
2614
2614
  },
2615
+ "context": {
2616
+ "type": "object",
2617
+ "properties": {
2618
+ "message_id": {
2619
+ "type": "string",
2620
+ "minLength": 1,
2621
+ "description": "Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.",
2622
+ "example": "wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA"
2623
+ }
2624
+ },
2625
+ "required": [
2626
+ "message_id"
2627
+ ],
2628
+ "title": "Reply context"
2629
+ },
2615
2630
  "type": {
2616
2631
  "type": "string",
2617
2632
  "enum": [
@@ -2661,6 +2676,21 @@
2661
2676
  "to": {
2662
2677
  "type": "string"
2663
2678
  },
2679
+ "context": {
2680
+ "type": "object",
2681
+ "properties": {
2682
+ "message_id": {
2683
+ "type": "string",
2684
+ "minLength": 1,
2685
+ "description": "Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.",
2686
+ "example": "wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA"
2687
+ }
2688
+ },
2689
+ "required": [
2690
+ "message_id"
2691
+ ],
2692
+ "title": "Reply context"
2693
+ },
2664
2694
  "type": {
2665
2695
  "type": "string",
2666
2696
  "enum": [
@@ -2716,6 +2746,21 @@
2716
2746
  "to": {
2717
2747
  "type": "string"
2718
2748
  },
2749
+ "context": {
2750
+ "type": "object",
2751
+ "properties": {
2752
+ "message_id": {
2753
+ "type": "string",
2754
+ "minLength": 1,
2755
+ "description": "Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.",
2756
+ "example": "wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA"
2757
+ }
2758
+ },
2759
+ "required": [
2760
+ "message_id"
2761
+ ],
2762
+ "title": "Reply context"
2763
+ },
2719
2764
  "type": {
2720
2765
  "type": "string",
2721
2766
  "enum": [
@@ -2771,6 +2816,21 @@
2771
2816
  "to": {
2772
2817
  "type": "string"
2773
2818
  },
2819
+ "context": {
2820
+ "type": "object",
2821
+ "properties": {
2822
+ "message_id": {
2823
+ "type": "string",
2824
+ "minLength": 1,
2825
+ "description": "Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.",
2826
+ "example": "wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA"
2827
+ }
2828
+ },
2829
+ "required": [
2830
+ "message_id"
2831
+ ],
2832
+ "title": "Reply context"
2833
+ },
2774
2834
  "type": {
2775
2835
  "type": "string",
2776
2836
  "enum": [
@@ -2826,6 +2886,21 @@
2826
2886
  "to": {
2827
2887
  "type": "string"
2828
2888
  },
2889
+ "context": {
2890
+ "type": "object",
2891
+ "properties": {
2892
+ "message_id": {
2893
+ "type": "string",
2894
+ "minLength": 1,
2895
+ "description": "Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.",
2896
+ "example": "wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA"
2897
+ }
2898
+ },
2899
+ "required": [
2900
+ "message_id"
2901
+ ],
2902
+ "title": "Reply context"
2903
+ },
2829
2904
  "type": {
2830
2905
  "type": "string",
2831
2906
  "enum": [
@@ -2884,6 +2959,21 @@
2884
2959
  "to": {
2885
2960
  "type": "string"
2886
2961
  },
2962
+ "context": {
2963
+ "type": "object",
2964
+ "properties": {
2965
+ "message_id": {
2966
+ "type": "string",
2967
+ "minLength": 1,
2968
+ "description": "Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.",
2969
+ "example": "wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA"
2970
+ }
2971
+ },
2972
+ "required": [
2973
+ "message_id"
2974
+ ],
2975
+ "title": "Reply context"
2976
+ },
2887
2977
  "type": {
2888
2978
  "type": "string",
2889
2979
  "enum": [
@@ -2997,6 +3087,21 @@
2997
3087
  "to": {
2998
3088
  "type": "string"
2999
3089
  },
3090
+ "context": {
3091
+ "type": "object",
3092
+ "properties": {
3093
+ "message_id": {
3094
+ "type": "string",
3095
+ "minLength": 1,
3096
+ "description": "Meta WhatsApp message id (wamid) of the message to reply to. From the inbound webhook — NOT a Kirim `msg_*` external id.",
3097
+ "example": "wamid.HBgNNjI4MTIzNDU2Nzg5FQIAEhggMUE5MDM1QzVDMUYxQTAyRkVCNzZDQjVDMjFFRDQzNTUA"
3098
+ }
3099
+ },
3100
+ "required": [
3101
+ "message_id"
3102
+ ],
3103
+ "title": "Reply context"
3104
+ },
3000
3105
  "type": {
3001
3106
  "type": "string",
3002
3107
  "enum": [
@@ -4431,6 +4536,16 @@
4431
4536
  }
4432
4537
  }
4433
4538
  },
4539
+ "409": {
4540
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
4541
+ "content": {
4542
+ "application/json": {
4543
+ "schema": {
4544
+ "$ref": "#/components/schemas/ApiErrorEnvelope"
4545
+ }
4546
+ }
4547
+ }
4548
+ },
4434
4549
  "422": {
4435
4550
  "description": "Semantic failure (e.g. idempotency key reuse)",
4436
4551
  "content": {
@@ -4736,6 +4851,7 @@
4736
4851
  "enum": [
4737
4852
  "message.received",
4738
4853
  "message.status",
4854
+ "message.sent",
4739
4855
  "conversation.assigned",
4740
4856
  "conversation.closed",
4741
4857
  "contact.created",
@@ -5050,6 +5166,7 @@
5050
5166
  "enum": [
5051
5167
  "message.received",
5052
5168
  "message.status",
5169
+ "message.sent",
5053
5170
  "conversation.assigned",
5054
5171
  "conversation.closed",
5055
5172
  "contact.created",
@@ -5305,7 +5422,7 @@
5305
5422
  }
5306
5423
  },
5307
5424
  "409": {
5308
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
5425
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
5309
5426
  "content": {
5310
5427
  "application/json": {
5311
5428
  "schema": {
@@ -5738,7 +5855,7 @@
5738
5855
  }
5739
5856
  },
5740
5857
  "409": {
5741
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
5858
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
5742
5859
  "content": {
5743
5860
  "application/json": {
5744
5861
  "schema": {
@@ -5863,7 +5980,7 @@
5863
5980
  }
5864
5981
  },
5865
5982
  "409": {
5866
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
5983
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
5867
5984
  "content": {
5868
5985
  "application/json": {
5869
5986
  "schema": {
@@ -9024,7 +9141,7 @@
9024
9141
  }
9025
9142
  },
9026
9143
  "409": {
9027
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
9144
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
9028
9145
  "content": {
9029
9146
  "application/json": {
9030
9147
  "schema": {
@@ -9138,7 +9255,7 @@
9138
9255
  }
9139
9256
  },
9140
9257
  "409": {
9141
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
9258
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
9142
9259
  "content": {
9143
9260
  "application/json": {
9144
9261
  "schema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirimdev/sdk",
3
- "version": "3.6.0",
3
+ "version": "3.8.0",
4
4
  "description": "Official TypeScript SDK for the Kirimdev Public API.",
5
5
  "type": "module",
6
6
  "license": "MIT",