@kirimdev/sdk 3.5.0 → 3.7.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: {
@@ -845,7 +901,155 @@ export interface paths {
845
901
  };
846
902
  };
847
903
  put?: never;
848
- post?: never;
904
+ /**
905
+ * Create a template
906
+ * @description Create a new message template and submit it to Meta for review. The request body is components-only (mirrors Meta's `message_templates` create shape). On success the template is persisted with `status: "pending"`; Meta reviews asynchronously, so poll `GET /{phone_number_id}/templates/{name}` (or re-run `POST .../templates/sync`) for the eventual `approved` / `rejected` transition. A `name`+`language` pair that already exists for the account returns `400 invalid_field_value`.
907
+ */
908
+ post: {
909
+ parameters: {
910
+ query?: never;
911
+ header?: never;
912
+ path: {
913
+ /** @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). */
914
+ phone_number_id: string;
915
+ };
916
+ cookie?: never;
917
+ };
918
+ requestBody?: {
919
+ content: {
920
+ "application/json": {
921
+ /** @example order_confirmation */
922
+ name: string;
923
+ /**
924
+ * @example UTILITY
925
+ * @enum {string}
926
+ */
927
+ category: "MARKETING" | "UTILITY" | "AUTHENTICATION";
928
+ /**
929
+ * @default en
930
+ * @example id
931
+ */
932
+ language?: string;
933
+ components: {
934
+ /** @enum {string} */
935
+ type: "HEADER" | "BODY" | "FOOTER" | "BUTTONS";
936
+ /** @enum {string} */
937
+ format?: "TEXT" | "IMAGE" | "VIDEO" | "DOCUMENT" | "LOCATION";
938
+ text?: string;
939
+ example?: {
940
+ header_text?: string[];
941
+ header_handle?: string[];
942
+ header_url?: string[];
943
+ body_text?: string[][];
944
+ };
945
+ buttons?: {
946
+ /** @enum {string} */
947
+ type: "URL" | "PHONE_NUMBER" | "QUICK_REPLY" | "COPY_CODE" | "OTP" | "VOICE_CALL";
948
+ text?: string;
949
+ /** Format: uri */
950
+ url?: string;
951
+ phone_number?: string;
952
+ /** @enum {string} */
953
+ otp_type?: "COPY_CODE" | "ONE_TAP" | "ZERO_TAP";
954
+ autofill_text?: string;
955
+ supported_apps?: {
956
+ package_name: string;
957
+ signature_hash: string;
958
+ }[];
959
+ example?: string[];
960
+ }[];
961
+ add_security_recommendation?: boolean;
962
+ code_expiration_minutes?: number;
963
+ }[];
964
+ variables?: string[];
965
+ messageSendTtlSeconds?: number;
966
+ };
967
+ };
968
+ };
969
+ responses: {
970
+ /** @description Template created (pending Meta review) */
971
+ 200: {
972
+ headers: {
973
+ [name: string]: unknown;
974
+ };
975
+ content: {
976
+ "application/json": components["schemas"]["CreateTemplateResponse"];
977
+ };
978
+ };
979
+ /** @description Validation failure */
980
+ 400: {
981
+ headers: {
982
+ [name: string]: unknown;
983
+ };
984
+ content: {
985
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
986
+ };
987
+ };
988
+ /** @description Authentication failure */
989
+ 401: {
990
+ headers: {
991
+ [name: string]: unknown;
992
+ };
993
+ content: {
994
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
995
+ };
996
+ };
997
+ /** @description Resource not found */
998
+ 404: {
999
+ headers: {
1000
+ [name: string]: unknown;
1001
+ };
1002
+ content: {
1003
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1004
+ };
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
+ };
1015
+ /** @description Semantic failure (e.g. idempotency key reuse) */
1016
+ 422: {
1017
+ headers: {
1018
+ [name: string]: unknown;
1019
+ };
1020
+ content: {
1021
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1022
+ };
1023
+ };
1024
+ /** @description Rate limit exceeded */
1025
+ 429: {
1026
+ headers: {
1027
+ [name: string]: unknown;
1028
+ };
1029
+ content: {
1030
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1031
+ };
1032
+ };
1033
+ /** @description Internal server error */
1034
+ 500: {
1035
+ headers: {
1036
+ [name: string]: unknown;
1037
+ };
1038
+ content: {
1039
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1040
+ };
1041
+ };
1042
+ /** @description Upstream WhatsApp error */
1043
+ 502: {
1044
+ headers: {
1045
+ [name: string]: unknown;
1046
+ };
1047
+ content: {
1048
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1049
+ };
1050
+ };
1051
+ };
1052
+ };
849
1053
  delete?: never;
