@kirimdev/sdk 3.4.0 → 3.6.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/dist/generated/schema.d.ts +154 -2
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/generated/version.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/resources/templates.d.ts +17 -1
- package/dist/resources/templates.d.ts.map +1 -1
- package/dist/resources/templates.js +23 -0
- package/dist/resources/templates.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/openapi.json +354 -2
- package/package.json +1 -1
|
@@ -58,7 +58,7 @@ export interface paths {
|
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
60
60
|
* Introspect the calling API key
|
|
61
|
-
* @description Returns the organization, API key,
|
|
61
|
+
* @description Returns the organization, API key, rate-limit tier, and the list of teams under the organization associated with the bearer token. Use to verify key validity from automation scripts and to discover the `team_id` values required by team-scoped writes (e.g. `POST /v1/customers` on multi-team orgs).
|
|
62
62
|
*/
|
|
63
63
|
get: {
|
|
64
64
|
parameters: {
|
|
@@ -845,7 +845,146 @@ export interface paths {
|
|
|
845
845
|
};
|
|
846
846
|
};
|
|
847
847
|
put?: never;
|
|
848
|
-
|
|
848
|
+
/**
|
|
849
|
+
* Create a template
|
|
850
|
+
* @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`.
|
|
851
|
+
*/
|
|
852
|
+
post: {
|
|
853
|
+
parameters: {
|
|
854
|
+
query?: never;
|
|
855
|
+
header?: never;
|
|
856
|
+
path: {
|
|
857
|
+
/** @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). */
|
|
858
|
+
phone_number_id: string;
|
|
859
|
+
};
|
|
860
|
+
cookie?: never;
|
|
861
|
+
};
|
|
862
|
+
requestBody?: {
|
|
863
|
+
content: {
|
|
864
|
+
"application/json": {
|
|
865
|
+
/** @example order_confirmation */
|
|
866
|
+
name: string;
|
|
867
|
+
/**
|
|
868
|
+
* @example UTILITY
|
|
869
|
+
* @enum {string}
|
|
870
|
+
*/
|
|
871
|
+
category: "MARKETING" | "UTILITY" | "AUTHENTICATION";
|
|
872
|
+
/**
|
|
873
|
+
* @default en
|
|
874
|
+
* @example id
|
|
875
|
+
*/
|
|
876
|
+
language?: string;
|
|
877
|
+
components: {
|
|
878
|
+
/** @enum {string} */
|
|
879
|
+
type: "HEADER" | "BODY" | "FOOTER" | "BUTTONS";
|
|
880
|
+
/** @enum {string} */
|
|
881
|
+
format?: "TEXT" | "IMAGE" | "VIDEO" | "DOCUMENT" | "LOCATION";
|
|
882
|
+
text?: string;
|
|
883
|
+
example?: {
|
|
884
|
+
header_text?: string[];
|
|
885
|
+
header_handle?: string[];
|
|
886
|
+
header_url?: string[];
|
|
887
|
+
body_text?: string[][];
|
|
888
|
+
};
|
|
889
|
+
buttons?: {
|
|
890
|
+
/** @enum {string} */
|
|
891
|
+
type: "URL" | "PHONE_NUMBER" | "QUICK_REPLY" | "COPY_CODE" | "OTP" | "VOICE_CALL";
|
|
892
|
+
text?: string;
|
|
893
|
+
/** Format: uri */
|
|
894
|
+
url?: string;
|
|
895
|
+
phone_number?: string;
|
|
896
|
+
/** @enum {string} */
|
|
897
|
+
otp_type?: "COPY_CODE" | "ONE_TAP" | "ZERO_TAP";
|
|
898
|
+
autofill_text?: string;
|
|
899
|
+
supported_apps?: {
|
|
900
|
+
package_name: string;
|
|
901
|
+
signature_hash: string;
|
|
902
|
+
}[];
|
|
903
|
+
example?: string[];
|
|
904
|
+
}[];
|
|
905
|
+
add_security_recommendation?: boolean;
|
|
906
|
+
code_expiration_minutes?: number;
|
|
907
|
+
}[];
|
|
908
|
+
variables?: string[];
|
|
909
|
+
messageSendTtlSeconds?: number;
|
|
910
|
+
};
|
|
911
|
+
};
|
|
912
|
+
};
|
|
913
|
+
responses: {
|
|
914
|
+
/** @description Template created (pending Meta review) */
|
|
915
|
+
200: {
|
|
916
|
+
headers: {
|
|
917
|
+
[name: string]: unknown;
|
|
918
|
+
};
|
|
919
|
+
content: {
|
|
920
|
+
"application/json": components["schemas"]["CreateTemplateResponse"];
|
|
921
|
+
};
|
|
922
|
+
};
|
|
923
|
+
/** @description Validation failure */
|
|
924
|
+
400: {
|
|
925
|
+
headers: {
|
|
926
|
+
[name: string]: unknown;
|
|
927
|
+
};
|
|
928
|
+
content: {
|
|
929
|
+
"application/json": components["schemas"]["ApiErrorEnvelope"];
|
|
930
|
+
};
|
|
931
|
+
};
|
|
932
|
+
/** @description Authentication failure */
|
|
933
|
+
401: {
|
|
934
|
+
headers: {
|
|
935
|
+
[name: string]: unknown;
|
|
936
|
+
};
|
|
937
|
+
content: {
|
|
938
|
+
"application/json": components["schemas"]["ApiErrorEnvelope"];
|
|
939
|
+
};
|
|
940
|
+
};
|
|
941
|
+
/** @description Resource not found */
|
|
942
|
+
404: {
|
|
943
|
+
headers: {
|
|
944
|
+
[name: string]: unknown;
|
|
945
|
+
};
|
|
946
|
+
content: {
|
|
947
|
+
"application/json": components["schemas"]["ApiErrorEnvelope"];
|
|
948
|
+
};
|
|
949
|
+
};
|
|
950
|
+
/** @description Semantic failure (e.g. idempotency key reuse) */
|
|
951
|
+
422: {
|
|
952
|
+
headers: {
|
|
953
|
+
[name: string]: unknown;
|
|
954
|
+
};
|
|
955
|
+
content: {
|
|
956
|
+
"application/json": components["schemas"]["ApiErrorEnvelope"];
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
/** @description Rate limit exceeded */
|
|
960
|
+
429: {
|
|
961
|
+
headers: {
|
|
962
|
+
[name: string]: unknown;
|
|
963
|
+
};
|
|
964
|
+
content: {
|
|
965
|
+
"application/json": components["schemas"]["ApiErrorEnvelope"];
|
|
966
|
+
};
|
|
967
|
+
};
|
|
968
|
+
/** @description Internal server error */
|
|
969
|
+
500: {
|
|
970
|
+
headers: {
|
|
971
|
+
[name: string]: unknown;
|
|
972
|
+
};
|
|
973
|
+
content: {
|
|
974
|
+
"application/json": components["schemas"]["ApiErrorEnvelope"];
|
|
975
|
+
};
|
|
976
|
+
};
|
|
977
|
+
/** @description Upstream WhatsApp error */
|
|
978
|
+
502: {
|
|
979
|
+
headers: {
|
|
980
|
+
[name: string]: unknown;
|
|
981
|
+
};
|
|
982
|
+
content: {
|
|
983
|
+
"application/json": components["schemas"]["ApiErrorEnvelope"];
|
|
984
|
+
};
|
|
985
|
+
};
|
|
986
|
+
};
|
|
987
|
+
};
|
|
849
988
|
delete?: never;
|
|
850
989
|
options?: never;
|
|
851
990
|
head?: never;
|
|
@@ -4834,6 +4973,15 @@ export interface components {
|
|
|
4834
4973
|
write_per_minute: number;
|
|
4835
4974
|
read_per_minute: number;
|
|
4836
4975
|
};
|
|
4976
|
+
/** @description Teams under the organization, ordered by creation time (oldest first). For single-team orgs, `team_id` is auto-selected on writes; for multi-team orgs you must pass one of these ids explicitly. */
|
|
4977
|
+
teams: {
|
|
4978
|
+
/** @description Internal team id — pass this as `team_id` on team-scoped writes (e.g. `POST /v1/customers`). */
|
|
4979
|
+
id: string;
|
|
4980
|
+
/** @enum {string} */
|
|
4981
|
+
object: "team";
|
|
4982
|
+
name: string;
|
|
4983
|
+
slug: string;
|
|
4984
|
+
}[];
|
|
4837
4985
|
};
|
|
4838
4986
|
request_id: string;
|
|
4839
4987
|
};
|
|
@@ -4861,6 +5009,10 @@ export interface components {
|
|
|
4861
5009
|
data: components["schemas"]["Template"];
|
|
4862
5010
|
request_id: string;
|
|
4863
5011
|
};
|
|
5012
|
+
CreateTemplateResponse: {
|
|
5013
|
+
data: components["schemas"]["Template"];
|
|
5014
|
+
request_id: string;
|
|
5015
|
+
};
|
|
4864
5016
|
SyncTemplatesResponse: {
|
|
4865
5017
|
data: {
|
|
4866
5018
|
/** @enum {string} */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION: "3.
|
|
1
|
+
export declare const SDK_VERSION: "3.6.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
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, 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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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 `InvalidRequestError`
|
|
29
|
+
* (`invalid_field_value`, `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,MA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,CAAC;IASjF;;;;;;;OAOG;IACH,IAAI,CAAC,OAAO,CAAC,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 `InvalidRequestError`
|
|
42
|
+
* (`invalid_field_value`, `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;
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAS5C;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IAET;IACA;IAFnB,YACmB,IAAgB,EAChB,MAAc;QADd,SAAI,GAAJ,IAAI,CAAY;QAChB,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;IAEJ,IAAI,CAAC,MAA4B,EAAE,OAAwB;QACzD,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,IAAI,EACT;YACE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,YAAY;YAChC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAsE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrG,EACD,OAAO,CACR,CAAA;IACH,CAAC;IAED,QAAQ,CACN,IAAY,EACZ,MAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAW;YACrC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,cAAc,kBAAkB,CAAC,IAAI,CAAC,EAAE;YAC5D,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAsE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACpG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChC,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAA4B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAW;YACrC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,YAAY;YAChC,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChC,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAqB;YAC/C,MAAM,EAAE,MAAM;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
|
@@ -12,6 +12,7 @@ type ListData<T> = T extends {
|
|
|
12
12
|
data: Array<infer D>;
|
|
13
13
|
} ? D : never;
|
|
14
14
|
export type MeContext = SingleData<Schemas['MeResponse']>;
|
|
15
|
+
export type MePublicTeam = MeContext['teams'][number];
|
|
15
16
|
export type Account = ListData<Schemas['ListAccountsResponse']>;
|
|
16
17
|
export type ListAccountsParams = NonNullable<paths['/accounts']['get']['parameters']['query']>;
|
|
17
18
|
export type Message = SingleData<Schemas['GetMessageResponse']>;
|
|
@@ -44,6 +45,7 @@ export type Template = SingleData<Schemas['GetTemplateResponse']>;
|
|
|
44
45
|
export type TemplateListItem = ListData<Schemas['ListTemplatesResponse']>;
|
|
45
46
|
export type ListTemplatesParams = NonNullable<paths['/{phone_number_id}/templates']['get']['parameters']['query']>;
|
|
46
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'];
|
|
47
49
|
export type Conversation = SingleData<Schemas['GetConversationResponse']>;
|
|
48
50
|
export type ConversationListItem = ListData<Schemas['ListConversationsResponse']>;
|
|
49
51
|
export type ListConversationsParams = NonNullable<paths['/{phone_number_id}/conversations']['get']['parameters']['query']>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,CAAC,CAAA;
|
|
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,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gB,GAAG,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAA"}
|
package/openapi.json
CHANGED
|
@@ -1105,12 +1105,44 @@
|
|
|
1105
1105
|
"write_per_minute",
|
|
1106
1106
|
"read_per_minute"
|
|
1107
1107
|
]
|
|
1108
|
+
},
|
|
1109
|
+
"teams": {
|
|
1110
|
+
"type": "array",
|
|
1111
|
+
"items": {
|
|
1112
|
+
"type": "object",
|
|
1113
|
+
"properties": {
|
|
1114
|
+
"id": {
|
|
1115
|
+
"type": "string",
|
|
1116
|
+
"description": "Internal team id — pass this as `team_id` on team-scoped writes (e.g. `POST /v1/customers`)."
|
|
1117
|
+
},
|
|
1118
|
+
"object": {
|
|
1119
|
+
"type": "string",
|
|
1120
|
+
"enum": [
|
|
1121
|
+
"team"
|
|
1122
|
+
]
|
|
1123
|
+
},
|
|
1124
|
+
"name": {
|
|
1125
|
+
"type": "string"
|
|
1126
|
+
},
|
|
1127
|
+
"slug": {
|
|
1128
|
+
"type": "string"
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
"required": [
|
|
1132
|
+
"id",
|
|
1133
|
+
"object",
|
|
1134
|
+
"name",
|
|
1135
|
+
"slug"
|
|
1136
|
+
]
|
|
1137
|
+
},
|
|
1138
|
+
"description": "Teams under the organization, ordered by creation time (oldest first). For single-team orgs, `team_id` is auto-selected on writes; for multi-team orgs you must pass one of these ids explicitly."
|
|
1108
1139
|
}
|
|
1109
1140
|
},
|
|
1110
1141
|
"required": [
|
|
1111
1142
|
"organization",
|
|
1112
1143
|
"api_key",
|
|
1113
|
-
"rate_limits"
|
|
1144
|
+
"rate_limits",
|
|
1145
|
+
"teams"
|
|
1114
1146
|
]
|
|
1115
1147
|
},
|
|
1116
1148
|
"request_id": {
|
|
@@ -1225,6 +1257,21 @@
|
|
|
1225
1257
|
"request_id"
|
|
1226
1258
|
]
|
|
1227
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
|
+
},
|
|
1228
1275
|
"SyncTemplatesResponse": {
|
|
1229
1276
|
"type": "object",
|
|
1230
1277
|
"properties": {
|
|
@@ -2367,7 +2414,7 @@
|
|
|
2367
2414
|
"Meta"
|
|
2368
2415
|
],
|
|
2369
2416
|
"summary": "Introspect the calling API key",
|
|
2370
|
-
"description": "Returns the organization, API key,
|
|
2417
|
+
"description": "Returns the organization, API key, rate-limit tier, and the list of teams under the organization associated with the bearer token. Use to verify key validity from automation scripts and to discover the `team_id` values required by team-scoped writes (e.g. `POST /v1/customers` on multi-team orgs).",
|
|
2371
2418
|
"security": [
|
|
2372
2419
|
{
|
|
2373
2420
|
"bearerAuth": []
|
|
@@ -4120,6 +4167,311 @@
|
|
|
4120
4167
|
}
|
|
4121
4168
|
}
|
|
4122
4169
|
}
|
|
4170
|
+
},
|
|
4171
|
+
"post": {
|
|
4172
|
+
"tags": [
|
|
4173
|
+
"Templates"
|
|
4174
|
+
],
|
|
4175
|
+
"summary": "Create a template",
|
|
4176
|
+
"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`.",
|
|
4177
|
+
"security": [
|
|
4178
|
+
{
|
|
4179
|
+
"bearerAuth": []
|
|
4180
|
+
}
|
|
4181
|
+
],
|
|
4182
|
+
"parameters": [
|
|
4183
|
+
{
|
|
4184
|
+
"schema": {
|
|
4185
|
+
"type": "string",
|
|
4186
|
+
"pattern": "^\\d{6,20}$",
|
|
4187
|
+
"example": "106540352242922",
|
|
4188
|
+
"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)."
|
|
4189
|
+
},
|
|
4190
|
+
"required": true,
|
|
4191
|
+
"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).",
|
|
4192
|
+
"name": "phone_number_id",
|
|
4193
|
+
"in": "path"
|
|
4194
|
+
}
|
|
4195
|
+
],
|
|
4196
|
+
"requestBody": {
|
|
4197
|
+
"content": {
|
|
4198
|
+
"application/json": {
|
|
4199
|
+
"schema": {
|
|
4200
|
+
"type": "object",
|
|
4201
|
+
"properties": {
|
|
4202
|
+
"name": {
|
|
4203
|
+
"type": "string",
|
|
4204
|
+
"minLength": 1,
|
|
4205
|
+
"maxLength": 512,
|
|
4206
|
+
"pattern": "^[a-z0-9_]+$",
|
|
4207
|
+
"example": "order_confirmation"
|
|
4208
|
+
},
|
|
4209
|
+
"category": {
|
|
4210
|
+
"type": "string",
|
|
4211
|
+
"enum": [
|
|
4212
|
+
"MARKETING",
|
|
4213
|
+
"UTILITY",
|
|
4214
|
+
"AUTHENTICATION"
|
|
4215
|
+
],
|
|
4216
|
+
"example": "UTILITY"
|
|
4217
|
+
},
|
|
4218
|
+
"language": {
|
|
4219
|
+
"type": "string",
|
|
4220
|
+
"minLength": 2,
|
|
4221
|
+
"maxLength": 10,
|
|
4222
|
+
"pattern": "^[a-z]{2,3}(_[A-Z]{2})?$",
|
|
4223
|
+
"default": "en",
|
|
4224
|
+
"example": "id"
|
|
4225
|
+
},
|
|
4226
|
+
"components": {
|
|
4227
|
+
"type": "array",
|
|
4228
|
+
"items": {
|
|
4229
|
+
"type": "object",
|
|
4230
|
+
"properties": {
|
|
4231
|
+
"type": {
|
|
4232
|
+
"type": "string",
|
|
4233
|
+
"enum": [
|
|
4234
|
+
"HEADER",
|
|
4235
|
+
"BODY",
|
|
4236
|
+
"FOOTER",
|
|
4237
|
+
"BUTTONS"
|
|
4238
|
+
]
|
|
4239
|
+
},
|
|
4240
|
+
"format": {
|
|
4241
|
+
"type": "string",
|
|
4242
|
+
"enum": [
|
|
4243
|
+
"TEXT",
|
|
4244
|
+
"IMAGE",
|
|
4245
|
+
"VIDEO",
|
|
4246
|
+
"DOCUMENT",
|
|
4247
|
+
"LOCATION"
|
|
4248
|
+
]
|
|
4249
|
+
},
|
|
4250
|
+
"text": {
|
|
4251
|
+
"type": "string"
|
|
4252
|
+
},
|
|
4253
|
+
"example": {
|
|
4254
|
+
"type": "object",
|
|
4255
|
+
"properties": {
|
|
4256
|
+
"header_text": {
|
|
4257
|
+
"type": "array",
|
|
4258
|
+
"items": {
|
|
4259
|
+
"type": "string"
|
|
4260
|
+
}
|
|
4261
|
+
},
|
|
4262
|
+
"header_handle": {
|
|
4263
|
+
"type": "array",
|
|
4264
|
+
"items": {
|
|
4265
|
+
"type": "string"
|
|
4266
|
+
}
|
|
4267
|
+
},
|
|
4268
|
+
"header_url": {
|
|
4269
|
+
"type": "array",
|
|
4270
|
+
"items": {
|
|
4271
|
+
"type": "string",
|
|
4272
|
+
"format": "uri"
|
|
4273
|
+
}
|
|
4274
|
+
},
|
|
4275
|
+
"body_text": {
|
|
4276
|
+
"type": "array",
|
|
4277
|
+
"items": {
|
|
4278
|
+
"type": "array",
|
|
4279
|
+
"items": {
|
|
4280
|
+
"type": "string"
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
},
|
|
4286
|
+
"buttons": {
|
|
4287
|
+
"type": "array",
|
|
4288
|
+
"items": {
|
|
4289
|
+
"type": "object",
|
|
4290
|
+
"properties": {
|
|
4291
|
+
"type": {
|
|
4292
|
+
"type": "string",
|
|
4293
|
+
"enum": [
|
|
4294
|
+
"URL",
|
|
4295
|
+
"PHONE_NUMBER",
|
|
4296
|
+
"QUICK_REPLY",
|
|
4297
|
+
"COPY_CODE",
|
|
4298
|
+
"OTP",
|
|
4299
|
+
"VOICE_CALL"
|
|
4300
|
+
]
|
|
4301
|
+
},
|
|
4302
|
+
"text": {
|
|
4303
|
+
"type": "string",
|
|
4304
|
+
"minLength": 1,
|
|
4305
|
+
"maxLength": 25
|
|
4306
|
+
},
|
|
4307
|
+
"url": {
|
|
4308
|
+
"type": "string",
|
|
4309
|
+
"maxLength": 2000,
|
|
4310
|
+
"format": "uri"
|
|
4311
|
+
},
|
|
4312
|
+
"phone_number": {
|
|
4313
|
+
"type": "string",
|
|
4314
|
+
"pattern": "^\\+[1-9]\\d{7,14}$"
|
|
4315
|
+
},
|
|
4316
|
+
"otp_type": {
|
|
4317
|
+
"type": "string",
|
|
4318
|
+
"enum": [
|
|
4319
|
+
"COPY_CODE",
|
|
4320
|
+
"ONE_TAP",
|
|
4321
|
+
"ZERO_TAP"
|
|
4322
|
+
]
|
|
4323
|
+
},
|
|
4324
|
+
"autofill_text": {
|
|
4325
|
+
"type": "string"
|
|
4326
|
+
},
|
|
4327
|
+
"supported_apps": {
|
|
4328
|
+
"type": "array",
|
|
4329
|
+
"items": {
|
|
4330
|
+
"type": "object",
|
|
4331
|
+
"properties": {
|
|
4332
|
+
"package_name": {
|
|
4333
|
+
"type": "string"
|
|
4334
|
+
},
|
|
4335
|
+
"signature_hash": {
|
|
4336
|
+
"type": "string"
|
|
4337
|
+
}
|
|
4338
|
+
},
|
|
4339
|
+
"required": [
|
|
4340
|
+
"package_name",
|
|
4341
|
+
"signature_hash"
|
|
4342
|
+
]
|
|
4343
|
+
}
|
|
4344
|
+
},
|
|
4345
|
+
"example": {
|
|
4346
|
+
"type": "array",
|
|
4347
|
+
"items": {
|
|
4348
|
+
"type": "string"
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
},
|
|
4352
|
+
"required": [
|
|
4353
|
+
"type"
|
|
4354
|
+
]
|
|
4355
|
+
}
|
|
4356
|
+
},
|
|
4357
|
+
"add_security_recommendation": {
|
|
4358
|
+
"type": "boolean"
|
|
4359
|
+
},
|
|
4360
|
+
"code_expiration_minutes": {
|
|
4361
|
+
"type": "integer",
|
|
4362
|
+
"minimum": 1,
|
|
4363
|
+
"maximum": 60
|
|
4364
|
+
}
|
|
4365
|
+
},
|
|
4366
|
+
"required": [
|
|
4367
|
+
"type"
|
|
4368
|
+
]
|
|
4369
|
+
},
|
|
4370
|
+
"minItems": 1
|
|
4371
|
+
},
|
|
4372
|
+
"variables": {
|
|
4373
|
+
"type": "array",
|
|
4374
|
+
"items": {
|
|
4375
|
+
"type": "string"
|
|
4376
|
+
}
|
|
4377
|
+
},
|
|
4378
|
+
"messageSendTtlSeconds": {
|
|
4379
|
+
"type": "integer",
|
|
4380
|
+
"minimum": 30,
|
|
4381
|
+
"maximum": 2592000
|
|
4382
|
+
}
|
|
4383
|
+
},
|
|
4384
|
+
"required": [
|
|
4385
|
+
"name",
|
|
4386
|
+
"category",
|
|
4387
|
+
"components"
|
|
4388
|
+
]
|
|
4389
|
+
}
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
},
|
|
4393
|
+
"responses": {
|
|
4394
|
+
"200": {
|
|
4395
|
+
"description": "Template created (pending Meta review)",
|
|
4396
|
+
"content": {
|
|
4397
|
+
"application/json": {
|
|
4398
|
+
"schema": {
|
|
4399
|
+
"$ref": "#/components/schemas/CreateTemplateResponse"
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
},
|
|
4404
|
+
"400": {
|
|
4405
|
+
"description": "Validation failure",
|
|
4406
|
+
"content": {
|
|
4407
|
+
"application/json": {
|
|
4408
|
+
"schema": {
|
|
4409
|
+
"$ref": "#/components/schemas/ApiErrorEnvelope"
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
},
|
|
4414
|
+
"401": {
|
|
4415
|
+
"description": "Authentication failure",
|
|
4416
|
+
"content": {
|
|
4417
|
+
"application/json": {
|
|
4418
|
+
"schema": {
|
|
4419
|
+
"$ref": "#/components/schemas/ApiErrorEnvelope"
|
|
4420
|
+
}
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
},
|
|
4424
|
+
"404": {
|
|
4425
|
+
"description": "Resource not found",
|
|
4426
|
+
"content": {
|
|
4427
|
+
"application/json": {
|
|
4428
|
+
"schema": {
|
|
4429
|
+
"$ref": "#/components/schemas/ApiErrorEnvelope"
|
|
4430
|
+
}
|
|
4431
|
+
}
|
|
4432
|
+
}
|
|
4433
|
+
},
|
|
4434
|
+
"422": {
|
|
4435
|
+
"description": "Semantic failure (e.g. idempotency key reuse)",
|
|
4436
|
+
"content": {
|
|
4437
|
+
"application/json": {
|
|
4438
|
+
"schema": {
|
|
4439
|
+
"$ref": "#/components/schemas/ApiErrorEnvelope"
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
}
|
|
4443
|
+
},
|
|
4444
|
+
"429": {
|
|
4445
|
+
"description": "Rate limit exceeded",
|
|
4446
|
+
"content": {
|
|
4447
|
+
"application/json": {
|
|
4448
|
+
"schema": {
|
|
4449
|
+
"$ref": "#/components/schemas/ApiErrorEnvelope"
|
|
4450
|
+
}
|
|
4451
|
+
}
|
|
4452
|
+
}
|
|
4453
|
+
},
|
|
4454
|
+
"500": {
|
|
4455
|
+
"description": "Internal server error",
|
|
4456
|
+
"content": {
|
|
4457
|
+
"application/json": {
|
|
4458
|
+
"schema": {
|
|
4459
|
+
"$ref": "#/components/schemas/ApiErrorEnvelope"
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4462
|
+
}
|
|
4463
|
+
},
|
|
4464
|
+
"502": {
|
|
4465
|
+
"description": "Upstream WhatsApp error",
|
|
4466
|
+
"content": {
|
|
4467
|
+
"application/json": {
|
|
4468
|
+
"schema": {
|
|
4469
|
+
"$ref": "#/components/schemas/ApiErrorEnvelope"
|
|
4470
|
+
}
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4123
4475
|
}
|
|
4124
4476
|
},
|
|
4125
4477
|
"/{phone_number_id}/templates/{name}": {
|