@zavudev/sdk 0.50.0 → 0.52.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/CHANGELOG.md +30 -0
- package/package.json +1 -1
- package/resources/functions/functions.d.mts +22 -8
- package/resources/functions/functions.d.mts.map +1 -1
- package/resources/functions/functions.d.ts +22 -8
- package/resources/functions/functions.d.ts.map +1 -1
- package/resources/functions/functions.js +6 -4
- package/resources/functions/functions.js.map +1 -1
- package/resources/functions/functions.mjs +6 -4
- package/resources/functions/functions.mjs.map +1 -1
- package/resources/invitations.d.mts +84 -23
- package/resources/invitations.d.mts.map +1 -1
- package/resources/invitations.d.ts +84 -23
- package/resources/invitations.d.ts.map +1 -1
- package/resources/invitations.js +13 -10
- package/resources/invitations.js.map +1 -1
- package/resources/invitations.mjs +13 -10
- package/resources/invitations.mjs.map +1 -1
- package/resources/messages.d.mts +66 -20
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +66 -20
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +23 -3
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +23 -3
- package/resources/messages.mjs.map +1 -1
- package/resources/number-10dlc/brands.d.mts +5 -1
- package/resources/number-10dlc/brands.d.mts.map +1 -1
- package/resources/number-10dlc/brands.d.ts +5 -1
- package/resources/number-10dlc/brands.d.ts.map +1 -1
- package/resources/number-10dlc/brands.js +5 -1
- package/resources/number-10dlc/brands.js.map +1 -1
- package/resources/number-10dlc/brands.mjs +5 -1
- package/resources/number-10dlc/brands.mjs.map +1 -1
- package/resources/number-10dlc/campaigns/campaigns.d.mts +6 -1
- package/resources/number-10dlc/campaigns/campaigns.d.mts.map +1 -1
- package/resources/number-10dlc/campaigns/campaigns.d.ts +6 -1
- package/resources/number-10dlc/campaigns/campaigns.d.ts.map +1 -1
- package/resources/number-10dlc/campaigns/campaigns.js +6 -1
- package/resources/number-10dlc/campaigns/campaigns.js.map +1 -1
- package/resources/number-10dlc/campaigns/campaigns.mjs +6 -1
- package/resources/number-10dlc/campaigns/campaigns.mjs.map +1 -1
- package/resources/phone-numbers.d.mts +5 -0
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +5 -0
- package/resources/phone-numbers.d.ts.map +1 -1
- package/resources/senders/agent/agent.d.mts +307 -0
- package/resources/senders/agent/agent.d.mts.map +1 -1
- package/resources/senders/agent/agent.d.ts +307 -0
- package/resources/senders/agent/agent.d.ts.map +1 -1
- package/resources/senders/agent/agent.js +6 -0
- package/resources/senders/agent/agent.js.map +1 -1
- package/resources/senders/agent/agent.mjs +6 -0
- package/resources/senders/agent/agent.mjs.map +1 -1
- package/resources/senders/agent/executions.d.mts +5 -0
- package/resources/senders/agent/executions.d.mts.map +1 -1
- package/resources/senders/agent/executions.d.ts +5 -0
- package/resources/senders/agent/executions.d.ts.map +1 -1
- package/resources/senders/agent/executions.js +5 -0
- package/resources/senders/agent/executions.js.map +1 -1
- package/resources/senders/agent/executions.mjs +5 -0
- package/resources/senders/agent/executions.mjs.map +1 -1
- package/resources/senders/senders.d.mts +71 -21
- package/resources/senders/senders.d.mts.map +1 -1
- package/resources/senders/senders.d.ts +71 -21
- package/resources/senders/senders.d.ts.map +1 -1
- package/resources/senders/senders.js.map +1 -1
- package/resources/senders/senders.mjs.map +1 -1
- package/resources/templates.d.mts +12 -3
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +12 -3
- package/resources/templates.d.ts.map +1 -1
- package/src/resources/functions/functions.ts +23 -8
- package/src/resources/invitations.ts +90 -23
- package/src/resources/messages.ts +67 -19
- package/src/resources/number-10dlc/brands.ts +5 -1
- package/src/resources/number-10dlc/campaigns/campaigns.ts +6 -1
- package/src/resources/phone-numbers.ts +6 -0
- package/src/resources/senders/agent/agent.ts +357 -0
- package/src/resources/senders/agent/executions.ts +5 -0
- package/src/resources/senders/senders.ts +78 -21
- package/src/resources/templates.ts +13 -4
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -4,18 +4,21 @@ import { Cursor, type CursorParams, PagePromise } from "../core/pagination.js";
|
|
|
4
4
|
import { RequestOptions } from "../internal/request-options.js";
|
|
5
5
|
export declare class Invitations extends APIResource {
|
|
6
6
|
/**
|
|
7
|
-
* Create a partner invitation link for a client to connect
|
|
8
|
-
* opens the returned `url` and
|
|
9
|
-
*
|
|
7
|
+
* Create a partner invitation link for a client to connect a Meta channel. The
|
|
8
|
+
* client opens the returned `url` and authorizes with Meta; the resulting sender
|
|
9
|
+
* is created in your project when they finish, and the invitation transitions to
|
|
10
|
+
* `completed`.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
* linking an official WhatsApp Business Account.
|
|
13
|
-
* - `whatsapp_alt`: the client links their number by scanning a QR code. Requires
|
|
14
|
-
* the WhatsApp Alternative feature to be enabled for your team (otherwise
|
|
15
|
-
* returns 400).
|
|
12
|
+
* `connectionType` picks the channel:
|
|
16
13
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* - `whatsapp_waba` (default): Meta's embedded signup links an official WhatsApp
|
|
15
|
+
* Business Account.
|
|
16
|
+
* - `messenger`: the client picks a Facebook Page they administer; its Messenger
|
|
17
|
+
* inbox (including Marketplace chats) is routed to Zavu.
|
|
18
|
+
*
|
|
19
|
+
* One invitation connects one channel — create one per channel to onboard a client
|
|
20
|
+
* on several. `phoneNumberId` and `allowedPhoneCountries` apply to `whatsapp_waba`
|
|
21
|
+
* only.
|
|
19
22
|
*
|
|
20
23
|
* @example
|
|
21
24
|
* ```ts
|
|
@@ -72,8 +75,13 @@ export interface Invitation {
|
|
|
72
75
|
expiresAt: string;
|
|
73
76
|
/**
|
|
74
77
|
* Current status of the partner invitation.
|
|
78
|
+
*
|
|
79
|
+
* `failed` means the client started the connection and it did not finish (they
|
|
80
|
+
* cancelled Meta's dialog, denied a permission, or abandoned the tab). A failed
|
|
81
|
+
* invitation is still usable: the same link can be retried, and it moves back to
|
|
82
|
+
* `in_progress` when the client tries again.
|
|
75
83
|
*/
|
|
76
|
-
status: 'pending' | 'in_progress' | 'completed' | 'expired' | 'cancelled';
|
|
84
|
+
status: 'pending' | 'in_progress' | 'completed' | 'expired' | 'cancelled' | 'failed';
|
|
77
85
|
updatedAt: string;
|
|
78
86
|
/**
|
|
79
87
|
* Full URL to share with the client.
|
|
@@ -84,12 +92,29 @@ export interface Invitation {
|
|
|
84
92
|
clientPhone?: string | null;
|
|
85
93
|
completedAt?: string | null;
|
|
86
94
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
95
|
+
* The account the client linked, populated once the invitation is `completed`.
|
|
96
|
+
* Null before that. Use it to show the partner what was connected without fetching
|
|
97
|
+
* the sender.
|
|
98
|
+
*/
|
|
99
|
+
connectedAccount?: Invitation.ConnectedAccount | null;
|
|
100
|
+
/**
|
|
101
|
+
* Which Meta channel the client connects: `whatsapp_waba` (official WhatsApp Cloud
|
|
102
|
+
* API via embedded signup) or `messenger` (a Facebook Page's Messenger inbox,
|
|
103
|
+
* including Marketplace chats).
|
|
104
|
+
*/
|
|
105
|
+
connectionType?: 'whatsapp_waba' | 'messenger';
|
|
106
|
+
failedAt?: string | null;
|
|
107
|
+
/**
|
|
108
|
+
* Stable code for why the last attempt failed, present when `status` is `failed`.
|
|
109
|
+
* Values include `fb_cancelled` (client closed Meta's dialog), `fb_not_authorized`
|
|
110
|
+
* (permission denied), `signup_abandoned` (started but never finished),
|
|
111
|
+
* `meta_no_pages` (the client administers no Facebook Page), and `internal_error`.
|
|
112
|
+
* Treat unknown codes as a generic failure.
|
|
89
113
|
*/
|
|
90
|
-
|
|
114
|
+
failureReason?: string | null;
|
|
91
115
|
/**
|
|
92
|
-
* ID of a pre-assigned Zavu phone number for WhatsApp registration.
|
|
116
|
+
* ID of a pre-assigned Zavu phone number for WhatsApp registration. Always null
|
|
117
|
+
* for `messenger` invitations.
|
|
93
118
|
*/
|
|
94
119
|
phoneNumberId?: string | null;
|
|
95
120
|
/**
|
|
@@ -99,6 +124,25 @@ export interface Invitation {
|
|
|
99
124
|
startedAt?: string | null;
|
|
100
125
|
viewedAt?: string | null;
|
|
101
126
|
}
|
|
127
|
+
export declare namespace Invitation {
|
|
128
|
+
/**
|
|
129
|
+
* The account the client linked, populated once the invitation is `completed`.
|
|
130
|
+
* Null before that. Use it to show the partner what was connected without fetching
|
|
131
|
+
* the sender.
|
|
132
|
+
*/
|
|
133
|
+
interface ConnectedAccount {
|
|
134
|
+
/**
|
|
135
|
+
* Provider-side identifier: the WhatsApp phone number ID, or the Facebook Page ID.
|
|
136
|
+
*/
|
|
137
|
+
id: string;
|
|
138
|
+
channel: 'whatsapp' | 'messenger';
|
|
139
|
+
/**
|
|
140
|
+
* Display name of the connected account: the WhatsApp verified name, or the
|
|
141
|
+
* Facebook Page name.
|
|
142
|
+
*/
|
|
143
|
+
name?: string | null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
102
146
|
export interface InvitationCreateResponse {
|
|
103
147
|
invitation: Invitation;
|
|
104
148
|
}
|
|
@@ -110,7 +154,8 @@ export interface InvitationCancelResponse {
|
|
|
110
154
|
}
|
|
111
155
|
export interface InvitationCreateParams {
|
|
112
156
|
/**
|
|
113
|
-
* ISO country codes for allowed phone numbers.
|
|
157
|
+
* ISO country codes for allowed phone numbers. Only valid when `connectionType` is
|
|
158
|
+
* `whatsapp_waba` — sending it with `messenger` returns 400.
|
|
114
159
|
*/
|
|
115
160
|
allowedPhoneCountries?: Array<string>;
|
|
116
161
|
/**
|
|
@@ -126,27 +171,43 @@ export interface InvitationCreateParams {
|
|
|
126
171
|
*/
|
|
127
172
|
clientPhone?: string;
|
|
128
173
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
174
|
+
* Which Meta channel the client connects, and how.
|
|
175
|
+
*
|
|
176
|
+
* - `whatsapp_waba` (default): Meta's embedded signup links an official WhatsApp
|
|
177
|
+
* Business Account. Accepts `phoneNumberId` and `allowedPhoneCountries`.
|
|
178
|
+
* - `messenger`: the client authorizes with Facebook and picks a Facebook Page
|
|
179
|
+
* they administer. The Page's Messenger inbox — including Marketplace chats — is
|
|
180
|
+
* routed to Zavu. They must be an admin of at least one Page. A Page can only be
|
|
181
|
+
* connected to one Zavu project at a time: if the client picks a Page that
|
|
182
|
+
* another project already connected, the newer connection wins and the older one
|
|
183
|
+
* is disconnected.
|
|
184
|
+
*
|
|
185
|
+
* One invitation connects one channel. To onboard a client on several channels,
|
|
186
|
+
* create one invitation per channel; each completes into its own sender.
|
|
133
187
|
*/
|
|
134
|
-
connectionType?: 'whatsapp_waba' | '
|
|
188
|
+
connectionType?: 'whatsapp_waba' | 'messenger';
|
|
135
189
|
/**
|
|
136
190
|
* Number of days until the invitation expires.
|
|
137
191
|
*/
|
|
138
192
|
expiresInDays?: number;
|
|
139
193
|
/**
|
|
140
194
|
* ID of a Zavu phone number to pre-assign for WhatsApp registration. If provided,
|
|
141
|
-
* the client will use this number instead of their own.
|
|
195
|
+
* the client will use this number instead of their own. Only valid when
|
|
196
|
+
* `connectionType` is `whatsapp_waba` — sending it with `messenger` returns 400,
|
|
197
|
+
* since a Facebook Page has no phone number.
|
|
142
198
|
*/
|
|
143
199
|
phoneNumberId?: string;
|
|
144
200
|
}
|
|
145
201
|
export interface InvitationListParams extends CursorParams {
|
|
146
202
|
/**
|
|
147
203
|
* Current status of the partner invitation.
|
|
204
|
+
*
|
|
205
|
+
* `failed` means the client started the connection and it did not finish (they
|
|
206
|
+
* cancelled Meta's dialog, denied a permission, or abandoned the tab). A failed
|
|
207
|
+
* invitation is still usable: the same link can be retried, and it moves back to
|
|
208
|
+
* `in_progress` when the client tries again.
|
|
148
209
|
*/
|
|
149
|
-
status?: 'pending' | 'in_progress' | 'completed' | 'expired' | 'cancelled';
|
|
210
|
+
status?: 'pending' | 'in_progress' | 'completed' | 'expired' | 'cancelled' | 'failed';
|
|
150
211
|
}
|
|
151
212
|
export declare namespace Invitations {
|
|
152
213
|
export { type Invitation as Invitation, type InvitationCreateResponse as InvitationCreateResponse, type InvitationRetrieveResponse as InvitationRetrieveResponse, type InvitationCancelResponse as InvitationCancelResponse, type InvitationsCursor as InvitationsCursor, type InvitationCreateParams as InvitationCreateParams, type InvitationListParams as InvitationListParams, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../src/resources/invitations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,8BAA2B;AAC5E,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D,qBAAa,WAAY,SAAQ,WAAW;IAC1C
|
|
1
|
+
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../src/resources/invitations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,8BAA2B;AAC5E,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CACJ,IAAI,GAAE,sBAAsB,GAAG,IAAI,GAAG,SAAc,EACpD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;IAIvC;;;;;;;;;OASG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAIhG;;;;;;;;;;OAUG;IACH,IAAI,CACF,KAAK,GAAE,oBAAoB,GAAG,IAAI,GAAG,SAAc,EACnD,OAAO,CAA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AAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
|
package/resources/invitations.js
CHANGED
|
@@ -7,18 +7,21 @@ const pagination_1 = require("../core/pagination.js");
|
|
|
7
7
|
const path_1 = require("../internal/utils/path.js");
|
|
8
8
|
class Invitations extends resource_1.APIResource {
|
|
9
9
|
/**
|
|
10
|
-
* Create a partner invitation link for a client to connect
|
|
11
|
-
* opens the returned `url` and
|
|
12
|
-
*
|
|
10
|
+
* Create a partner invitation link for a client to connect a Meta channel. The
|
|
11
|
+
* client opens the returned `url` and authorizes with Meta; the resulting sender
|
|
12
|
+
* is created in your project when they finish, and the invitation transitions to
|
|
13
|
+
* `completed`.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
* linking an official WhatsApp Business Account.
|
|
16
|
-
* - `whatsapp_alt`: the client links their number by scanning a QR code. Requires
|
|
17
|
-
* the WhatsApp Alternative feature to be enabled for your team (otherwise
|
|
18
|
-
* returns 400).
|
|
15
|
+
* `connectionType` picks the channel:
|
|
19
16
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* - `whatsapp_waba` (default): Meta's embedded signup links an official WhatsApp
|
|
18
|
+
* Business Account.
|
|
19
|
+
* - `messenger`: the client picks a Facebook Page they administer; its Messenger
|
|
20
|
+
* inbox (including Marketplace chats) is routed to Zavu.
|
|
21
|
+
*
|
|
22
|
+
* One invitation connects one channel — create one per channel to onboard a client
|
|
23
|
+
* on several. `phoneNumberId` and `allowedPhoneCountries` apply to `whatsapp_waba`
|
|
24
|
+
* only.
|
|
22
25
|
*
|
|
23
26
|
* @example
|
|
24
27
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations.js","sourceRoot":"","sources":["../src/resources/invitations.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAA4E;AAE5E,oDAA8C;AAE9C,MAAa,WAAY,SAAQ,sBAAW;IAC1C
|
|
1
|
+
{"version":3,"file":"invitations.js","sourceRoot":"","sources":["../src/resources/invitations.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAA4E;AAE5E,oDAA8C;AAE9C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CACJ,OAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,YAAoB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,mBAAmB,YAAY,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAAiD,EAAE,EACnD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAA,mBAAkB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,YAAoB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,mBAAmB,YAAY,SAAS,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;CACF;AA9ED,kCA8EC"}
|
|
@@ -4,18 +4,21 @@ import { Cursor } from "../core/pagination.mjs";
|
|
|
4
4
|
import { path } from "../internal/utils/path.mjs";
|
|
5
5
|
export class Invitations extends APIResource {
|
|
6
6
|
/**
|
|
7
|
-
* Create a partner invitation link for a client to connect
|
|
8
|
-
* opens the returned `url` and
|
|
9
|
-
*
|
|
7
|
+
* Create a partner invitation link for a client to connect a Meta channel. The
|
|
8
|
+
* client opens the returned `url` and authorizes with Meta; the resulting sender
|
|
9
|
+
* is created in your project when they finish, and the invitation transitions to
|
|
10
|
+
* `completed`.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
* linking an official WhatsApp Business Account.
|
|
13
|
-
* - `whatsapp_alt`: the client links their number by scanning a QR code. Requires
|
|
14
|
-
* the WhatsApp Alternative feature to be enabled for your team (otherwise
|
|
15
|
-
* returns 400).
|
|
12
|
+
* `connectionType` picks the channel:
|
|
16
13
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* - `whatsapp_waba` (default): Meta's embedded signup links an official WhatsApp
|
|
15
|
+
* Business Account.
|
|
16
|
+
* - `messenger`: the client picks a Facebook Page they administer; its Messenger
|
|
17
|
+
* inbox (including Marketplace chats) is routed to Zavu.
|
|
18
|
+
*
|
|
19
|
+
* One invitation connects one channel — create one per channel to onboard a client
|
|
20
|
+
* on several. `phoneNumberId` and `allowedPhoneCountries` apply to `whatsapp_waba`
|
|
21
|
+
* only.
|
|
19
22
|
*
|
|
20
23
|
* @example
|
|
21
24
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations.mjs","sourceRoot":"","sources":["../src/resources/invitations.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAE/C,OAAO,EAAE,MAAM,EAAkC,+BAA2B;AAE5E,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C
|
|
1
|
+
{"version":3,"file":"invitations.mjs","sourceRoot":"","sources":["../src/resources/invitations.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAE/C,OAAO,EAAE,MAAM,EAAkC,+BAA2B;AAE5E,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CACJ,OAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,YAAoB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,mBAAmB,YAAY,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAAiD,EAAE,EACnD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAA,MAAkB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,YAAoB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,mBAAmB,YAAY,SAAS,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;CACF"}
|
package/resources/messages.d.mts
CHANGED
|
@@ -53,10 +53,30 @@ export declare class Messages extends APIResource {
|
|
|
53
53
|
* - Window opens when the user messages you first
|
|
54
54
|
* - Use template messages to initiate conversations outside the window
|
|
55
55
|
*
|
|
56
|
-
* **
|
|
56
|
+
* **Plan allowances and email billing:**
|
|
57
57
|
*
|
|
58
|
-
* -
|
|
59
|
-
*
|
|
58
|
+
* - WhatsApp, Telegram, Instagram and Messenger share an allowance of 2,000
|
|
59
|
+
* messages per month on Free. Over it, sends return 429 with code
|
|
60
|
+
* `a2p_limit_exceeded` and upgrade details; the counter resets on the 1st of
|
|
61
|
+
* each month. Paid plans have no message caps
|
|
62
|
+
* - Email is billed from your prepaid balance in 1,000-message blocks: $0.40 per
|
|
63
|
+
* 1,000 transactional emails, $0.80 per 1,000 marketing (broadcast) emails. A
|
|
64
|
+
* block is charged when your monthly count crosses each 1,000 boundary, and at
|
|
65
|
+
* zero balance email sends return 402 with code `insufficient_balance`. Free
|
|
66
|
+
* teams start with $2 of credit and additionally cap at 3,000 emails/month and
|
|
67
|
+
* 100/day. Teams on earlier plans keep their original email quotas instead
|
|
68
|
+
* - SMS and voice are billed per message from your balance on every plan
|
|
69
|
+
*
|
|
70
|
+
* **Email recipient pre-flight:** Email messages are validated automatically
|
|
71
|
+
* before dispatch. Sends that would be a guaranteed hard bounce are failed instead
|
|
72
|
+
* of sent, protecting your bounce rate: the message transitions to `failed`
|
|
73
|
+
* (visible via `GET /v1/messages/{messageId}` and the `message.failed` webhook)
|
|
74
|
+
* with `errorCode` set to `EMAIL_INVALID_RECIPIENT` (malformed address),
|
|
75
|
+
* `EMAIL_DOMAIN_NOT_FOUND` (recipient domain has no MX or A records), or
|
|
76
|
+
* `EMAIL_RECIPIENT_SUPPRESSED` (address is on your suppression list after a
|
|
77
|
+
* previous bounce or complaint). Advisory signals (role addresses, disposable
|
|
78
|
+
* domains) do not block sends — check them beforehand with
|
|
79
|
+
* `POST /v1/introspect/email`.
|
|
60
80
|
*
|
|
61
81
|
* @example
|
|
62
82
|
* ```ts
|
|
@@ -85,25 +105,33 @@ export declare class Messages extends APIResource {
|
|
|
85
105
|
}
|
|
86
106
|
export type MessagesCursor = Cursor<Message>;
|
|
87
107
|
/**
|
|
88
|
-
* Delivery channel. Use 'auto' for intelligent routing.
|
|
89
|
-
* QR-linked WhatsApp channel and is only accepted for teams with the WhatsApp
|
|
90
|
-
* Alternative feature enabled; the sender must have a connected whatsapp_alt
|
|
91
|
-
* session.
|
|
108
|
+
* Delivery channel. Use 'auto' for intelligent routing.
|
|
92
109
|
*/
|
|
93
|
-
export type Channel = 'auto' | 'sms' | 'sms_oneway' | 'whatsapp' | '
|
|
110
|
+
export type Channel = 'auto' | 'sms' | 'sms_oneway' | 'whatsapp' | 'telegram' | 'email' | 'instagram' | 'messenger' | 'voice';
|
|
94
111
|
export interface Message {
|
|
95
112
|
id: string;
|
|
96
113
|
/**
|
|
97
|
-
* Delivery channel. Use 'auto' for intelligent routing.
|
|
98
|
-
* QR-linked WhatsApp channel and is only accepted for teams with the WhatsApp
|
|
99
|
-
* Alternative feature enabled; the sender must have a connected whatsapp_alt
|
|
100
|
-
* session.
|
|
114
|
+
* Delivery channel. Use 'auto' for intelligent routing.
|
|
101
115
|
*/
|
|
102
116
|
channel: Channel;
|
|
103
117
|
createdAt: string;
|
|
104
118
|
/**
|
|
105
119
|
* Type of message. Non-text types are supported by WhatsApp and Telegram (varies
|
|
106
120
|
* by type).
|
|
121
|
+
*
|
|
122
|
+
* `location_request` asks the recipient to share their location and is
|
|
123
|
+
* WhatsApp-only. It takes no `content` object — the prompt goes in `text` (max
|
|
124
|
+
* 1024 characters) and the button label is fixed by WhatsApp. The recipient's
|
|
125
|
+
* answer arrives as an inbound `location` message whose `content.replyToMessageId`
|
|
126
|
+
* is the ID of the request.
|
|
127
|
+
*
|
|
128
|
+
* `request_contact_info` asks the recipient to share their phone number and is
|
|
129
|
+
* WhatsApp-only. Like `location_request` it takes no `content` object — the prompt
|
|
130
|
+
* goes in `text` (max 1024 characters) and WhatsApp renders a fixed **Share
|
|
131
|
+
* Contact Info** button. The answer arrives as an inbound `contact` message. Use
|
|
132
|
+
* it to recover the phone number of a contact who adopted a WhatsApp username and
|
|
133
|
+
* is only known by their business-scoped user ID (BSUID); when they share it, Zavu
|
|
134
|
+
* automatically links the phone number to that contact.
|
|
107
135
|
*/
|
|
108
136
|
messageType: MessageType;
|
|
109
137
|
status: MessageStatus;
|
|
@@ -112,6 +140,13 @@ export interface Message {
|
|
|
112
140
|
* Content for non-text message types (WhatsApp and Telegram).
|
|
113
141
|
*/
|
|
114
142
|
content?: MessageContent;
|
|
143
|
+
/**
|
|
144
|
+
* ID of the conversation (inbox thread) this message belongs to. Use it to build a
|
|
145
|
+
* direct dashboard link:
|
|
146
|
+
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`. Omitted only
|
|
147
|
+
* on legacy messages created before conversation threading.
|
|
148
|
+
*/
|
|
149
|
+
conversationId?: string;
|
|
115
150
|
/**
|
|
116
151
|
* Zavu platform charge in USD for this message. Messaging is billed against your
|
|
117
152
|
* plan's monthly limits plus usage-based overage.
|
|
@@ -325,8 +360,22 @@ export type MessageStatus = 'queued' | 'sending' | 'sent' | 'delivered' | 'read'
|
|
|
325
360
|
/**
|
|
326
361
|
* Type of message. Non-text types are supported by WhatsApp and Telegram (varies
|
|
327
362
|
* by type).
|
|
363
|
+
*
|
|
364
|
+
* `location_request` asks the recipient to share their location and is
|
|
365
|
+
* WhatsApp-only. It takes no `content` object — the prompt goes in `text` (max
|
|
366
|
+
* 1024 characters) and the button label is fixed by WhatsApp. The recipient's
|
|
367
|
+
* answer arrives as an inbound `location` message whose `content.replyToMessageId`
|
|
368
|
+
* is the ID of the request.
|
|
369
|
+
*
|
|
370
|
+
* `request_contact_info` asks the recipient to share their phone number and is
|
|
371
|
+
* WhatsApp-only. Like `location_request` it takes no `content` object — the prompt
|
|
372
|
+
* goes in `text` (max 1024 characters) and WhatsApp renders a fixed **Share
|
|
373
|
+
* Contact Info** button. The answer arrives as an inbound `contact` message. Use
|
|
374
|
+
* it to recover the phone number of a contact who adopted a WhatsApp username and
|
|
375
|
+
* is only known by their business-scoped user ID (BSUID); when they share it, Zavu
|
|
376
|
+
* automatically links the phone number to that contact.
|
|
328
377
|
*/
|
|
329
|
-
export type MessageType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'location' | 'contact' | 'buttons' | 'list' | 'cta_url' | 'reaction' | 'template';
|
|
378
|
+
export type MessageType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'location' | 'contact' | 'buttons' | 'list' | 'cta_url' | 'request_contact_info' | 'location_request' | 'reaction' | 'template';
|
|
330
379
|
export interface MessageShowTypingResponse {
|
|
331
380
|
success: boolean;
|
|
332
381
|
}
|
|
@@ -355,13 +404,10 @@ export interface MessageReactParams {
|
|
|
355
404
|
export interface MessageSendParams {
|
|
356
405
|
/**
|
|
357
406
|
* Body param: Recipient phone number in E.164 format, email address, WhatsApp
|
|
358
|
-
* business-scoped user ID (BSUID, e.g. `US.13491208655302741918`),
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
* phone number is hidden. A group JID is only valid on the `whatsapp_alt` channel
|
|
363
|
-
* and supports text and media (image, video, audio, document, sticker, location,
|
|
364
|
-
* contact).
|
|
407
|
+
* business-scoped user ID (BSUID, e.g. `US.13491208655302741918`), or numeric chat
|
|
408
|
+
* ID (for Telegram/Instagram/Messenger). A BSUID is routed to WhatsApp and sent
|
|
409
|
+
* via the `recipient` field; use it to message a contact who adopted a username
|
|
410
|
+
* and whose phone number is hidden.
|
|
365
411
|
*/
|
|
366
412
|
to: string;
|
|
367
413
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.mts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,+BAA2B;AAE5E,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAG7D,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;OASG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,eAAe,CAAC;IAIlF;;;;;;;;;;OAUG;IACH,IAAI,CACF,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,cA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AAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,yBAAiB,iBAAiB,CAAC;IACjC;;OAEG;IACH,UAAiB,UAAU;QACzB;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;;WAGG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;CACF;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
|
package/resources/messages.d.ts
CHANGED
|
@@ -53,10 +53,30 @@ export declare class Messages extends APIResource {
|
|
|
53
53
|
* - Window opens when the user messages you first
|
|
54
54
|
* - Use template messages to initiate conversations outside the window
|
|
55
55
|
*
|
|
56
|
-
* **
|
|
56
|
+
* **Plan allowances and email billing:**
|
|
57
57
|
*
|
|
58
|
-
* -
|
|
59
|
-
*
|
|
58
|
+
* - WhatsApp, Telegram, Instagram and Messenger share an allowance of 2,000
|
|
59
|
+
* messages per month on Free. Over it, sends return 429 with code
|
|
60
|
+
* `a2p_limit_exceeded` and upgrade details; the counter resets on the 1st of
|
|
61
|
+
* each month. Paid plans have no message caps
|
|
62
|
+
* - Email is billed from your prepaid balance in 1,000-message blocks: $0.40 per
|
|
63
|
+
* 1,000 transactional emails, $0.80 per 1,000 marketing (broadcast) emails. A
|
|
64
|
+
* block is charged when your monthly count crosses each 1,000 boundary, and at
|
|
65
|
+
* zero balance email sends return 402 with code `insufficient_balance`. Free
|
|
66
|
+
* teams start with $2 of credit and additionally cap at 3,000 emails/month and
|
|
67
|
+
* 100/day. Teams on earlier plans keep their original email quotas instead
|
|
68
|
+
* - SMS and voice are billed per message from your balance on every plan
|
|
69
|
+
*
|
|
70
|
+
* **Email recipient pre-flight:** Email messages are validated automatically
|
|
71
|
+
* before dispatch. Sends that would be a guaranteed hard bounce are failed instead
|
|
72
|
+
* of sent, protecting your bounce rate: the message transitions to `failed`
|
|
73
|
+
* (visible via `GET /v1/messages/{messageId}` and the `message.failed` webhook)
|
|
74
|
+
* with `errorCode` set to `EMAIL_INVALID_RECIPIENT` (malformed address),
|
|
75
|
+
* `EMAIL_DOMAIN_NOT_FOUND` (recipient domain has no MX or A records), or
|
|
76
|
+
* `EMAIL_RECIPIENT_SUPPRESSED` (address is on your suppression list after a
|
|
77
|
+
* previous bounce or complaint). Advisory signals (role addresses, disposable
|
|
78
|
+
* domains) do not block sends — check them beforehand with
|
|
79
|
+
* `POST /v1/introspect/email`.
|
|
60
80
|
*
|
|
61
81
|
* @example
|
|
62
82
|
* ```ts
|
|
@@ -85,25 +105,33 @@ export declare class Messages extends APIResource {
|
|
|
85
105
|
}
|
|
86
106
|
export type MessagesCursor = Cursor<Message>;
|
|
87
107
|
/**
|
|
88
|
-
* Delivery channel. Use 'auto' for intelligent routing.
|
|
89
|
-
* QR-linked WhatsApp channel and is only accepted for teams with the WhatsApp
|
|
90
|
-
* Alternative feature enabled; the sender must have a connected whatsapp_alt
|
|
91
|
-
* session.
|
|
108
|
+
* Delivery channel. Use 'auto' for intelligent routing.
|
|
92
109
|
*/
|
|
93
|
-
export type Channel = 'auto' | 'sms' | 'sms_oneway' | 'whatsapp' | '
|
|
110
|
+
export type Channel = 'auto' | 'sms' | 'sms_oneway' | 'whatsapp' | 'telegram' | 'email' | 'instagram' | 'messenger' | 'voice';
|
|
94
111
|
export interface Message {
|
|
95
112
|
id: string;
|
|
96
113
|
/**
|
|
97
|
-
* Delivery channel. Use 'auto' for intelligent routing.
|
|
98
|
-
* QR-linked WhatsApp channel and is only accepted for teams with the WhatsApp
|
|
99
|
-
* Alternative feature enabled; the sender must have a connected whatsapp_alt
|
|
100
|
-
* session.
|
|
114
|
+
* Delivery channel. Use 'auto' for intelligent routing.
|
|
101
115
|
*/
|
|
102
116
|
channel: Channel;
|
|
103
117
|
createdAt: string;
|
|
104
118
|
/**
|
|
105
119
|
* Type of message. Non-text types are supported by WhatsApp and Telegram (varies
|
|
106
120
|
* by type).
|
|
121
|
+
*
|
|
122
|
+
* `location_request` asks the recipient to share their location and is
|
|
123
|
+
* WhatsApp-only. It takes no `content` object — the prompt goes in `text` (max
|
|
124
|
+
* 1024 characters) and the button label is fixed by WhatsApp. The recipient's
|
|
125
|
+
* answer arrives as an inbound `location` message whose `content.replyToMessageId`
|
|
126
|
+
* is the ID of the request.
|
|
127
|
+
*
|
|
128
|
+
* `request_contact_info` asks the recipient to share their phone number and is
|
|
129
|
+
* WhatsApp-only. Like `location_request` it takes no `content` object — the prompt
|
|
130
|
+
* goes in `text` (max 1024 characters) and WhatsApp renders a fixed **Share
|
|
131
|
+
* Contact Info** button. The answer arrives as an inbound `contact` message. Use
|
|
132
|
+
* it to recover the phone number of a contact who adopted a WhatsApp username and
|
|
133
|
+
* is only known by their business-scoped user ID (BSUID); when they share it, Zavu
|
|
134
|
+
* automatically links the phone number to that contact.
|
|
107
135
|
*/
|
|
108
136
|
messageType: MessageType;
|
|
109
137
|
status: MessageStatus;
|
|
@@ -112,6 +140,13 @@ export interface Message {
|
|
|
112
140
|
* Content for non-text message types (WhatsApp and Telegram).
|
|
113
141
|
*/
|
|
114
142
|
content?: MessageContent;
|
|
143
|
+
/**
|
|
144
|
+
* ID of the conversation (inbox thread) this message belongs to. Use it to build a
|
|
145
|
+
* direct dashboard link:
|
|
146
|
+
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`. Omitted only
|
|
147
|
+
* on legacy messages created before conversation threading.
|
|
148
|
+
*/
|
|
149
|
+
conversationId?: string;
|
|
115
150
|
/**
|
|
116
151
|
* Zavu platform charge in USD for this message. Messaging is billed against your
|
|
117
152
|
* plan's monthly limits plus usage-based overage.
|
|
@@ -325,8 +360,22 @@ export type MessageStatus = 'queued' | 'sending' | 'sent' | 'delivered' | 'read'
|
|
|
325
360
|
/**
|
|
326
361
|
* Type of message. Non-text types are supported by WhatsApp and Telegram (varies
|
|
327
362
|
* by type).
|
|
363
|
+
*
|
|
364
|
+
* `location_request` asks the recipient to share their location and is
|
|
365
|
+
* WhatsApp-only. It takes no `content` object — the prompt goes in `text` (max
|
|
366
|
+
* 1024 characters) and the button label is fixed by WhatsApp. The recipient's
|
|
367
|
+
* answer arrives as an inbound `location` message whose `content.replyToMessageId`
|
|
368
|
+
* is the ID of the request.
|
|
369
|
+
*
|
|
370
|
+
* `request_contact_info` asks the recipient to share their phone number and is
|
|
371
|
+
* WhatsApp-only. Like `location_request` it takes no `content` object — the prompt
|
|
372
|
+
* goes in `text` (max 1024 characters) and WhatsApp renders a fixed **Share
|
|
373
|
+
* Contact Info** button. The answer arrives as an inbound `contact` message. Use
|
|
374
|
+
* it to recover the phone number of a contact who adopted a WhatsApp username and
|
|
375
|
+
* is only known by their business-scoped user ID (BSUID); when they share it, Zavu
|
|
376
|
+
* automatically links the phone number to that contact.
|
|
328
377
|
*/
|
|
329
|
-
export type MessageType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'location' | 'contact' | 'buttons' | 'list' | 'cta_url' | 'reaction' | 'template';
|
|
378
|
+
export type MessageType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'location' | 'contact' | 'buttons' | 'list' | 'cta_url' | 'request_contact_info' | 'location_request' | 'reaction' | 'template';
|
|
330
379
|
export interface MessageShowTypingResponse {
|
|
331
380
|
success: boolean;
|
|
332
381
|
}
|
|
@@ -355,13 +404,10 @@ export interface MessageReactParams {
|
|
|
355
404
|
export interface MessageSendParams {
|
|
356
405
|
/**
|
|
357
406
|
* Body param: Recipient phone number in E.164 format, email address, WhatsApp
|
|
358
|
-
* business-scoped user ID (BSUID, e.g. `US.13491208655302741918`),
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
* phone number is hidden. A group JID is only valid on the `whatsapp_alt` channel
|
|
363
|
-
* and supports text and media (image, video, audio, document, sticker, location,
|
|
364
|
-
* contact).
|
|
407
|
+
* business-scoped user ID (BSUID, e.g. `US.13491208655302741918`), or numeric chat
|
|
408
|
+
* ID (for Telegram/Instagram/Messenger). A BSUID is routed to WhatsApp and sent
|
|
409
|
+
* via the `recipient` field; use it to message a contact who adopted a username
|
|
410
|
+
* and whose phone number is hidden.
|
|
365
411
|
*/
|
|
366
412
|
to: string;
|
|
367
413
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,8BAA2B;AAE5E,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D,qBAAa,QAAS,S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KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
|
package/resources/messages.js
CHANGED
|
@@ -71,10 +71,30 @@ class Messages extends resource_1.APIResource {
|
|
|
71
71
|
* - Window opens when the user messages you first
|
|
72
72
|
* - Use template messages to initiate conversations outside the window
|
|
73
73
|
*
|
|
74
|
-
* **
|
|
74
|
+
* **Plan allowances and email billing:**
|
|
75
75
|
*
|
|
76
|
-
* -
|
|
77
|
-
*
|
|
76
|
+
* - WhatsApp, Telegram, Instagram and Messenger share an allowance of 2,000
|
|
77
|
+
* messages per month on Free. Over it, sends return 429 with code
|
|
78
|
+
* `a2p_limit_exceeded` and upgrade details; the counter resets on the 1st of
|
|
79
|
+
* each month. Paid plans have no message caps
|
|
80
|
+
* - Email is billed from your prepaid balance in 1,000-message blocks: $0.40 per
|
|
81
|
+
* 1,000 transactional emails, $0.80 per 1,000 marketing (broadcast) emails. A
|
|
82
|
+
* block is charged when your monthly count crosses each 1,000 boundary, and at
|
|
83
|
+
* zero balance email sends return 402 with code `insufficient_balance`. Free
|
|
84
|
+
* teams start with $2 of credit and additionally cap at 3,000 emails/month and
|
|
85
|
+
* 100/day. Teams on earlier plans keep their original email quotas instead
|
|
86
|
+
* - SMS and voice are billed per message from your balance on every plan
|
|
87
|
+
*
|
|
88
|
+
* **Email recipient pre-flight:** Email messages are validated automatically
|
|
89
|
+
* before dispatch. Sends that would be a guaranteed hard bounce are failed instead
|
|
90
|
+
* of sent, protecting your bounce rate: the message transitions to `failed`
|
|
91
|
+
* (visible via `GET /v1/messages/{messageId}` and the `message.failed` webhook)
|
|
92
|
+
* with `errorCode` set to `EMAIL_INVALID_RECIPIENT` (malformed address),
|
|
93
|
+
* `EMAIL_DOMAIN_NOT_FOUND` (recipient domain has no MX or A records), or
|
|
94
|
+
* `EMAIL_RECIPIENT_SUPPRESSED` (address is on your suppression list after a
|
|
95
|
+
* previous bounce or complaint). Advisory signals (role addresses, disposable
|
|
96
|
+
* domains) do not block sends — check them beforehand with
|
|
97
|
+
* `POST /v1/introspect/email`.
|
|
78
98
|
*
|
|
79
99
|
* @example
|
|
80
100
|
* ```ts
|