850
1054
  options?: never;
851
1055
  head?: never;
@@ -1503,7 +1707,7 @@ export interface paths {
1503
1707
  "application/json": components["schemas"]["ApiErrorEnvelope"];
1504
1708
  };
1505
1709
  };
1506
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
1710
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
1507
1711
  409: {
1508
1712
  headers: {
1509
1713
  [name: string]: unknown;
@@ -1863,7 +2067,7 @@ export interface paths {
1863
2067
  "application/json": components["schemas"]["ApiErrorEnvelope"];
1864
2068
  };
1865
2069
  };
1866
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
2070
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
1867
2071
  409: {
1868
2072
  headers: {
1869
2073
  [name: string]: unknown;
@@ -1972,7 +2176,7 @@ export interface paths {
1972
2176
  "application/json": components["schemas"]["ApiErrorEnvelope"];
1973
2177
  };
1974
2178
  };
1975
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
2179
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
1976
2180
  409: {
1977
2181
  headers: {
1978
2182
  [name: string]: unknown;
@@ -4408,7 +4612,7 @@ export interface paths {
4408
4612
  "application/json": components["schemas"]["ApiErrorEnvelope"];
4409
4613
  };
4410
4614
  };
4411
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
4615
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
4412
4616
  409: {
4413
4617
  headers: {
4414
4618
  [name: string]: unknown;
@@ -4507,7 +4711,7 @@ export interface paths {
4507
4711
  "application/json": components["schemas"]["ApiErrorEnvelope"];
4508
4712
  };
4509
4713
  };
4510
- /** @description Conflict (e.g. webhook subscription disabled, setup link inactive) */
4714
+ /** @description Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive) */
4511
4715
  409: {
4512
4716
  headers: {
4513
4717
  [name: string]: unknown;
@@ -4870,6 +5074,10 @@ export interface components {
4870
5074
  data: components["schemas"]["Template"];
4871
5075
  request_id: string;
4872
5076
  };
5077
+ CreateTemplateResponse: {
5078
+ data: components["schemas"]["Template"];
5079
+ request_id: string;
5080
+ };
4873
5081
  SyncTemplatesResponse: {
4874
5082
  data: {
4875
5083
  /** @enum {string} */
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION: "3.5.0";
1
+ export declare const SDK_VERSION: "3.7.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.5.0";
5
+ export const SDK_VERSION = "3.7.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.5.0" as const
6
+ export const SDK_VERSION = "3.7.0" as const
package/dist/index.d.ts CHANGED
@@ -11,5 +11,5 @@ export type { Page, Paginator } from './pagination.js';
11
11
  export type { RequestOptions } from './http.js';
12
12
  export { KirimError, InvalidRequestError, AuthenticationError, PermissionError, NotFoundError, ConflictError, RateLimitError, ApiServerError, ConnectionError, type KirimErrorType, type KirimErrorPayload, } from './errors.js';
13
13
  export type { Customer, CustomerStatus, CustomerWithAccounts, CustomerWhatsappAccountSummary, CustomerSetupLink, CustomerSetupLinkStatus, CustomerSetupLinkWithToken, CreateCustomerParams, UpdateCustomerParams, ListCustomersParams, CreateSetupLinkParams, UpdateSetupLinkParams, } from './resources/customers.js';
14
- export type { MeContext, MePublicTeam, Account, ListAccountsParams, Message, MessageListItem, SendMessageParams, ListMessagesParams, MessageMediaRedirect, Template, TemplateListItem, ListTemplatesParams, RetrieveTemplateParams, Conversation, ConversationListItem, ListConversationsParams, UpdateConversationParams, AttachConversationLabelParams, Contact, ContactListItem, ListContactsParams, CreateContactParams, UpdateContactParams, AttachContactLabelParams, BulkLabelContactsParams, Label, LabelListItem, ListLabelsParams, CreateLabelParams, UpdateLabelParams, WebhookSubscription, WebhookSubscriptionListItem, CreateWebhookSubscriptionParams, UpdateWebhookSubscriptionParams, AddWebhookSecret, WebhookDelivery, WebhookDeliveryListItem, ListWebhookDeliveriesParams, BulkReplayParams, BulkReplayResult, } from './types.js';
14
+ export type { MeContext, MePublicTeam, Account, ListAccountsParams, Message, MessageListItem, SendMessageParams, ListMessagesParams, MessageMediaRedirect, Template, TemplateListItem, ListTemplatesParams, RetrieveTemplateParams, CreateTemplateParams, Conversation, ConversationListItem, ListConversationsParams, UpdateConversationParams, AttachConversationLabelParams, Contact, ContactListItem, ListContactsParams, CreateContactParams, UpdateContactParams, AttachContactLabelParams, BulkLabelContactsParams, Label, LabelListItem, ListLabelsParams, CreateLabelParams, UpdateLabelParams, WebhookSubscription, WebhookSubscriptionListItem, CreateWebhookSubscriptionParams, UpdateWebhookSubscriptionParams, AddWebhookSecret, WebhookDelivery, WebhookDeliveryListItem, ListWebhookDeliveriesParams, BulkReplayParams, BulkReplayResult, } from './types.js';
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,8BAA8B,EAC9B,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,0BAA0B,CAAA;AAEjC,YAAY,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,8BAA8B,EAC9B,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,0BAA0B,CAAA;AAEjC,YAAY,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,YAAY,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { HttpClient, RequestOptions } from '../http.js';
2
2
  import { Paginator } from '../pagination.js';
3
- import type { ListTemplatesParams, RetrieveTemplateParams, Template, TemplateListItem } from '../types.js';
3
+ import type { CreateTemplateParams, ListTemplatesParams, RetrieveTemplateParams, Template, TemplateListItem } from '../types.js';
4
4
  /**
5
5
  * Templates resource — Meta-style path-scoped.
6
6
  *
@@ -13,6 +13,22 @@ export declare class TemplatesResource {
13
13
  constructor(http: HttpClient, prefix: string);
14
14
  list(params?: ListTemplatesParams, options?: RequestOptions): Paginator<TemplateListItem>;
15
15
  retrieve(name: string, params?: RetrieveTemplateParams, options?: RequestOptions): Promise<Template>;
16
+ /**
17
+ * Create a new message template and submit it to Meta for review.
18
+ *
19
+ * The request body is components-only — mirror Meta's `message_templates`
20
+ * create shape: a `name` (lowercase letters, numbers, underscores), a
21
+ * `category` (`MARKETING` | `UTILITY` | `AUTHENTICATION`), a BCP-47
22
+ * `language`, and a `components` array with exactly one BODY component
23
+ * (plus optional HEADER / FOOTER / BUTTONS).
24
+ *
25
+ * Returns the created template with `status: "pending"`. Meta reviews
26
+ * asynchronously, so poll {@link retrieve} (or {@link sync}) for the
27
+ * eventual `approved` / `rejected` status. A `name`+`language` pair that
28
+ * already exists for the account throws `ConflictError`
29
+ * (`template_already_exists`, HTTP 409, `param: "name"`).
30
+ */
31
+ create(params: CreateTemplateParams, options?: RequestOptions): Promise<Template>;
16
32
  /**
17
33
  * Pull the latest template inventory from Meta and upsert into the
18
34
  * Kirim DB for this WhatsApp account. Idempotent — call any time,
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,QAAQ,EACR,gBAAgB,EACjB,MAAM,aAAa,CAAA;AAEpB;;;;;GAKG;AACH,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM;IAGjC,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC,gBAAgB,CAAC;IAWzF,QAAQ,CACN,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,sBAAsB,EAC/B,O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AC,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAQ5D;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,sBAAsB,CAAA;IAC9B,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAA;IACd,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -26,6 +26,29 @@ export class TemplatesResource {
26
26
  ...(options ? { options } : {}),
27
27
  });
28
28
  }
29
+ /**
30
+ * Create a new message template and submit it to Meta for review.
31
+ *
32
+ * The request body is components-only — mirror Meta's `message_templates`
33
+ * create shape: a `name` (lowercase letters, numbers, underscores), a
34
+ * `category` (`MARKETING` | `UTILITY` | `AUTHENTICATION`), a BCP-47
35
+ * `language`, and a `components` array with exactly one BODY component
36
+ * (plus optional HEADER / FOOTER / BUTTONS).
37
+ *
38
+ * Returns the created template with `status: "pending"`. Meta reviews
39
+ * asynchronously, so poll {@link retrieve} (or {@link sync}) for the
40
+ * eventual `approved` / `rejected` status. A `name`+`language` pair that
41
+ * already exists for the account throws `ConflictError`
42
+ * (`template_already_exists`, HTTP 409, `param: "name"`).
43
+ */
44
+ create(params, options) {
45
+ return this.http.requestData({
46
+ method: 'POST',
47
+ path: `${this.prefix}/templates`,
48
+ body: params,
49
+ ...(options ? { options } : {}),
50
+ });
51
+ }
29
52
  /**
30
53
  * Pull the latest template inventory from Meta and upsert into the
31
54
  * Kirim DB for this WhatsApp account. Idempotent — call any time,
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAQ5C;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IAET;IACA;IAFnB,YACmB,IAAgB,EAChB,MAAc;QADd,SAAI,GAAJ,IAAI,CAAY;QAChB,WAAM,GAAN,MAAM,CAAQ;IAC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AAM;YACd,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,iBAAiB;YACrC,IAAI,EAAE,EAAE;YACR,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChC,CAAC,CAAA;IACJ,CAAC;CACF"}
package/dist/types.d.ts CHANGED
@@ -45,6 +45,7 @@ export type Template = SingleData<Schemas['GetTemplateResponse']>;
45
45
  export type TemplateListItem = ListData<Schemas['ListTemplatesResponse']>;
46
46
  export type ListTemplatesParams = NonNullable<paths['/{phone_number_id}/templates']['get']['parameters']['query']>;
47
47
  export type RetrieveTemplateParams = NonNullable<paths['/{phone_number_id}/templates/{name}']['get']['parameters']['query']>;
48
+ export type CreateTemplateParams = NonNullable<paths['/{phone_number_id}/templates']['post']['requestBody']>['content']['application/json'];
48
49
  export type Conversation = SingleData<Schemas['GetConversationResponse']>;
49
50
  export type ConversationListItem = ListData<Schemas['ListConversationsResponse']>;
50
51
  export type ListConversationsParams = NonNullable<paths['/{phone_number_id}/conversations']['get']['parameters']['query']>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAE9D,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAA;AAG3C,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAA;AAC5D,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAA;AAGjE,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CA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;AACxF,MAAM,MAAM,2BAA2B,GAAG,WAAW,CACnD,KAAK,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAC3D,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,WAAW,CACxC,KAAK,CAAC,iCAAiC,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAChE,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAChC,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAA"}
@@ -83,10 +83,34 @@ export type ContactUpdatedEvent = KirimEventEnvelope<'contact.updated', {
83
83
  export type KirimNativeWebhookEvent = ConversationAssignedEvent | ConversationClosedEvent | ContactCreatedEvent | ContactUpdatedEvent;
84
84
  /**
85
85
  * Meta passthrough body — `message.received` and `message.status`
86
- * deliveries forward Meta's WhatsApp Cloud webhook payload unchanged.
86
+ * deliveries forward Meta's WhatsApp Cloud webhook payload shape.
87
+ * `message.received` may also include an optional top-level `kirim`
88
+ * block with Kirimdev resource ids, conversation labels, and media URL.
87
89
  * Callers should branch on `X-Kirim-Event` to decide whether to parse
88
90
  * the body as `KirimNativeWebhookEvent` or `MetaPassthroughBody`.
89
91
  */
92
+ export type MessageReceivedMediaStatus = 'ready' | 'failed' | 'unavailable' | 'pending';
93
+ export interface MessageReceivedKirimContext {
94
+ conversation_id: string;
95
+ contact_id: string;
96
+ message_id: string;
97
+ phone_number_id: string;
98
+ labels: Array<{
99
+ id: string;
100
+ name: string;
101
+ color: string;
102
+ }>;
103
+ conversation: {
104
+ status: string;
105
+ assigned_to: string | null;
106
+ };
107
+ contact: {
108
+ name: string | null;
109
+ phone_number: string | null;
110
+ };
111
+ media_url: string | null;
112
+ media_status: MessageReceivedMediaStatus | null;
113
+ }
90
114
  export interface MetaPassthroughBody {
91
115
  object: 'whatsapp_business_account';
92
116
  entry: Array<{
@@ -96,6 +120,8 @@ export interface MetaPassthroughBody {
96
120
  field: 'messages' | string;
97
121
  }>;
98
122
  }>;
123
+ /** Present on `message.received` — Kirimdev routing context. Safe to ignore. */
124
+ kirim?: MessageReceivedKirimContext;
99
125
  }
100
126
  export type KirimWebhookEvent = KirimNativeWebhookEvent | MetaPassthroughBody;
101
127
  //# 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,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,uCAAuC;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,MAAM,CAAA;CAC1B;AA8BD,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAyBlF;AAgCD;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK;IAC7D,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,KAAK,CAAA;IACX,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,KAAK,CAAA;CACZ;AAED,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,CACxD,uBAAuB,E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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
@@ -1257,6 +1257,21 @@
1257
1257
  "request_id"
1258
1258
  ]
1259
1259
  },
1260
+ "CreateTemplateResponse": {
1261
+ "type": "object",
1262
+ "properties": {
1263
+ "data": {
1264
+ "$ref": "#/components/schemas/Template"
1265
+ },
1266
+ "request_id": {
1267
+ "type": "string"
1268
+ }
1269
+ },
1270
+ "required": [
1271
+ "data",
1272
+ "request_id"
1273
+ ]
1274
+ },
1260
1275
  "SyncTemplatesResponse": {
1261
1276
  "type": "object",
1262
1277
  "properties": {
@@ -2544,7 +2559,7 @@
2544
2559
  "Messages"
2545
2560
  ],
2546
2561
  "summary": "Send a WhatsApp message or mark inbound as read",
2547
- "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.",
2548
2563
  "security": [
2549
2564
  {
2550
2565
  "bearerAuth": []
@@ -2597,6 +2612,21 @@
2597
2612
  "to": {
2598
2613
  "type": "string"
2599
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
+ },
2600
2630
  "type": {
2601
2631
  "type": "string",
2602
2632
  "enum": [
@@ -2646,6 +2676,21 @@
2646
2676
  "to": {
2647
2677
  "type": "string"
2648
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
+ },
2649
2694
  "type": {
2650
2695
  "type": "string",
2651
2696
  "enum": [
@@ -2701,6 +2746,21 @@
2701
2746
  "to": {
2702
2747
  "type": "string"
2703
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
+ },
2704
2764
  "type": {
2705
2765
  "type": "string",
2706
2766
  "enum": [
@@ -2756,6 +2816,21 @@
2756
2816
  "to": {
2757
2817
  "type": "string"
2758
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
+ },
2759
2834
  "type": {
2760
2835
  "type": "string",
2761
2836
  "enum": [
@@ -2811,6 +2886,21 @@
2811
2886
  "to": {
2812
2887
  "type": "string"
2813
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
+ },
2814
2904
  "type": {
2815
2905
  "type": "string",
2816
2906
  "enum": [
@@ -2869,6 +2959,21 @@
2869
2959
  "to": {
2870
2960
  "type": "string"
2871
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
+ },
2872
2977
  "type": {
2873
2978
  "type": "string",
2874
2979
  "enum": [
@@ -2982,6 +3087,21 @@
2982
3087
  "to": {
2983
3088
  "type": "string"
2984
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
+ },
2985
3105
  "type": {
2986
3106
  "type": "string",
2987
3107
  "enum": [
@@ -4152,6 +4272,321 @@
4152
4272
  }
4153
4273
  }
4154
4274
  }
4275
+ },
4276
+ "post": {
4277
+ "tags": [
4278
+ "Templates"
4279
+ ],
4280
+ "summary": "Create a template",
4281
+ "description": "Create a new message template and submit it to Meta for review. The request body is components-only (mirrors Meta's `message_templates` create shape). On success the template is persisted with `status: \"pending\"`; Meta reviews asynchronously, so poll `GET /{phone_number_id}/templates/{name}` (or re-run `POST .../templates/sync`) for the eventual `approved` / `rejected` transition. A `name`+`language` pair that already exists for the account returns `400 invalid_field_value`.",
4282
+ "security": [
4283
+ {
4284
+ "bearerAuth": []
4285
+ }
4286
+ ],
4287
+ "parameters": [
4288
+ {
4289
+ "schema": {
4290
+ "type": "string",
4291
+ "pattern": "^\\d{6,20}$",
4292
+ "example": "106540352242922",
4293
+ "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)."
4294
+ },
4295
+ "required": true,
4296
+ "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).",
4297
+ "name": "phone_number_id",
4298
+ "in": "path"
4299
+ }
4300
+ ],
4301
+ "requestBody": {
4302
+ "content": {
4303
+ "application/json": {
4304
+ "schema": {
4305
+ "type": "object",
4306
+ "properties": {
4307
+ "name": {
4308
+ "type": "string",
4309
+ "minLength": 1,
4310
+ "maxLength": 512,
4311
+ "pattern": "^[a-z0-9_]+$",
4312
+ "example": "order_confirmation"
4313
+ },
4314
+ "category": {
4315
+ "type": "string",
4316
+ "enum": [
4317
+ "MARKETING",
4318
+ "UTILITY",
4319
+ "AUTHENTICATION"
4320
+ ],
4321
+ "example": "UTILITY"
4322
+ },
4323
+ "language": {
4324
+ "type": "string",
4325
+ "minLength": 2,
4326
+ "maxLength": 10,
4327
+ "pattern": "^[a-z]{2,3}(_[A-Z]{2})?$",
4328
+ "default": "en",
4329
+ "example": "id"
4330
+ },
4331
+ "components": {
4332
+ "type": "array",
4333
+ "items": {
4334
+ "type": "object",
4335
+ "properties": {
4336
+ "type": {
4337
+ "type": "string",
4338
+ "enum": [
4339
+ "HEADER",
4340
+ "BODY",
4341
+ "FOOTER",
4342
+ "BUTTONS"
4343
+ ]
4344
+ },
4345
+ "format": {
4346
+ "type": "string",
4347
+ "enum": [
4348
+ "TEXT",
4349
+ "IMAGE",
4350
+ "VIDEO",
4351
+ "DOCUMENT",
4352
+ "LOCATION"
4353
+ ]
4354
+ },
4355
+ "text": {
4356
+ "type": "string"
4357
+ },
4358
+ "example": {
4359
+ "type": "object",
4360
+ "properties": {
4361
+ "header_text": {
4362
+ "type": "array",
4363
+ "items": {
4364
+ "type": "string"
4365
+ }
4366
+ },
4367
+ "header_handle": {
4368
+ "type": "array",
4369
+ "items": {
4370
+ "type": "string"
4371
+ }
4372
+ },
4373
+ "header_url": {
4374
+ "type": "array",
4375
+ "items": {
4376
+ "type": "string",
4377
+ "format": "uri"
4378
+ }
4379
+ },
4380
+ "body_text": {
4381
+ "type": "array",
4382
+ "items": {
4383
+ "type": "array",
4384
+ "items": {
4385
+ "type": "string"
4386
+ }
4387
+ }
4388
+ }
4389
+ }
4390
+ },
4391
+ "buttons": {
4392
+ "type": "array",
4393
+ "items": {
4394
+ "type": "object",
4395
+ "properties": {
4396
+ "type": {
4397
+ "type": "string",
4398
+ "enum": [
4399
+ "URL",
4400
+ "PHONE_NUMBER",
4401
+ "QUICK_REPLY",
4402
+ "COPY_CODE",
4403
+ "OTP",
4404
+ "VOICE_CALL"
4405
+ ]
4406
+ },
4407
+ "text": {
4408
+ "type": "string",
4409
+ "minLength": 1,
4410
+ "maxLength": 25
4411
+ },
4412
+ "url": {
4413
+ "type": "string",
4414
+ "maxLength": 2000,
4415
+ "format": "uri"
4416
+ },
4417
+ "phone_number": {
4418
+ "type": "string",
4419
+ "pattern": "^\\+[1-9]\\d{7,14}$"
4420
+ },
4421
+ "otp_type": {
4422
+ "type": "string",
4423
+ "enum": [
4424
+ "COPY_CODE",
4425
+ "ONE_TAP",
4426
+ "ZERO_TAP"
4427
+ ]
4428
+ },
4429
+ "autofill_text": {
4430
+ "type": "string"
4431
+ },
4432
+ "supported_apps": {
4433
+ "type": "array",
4434
+ "items": {
4435
+ "type": "object",
4436
+ "properties": {
4437
+ "package_name": {
4438
+ "type": "string"
4439
+ },
4440
+ "signature_hash": {
4441
+ "type": "string"
4442
+ }
4443
+ },
4444
+ "required": [
4445
+ "package_name",
4446
+ "signature_hash"
4447
+ ]
4448
+ }
4449
+ },
4450
+ "example": {
4451
+ "type": "array",
4452
+ "items": {
4453
+ "type": "string"
4454
+ }
4455
+ }
4456
+ },
4457
+ "required": [
4458
+ "type"
4459
+ ]
4460
+ }
4461
+ },
4462
+ "add_security_recommendation": {
4463
+ "type": "boolean"
4464
+ },
4465
+ "code_expiration_minutes": {
4466
+ "type": "integer",
4467
+ "minimum": 1,
4468
+ "maximum": 60
4469
+ }
4470
+ },
4471
+ "required": [
4472
+ "type"
4473
+ ]
4474
+ },
4475
+ "minItems": 1
4476
+ },
4477
+ "variables": {
4478
+ "type": "array",
4479
+ "items": {
4480
+ "type": "string"
4481
+ }
4482
+ },
4483
+ "messageSendTtlSeconds": {
4484
+ "type": "integer",
4485
+ "minimum": 30,
4486
+ "maximum": 2592000
4487
+ }
4488
+ },
4489
+ "required": [
4490
+ "name",
4491
+ "category",
4492
+ "components"
4493
+ ]
4494
+ }
4495
+ }
4496
+ }
4497
+ },
4498
+ "responses": {
4499
+ "200": {
4500
+ "description": "Template created (pending Meta review)",
4501
+ "content": {
4502
+ "application/json": {
4503
+ "schema": {
4504
+ "$ref": "#/components/schemas/CreateTemplateResponse"
4505
+ }
4506
+ }
4507
+ }
4508
+ },
4509
+ "400": {
4510
+ "description": "Validation failure",
4511
+ "content": {
4512
+ "application/json": {
4513
+ "schema": {
4514
+ "$ref": "#/components/schemas/ApiErrorEnvelope"
4515
+ }
4516
+ }
4517
+ }
4518
+ },
4519
+ "401": {
4520
+ "description": "Authentication failure",
4521
+ "content": {
4522
+ "application/json": {
4523
+ "schema": {
4524
+ "$ref": "#/components/schemas/ApiErrorEnvelope"
4525
+ }
4526
+ }
4527
+ }
4528
+ },
4529
+ "404": {
4530
+ "description": "Resource not found",
4531
+ "content": {
4532
+ "application/json": {
4533
+ "schema": {
4534
+ "$ref": "#/components/schemas/ApiErrorEnvelope"
4535
+ }
4536
+ }
4537
+ }
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
+ },
4549
+ "422": {
4550
+ "description": "Semantic failure (e.g. idempotency key reuse)",
4551
+ "content": {
4552
+ "application/json": {
4553
+ "schema": {
4554
+ "$ref": "#/components/schemas/ApiErrorEnvelope"
4555
+ }
4556
+ }
4557
+ }
4558
+ },
4559
+ "429": {
4560
+ "description": "Rate limit exceeded",
4561
+ "content": {
4562
+ "application/json": {
4563
+ "schema": {
4564
+ "$ref": "#/components/schemas/ApiErrorEnvelope"
4565
+ }
4566
+ }
4567
+ }
4568
+ },
4569
+ "500": {
4570
+ "description": "Internal server error",
4571
+ "content": {
4572
+ "application/json": {
4573
+ "schema": {
4574
+ "$ref": "#/components/schemas/ApiErrorEnvelope"
4575
+ }
4576
+ }
4577
+ }
4578
+ },
4579
+ "502": {
4580
+ "description": "Upstream WhatsApp error",
4581
+ "content": {
4582
+ "application/json": {
4583
+ "schema": {
4584
+ "$ref": "#/components/schemas/ApiErrorEnvelope"
4585
+ }
4586
+ }
4587
+ }
4588
+ }
4589
+ }
4155
4590
  }
4156
4591
  },
4157
4592
  "/{phone_number_id}/templates/{name}": {
@@ -4985,7 +5420,7 @@
4985
5420
  }
4986
5421
  },
4987
5422
  "409": {
4988
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
5423
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
4989
5424
  "content": {
4990
5425
  "application/json": {
4991
5426
  "schema": {
@@ -5418,7 +5853,7 @@
5418
5853
  }
5419
5854
  },
5420
5855
  "409": {
5421
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
5856
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
5422
5857
  "content": {
5423
5858
  "application/json": {
5424
5859
  "schema": {
@@ -5543,7 +5978,7 @@
5543
5978
  }
5544
5979
  },
5545
5980
  "409": {
5546
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
5981
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
5547
5982
  "content": {
5548
5983
  "application/json": {
5549
5984
  "schema": {
@@ -8704,7 +9139,7 @@
8704
9139
  }
8705
9140
  },
8706
9141
  "409": {
8707
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
9142
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
8708
9143
  "content": {
8709
9144
  "application/json": {
8710
9145
  "schema": {
@@ -8818,7 +9253,7 @@
8818
9253
  }
8819
9254
  },
8820
9255
  "409": {
8821
- "description": "Conflict (e.g. webhook subscription disabled, setup link inactive)",
9256
+ "description": "Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)",
8822
9257
  "content": {
8823
9258
  "application/json": {
8824
9259
  "schema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirimdev/sdk",
3
- "version": "3.5.0",
3
+ "version": "3.7.0",
4
4
  "description": "Official TypeScript SDK for the Kirimdev Public API.",
5
5
  "type": "module",
6
6
  "license": "MIT",