@zavudev/sdk 0.55.0 → 0.57.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 +26 -0
- package/client.d.mts +25 -13
- package/client.d.mts.map +1 -1
- package/client.d.ts +25 -13
- package/client.d.ts.map +1 -1
- package/client.js +15 -3
- package/client.js.map +1 -1
- package/client.mjs +15 -3
- package/client.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/tslib.js +17 -17
- package/internal/utils/query.d.mts +0 -3
- package/internal/utils/query.d.mts.map +1 -1
- package/internal/utils/query.d.ts +0 -3
- package/internal/utils/query.d.ts.map +1 -1
- package/internal/utils/query.js +3 -16
- package/internal/utils/query.js.map +1 -1
- package/internal/utils/query.mjs +2 -16
- package/internal/utils/query.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agent-templates.d.mts +97 -0
- package/resources/agent-templates.d.mts.map +1 -0
- package/resources/agent-templates.d.ts +97 -0
- package/resources/agent-templates.d.ts.map +1 -0
- package/resources/agent-templates.js +39 -0
- package/resources/agent-templates.js.map +1 -0
- package/resources/agent-templates.mjs +35 -0
- package/resources/agent-templates.mjs.map +1 -0
- package/resources/agents/agents.d.mts +462 -0
- package/resources/agents/agents.d.mts.map +1 -0
- package/resources/agents/agents.d.ts +462 -0
- package/resources/agents/agents.d.ts.map +1 -0
- package/resources/agents/agents.js +129 -0
- package/resources/agents/agents.js.map +1 -0
- package/resources/agents/agents.mjs +124 -0
- package/resources/agents/agents.mjs.map +1 -0
- package/resources/agents/index.d.mts +3 -0
- package/resources/agents/index.d.mts.map +1 -0
- package/resources/agents/index.d.ts +3 -0
- package/resources/agents/index.d.ts.map +1 -0
- package/resources/agents/index.js +9 -0
- package/resources/agents/index.js.map +1 -0
- package/resources/agents/index.mjs +4 -0
- package/resources/agents/index.mjs.map +1 -0
- package/resources/agents/senders.d.mts +54 -0
- package/resources/agents/senders.d.mts.map +1 -0
- package/resources/agents/senders.d.ts +54 -0
- package/resources/agents/senders.d.ts.map +1 -0
- package/resources/agents/senders.js +45 -0
- package/resources/agents/senders.js.map +1 -0
- package/resources/agents/senders.mjs +41 -0
- package/resources/agents/senders.mjs.map +1 -0
- package/resources/agents.d.mts +2 -0
- package/resources/agents.d.mts.map +1 -0
- package/resources/agents.d.ts +2 -0
- package/resources/agents.d.ts.map +1 -0
- package/resources/agents.js +6 -0
- package/resources/agents.js.map +1 -0
- package/resources/agents.mjs +3 -0
- package/resources/agents.mjs.map +1 -0
- package/resources/broadcasts/broadcasts.d.mts +16 -9
- package/resources/broadcasts/broadcasts.d.mts.map +1 -1
- package/resources/broadcasts/broadcasts.d.ts +16 -9
- package/resources/broadcasts/broadcasts.d.ts.map +1 -1
- package/resources/broadcasts/broadcasts.js +16 -9
- package/resources/broadcasts/broadcasts.js.map +1 -1
- package/resources/broadcasts/broadcasts.mjs +16 -9
- package/resources/broadcasts/broadcasts.mjs.map +1 -1
- package/resources/calls.d.mts +539 -0
- package/resources/calls.d.mts.map +1 -0
- package/resources/calls.d.ts +539 -0
- package/resources/calls.d.ts.map +1 -0
- package/resources/calls.js +85 -0
- package/resources/calls.js.map +1 -0
- package/resources/calls.mjs +81 -0
- package/resources/calls.mjs.map +1 -0
- package/resources/contacts/contacts.d.mts +32 -13
- package/resources/contacts/contacts.d.mts.map +1 -1
- package/resources/contacts/contacts.d.ts +32 -13
- package/resources/contacts/contacts.d.ts.map +1 -1
- package/resources/contacts/contacts.js +0 -14
- package/resources/contacts/contacts.js.map +1 -1
- package/resources/contacts/contacts.mjs +0 -14
- package/resources/contacts/contacts.mjs.map +1 -1
- package/resources/conversations.d.mts +360 -0
- package/resources/conversations.d.mts.map +1 -0
- package/resources/conversations.d.ts +360 -0
- package/resources/conversations.d.ts.map +1 -0
- package/resources/conversations.js +47 -0
- package/resources/conversations.js.map +1 -0
- package/resources/conversations.mjs +43 -0
- package/resources/conversations.mjs.map +1 -0
- package/resources/email-domains.d.mts +260 -0
- package/resources/email-domains.d.mts.map +1 -0
- package/resources/email-domains.d.ts +260 -0
- package/resources/email-domains.d.ts.map +1 -0
- package/resources/email-domains.js +77 -0
- package/resources/email-domains.js.map +1 -0
- package/resources/email-domains.mjs +73 -0
- package/resources/email-domains.mjs.map +1 -0
- package/resources/functions/functions.d.mts +122 -1
- package/resources/functions/functions.d.mts.map +1 -1
- package/resources/functions/functions.d.ts +122 -1
- package/resources/functions/functions.d.ts.map +1 -1
- package/resources/functions/functions.js +53 -0
- package/resources/functions/functions.js.map +1 -1
- package/resources/functions/functions.mjs +53 -0
- package/resources/functions/functions.mjs.map +1 -1
- package/resources/functions/git-link.d.mts +295 -0
- package/resources/functions/git-link.d.mts.map +1 -0
- package/resources/functions/git-link.d.ts +295 -0
- package/resources/functions/git-link.d.ts.map +1 -0
- package/resources/functions/git-link.js +97 -0
- package/resources/functions/git-link.js.map +1 -0
- package/resources/functions/git-link.mjs +93 -0
- package/resources/functions/git-link.mjs.map +1 -0
- package/resources/functions/index.d.mts +3 -1
- package/resources/functions/index.d.mts.map +1 -1
- package/resources/functions/index.d.ts +3 -1
- package/resources/functions/index.d.ts.map +1 -1
- package/resources/functions/index.js +5 -1
- package/resources/functions/index.js.map +1 -1
- package/resources/functions/index.mjs +2 -0
- package/resources/functions/index.mjs.map +1 -1
- package/resources/functions/triggers.d.mts +164 -0
- package/resources/functions/triggers.d.mts.map +1 -0
- package/resources/functions/triggers.d.ts +164 -0
- package/resources/functions/triggers.d.ts.map +1 -0
- package/resources/functions/triggers.js +74 -0
- package/resources/functions/triggers.js.map +1 -0
- package/resources/functions/triggers.mjs +70 -0
- package/resources/functions/triggers.mjs.map +1 -0
- package/resources/index.d.mts +10 -5
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +10 -5
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +11 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +5 -0
- package/resources/index.mjs.map +1 -1
- package/resources/introspect.d.mts +74 -1
- package/resources/introspect.d.mts.map +1 -1
- package/resources/introspect.d.ts +74 -1
- package/resources/introspect.d.ts.map +1 -1
- package/resources/introspect.js +22 -0
- package/resources/introspect.js.map +1 -1
- package/resources/introspect.mjs +22 -0
- package/resources/introspect.mjs.map +1 -1
- package/resources/messages.d.mts +89 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +89 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +48 -0
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +48 -0
- package/resources/messages.mjs.map +1 -1
- package/resources/number-10dlc/brands.d.mts +10 -5
- package/resources/number-10dlc/brands.d.mts.map +1 -1
- package/resources/number-10dlc/brands.d.ts +10 -5
- package/resources/number-10dlc/brands.d.ts.map +1 -1
- package/resources/number-10dlc/brands.js +10 -5
- package/resources/number-10dlc/brands.js.map +1 -1
- package/resources/number-10dlc/brands.mjs +10 -5
- package/resources/number-10dlc/brands.mjs.map +1 -1
- package/resources/number-10dlc/campaigns/campaigns.d.mts +8 -7
- package/resources/number-10dlc/campaigns/campaigns.d.mts.map +1 -1
- package/resources/number-10dlc/campaigns/campaigns.d.ts +8 -7
- package/resources/number-10dlc/campaigns/campaigns.d.ts.map +1 -1
- package/resources/number-10dlc/campaigns/campaigns.js +8 -7
- package/resources/number-10dlc/campaigns/campaigns.js.map +1 -1
- package/resources/number-10dlc/campaigns/campaigns.mjs +8 -7
- package/resources/number-10dlc/campaigns/campaigns.mjs.map +1 -1
- package/resources/phone-numbers.d.mts +6 -1
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +6 -1
- package/resources/phone-numbers.d.ts.map +1 -1
- package/resources/senders/agent/agent.d.mts +4 -3
- package/resources/senders/agent/agent.d.mts.map +1 -1
- package/resources/senders/agent/agent.d.ts +4 -3
- package/resources/senders/agent/agent.d.ts.map +1 -1
- package/resources/senders/agent/agent.js +2 -2
- package/resources/senders/agent/agent.js.map +1 -1
- package/resources/senders/agent/agent.mjs +2 -2
- package/resources/senders/agent/agent.mjs.map +1 -1
- package/resources/senders/agent/index.d.mts +2 -2
- package/resources/senders/agent/index.d.mts.map +1 -1
- package/resources/senders/agent/index.d.ts +2 -2
- package/resources/senders/agent/index.d.ts.map +1 -1
- package/resources/senders/agent/index.js +2 -2
- package/resources/senders/agent/index.js.map +1 -1
- package/resources/senders/agent/index.mjs +1 -1
- package/resources/senders/agent/index.mjs.map +1 -1
- package/resources/senders/agent/knowledge-bases/documents.d.mts +56 -1
- package/resources/senders/agent/knowledge-bases/documents.d.mts.map +1 -1
- package/resources/senders/agent/knowledge-bases/documents.d.ts +56 -1
- package/resources/senders/agent/knowledge-bases/documents.d.ts.map +1 -1
- package/resources/senders/agent/knowledge-bases/documents.js +33 -0
- package/resources/senders/agent/knowledge-bases/documents.js.map +1 -1
- package/resources/senders/agent/knowledge-bases/documents.mjs +33 -0
- package/resources/senders/agent/knowledge-bases/documents.mjs.map +1 -1
- package/resources/senders/agent/knowledge-bases/index.d.mts +1 -1
- package/resources/senders/agent/knowledge-bases/index.d.mts.map +1 -1
- package/resources/senders/agent/knowledge-bases/index.d.ts +1 -1
- package/resources/senders/agent/knowledge-bases/index.d.ts.map +1 -1
- package/resources/senders/agent/knowledge-bases/index.js.map +1 -1
- package/resources/senders/agent/knowledge-bases/index.mjs.map +1 -1
- package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts +2 -2
- package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts.map +1 -1
- package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts +2 -2
- package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts.map +1 -1
- package/resources/senders/agent/knowledge-bases/knowledge-bases.js.map +1 -1
- package/resources/senders/agent/knowledge-bases/knowledge-bases.mjs.map +1 -1
- package/resources/senders/agent/tools/index.d.mts +3 -0
- package/resources/senders/agent/tools/index.d.mts.map +1 -0
- package/resources/senders/agent/tools/index.d.ts +3 -0
- package/resources/senders/agent/tools/index.d.ts.map +1 -0
- package/resources/senders/agent/tools/index.js +9 -0
- package/resources/senders/agent/tools/index.js.map +1 -0
- package/resources/senders/agent/tools/index.mjs +4 -0
- package/resources/senders/agent/tools/index.mjs.map +1 -0
- package/resources/senders/agent/tools/tools.d.mts +338 -0
- package/resources/senders/agent/tools/tools.d.mts.map +1 -0
- package/resources/senders/agent/tools/tools.d.ts +338 -0
- package/resources/senders/agent/tools/tools.d.ts.map +1 -0
- package/resources/senders/agent/tools/tools.js +163 -0
- package/resources/senders/agent/tools/tools.js.map +1 -0
- package/resources/senders/agent/tools/tools.mjs +158 -0
- package/resources/senders/agent/tools/tools.mjs.map +1 -0
- package/resources/senders/agent/tools/webhook.d.mts +28 -0
- package/resources/senders/agent/tools/webhook.d.mts.map +1 -0
- package/resources/senders/agent/tools/webhook.d.ts +28 -0
- package/resources/senders/agent/tools/webhook.d.ts.map +1 -0
- package/resources/senders/agent/tools/webhook.js +28 -0
- package/resources/senders/agent/tools/webhook.js.map +1 -0
- package/resources/senders/agent/tools/webhook.mjs +24 -0
- package/resources/senders/agent/tools/webhook.mjs.map +1 -0
- package/resources/senders/agent/tools.d.mts +1 -270
- package/resources/senders/agent/tools.d.mts.map +1 -1
- package/resources/senders/agent/tools.d.ts +1 -270
- package/resources/senders/agent/tools.d.ts.map +1 -1
- package/resources/senders/agent/tools.js +2 -131
- package/resources/senders/agent/tools.js.map +1 -1
- package/resources/senders/agent/tools.mjs +1 -129
- package/resources/senders/agent/tools.mjs.map +1 -1
- package/resources/senders/index.d.mts +2 -1
- package/resources/senders/index.d.mts.map +1 -1
- package/resources/senders/index.d.ts +2 -1
- package/resources/senders/index.d.ts.map +1 -1
- package/resources/senders/index.js +3 -1
- package/resources/senders/index.js.map +1 -1
- package/resources/senders/index.mjs +1 -0
- package/resources/senders/index.mjs.map +1 -1
- package/resources/senders/senders.d.mts +4 -0
- package/resources/senders/senders.d.mts.map +1 -1
- package/resources/senders/senders.d.ts +4 -0
- package/resources/senders/senders.d.ts.map +1 -1
- package/resources/senders/senders.js +4 -0
- package/resources/senders/senders.js.map +1 -1
- package/resources/senders/senders.mjs +4 -0
- package/resources/senders/senders.mjs.map +1 -1
- package/resources/senders/telegram.d.mts +48 -0
- package/resources/senders/telegram.d.mts.map +1 -0
- package/resources/senders/telegram.d.ts +48 -0
- package/resources/senders/telegram.d.ts.map +1 -0
- package/resources/senders/telegram.js +41 -0
- package/resources/senders/telegram.js.map +1 -0
- package/resources/senders/telegram.mjs +37 -0
- package/resources/senders/telegram.mjs.map +1 -0
- package/resources/templates.d.mts +66 -1
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +66 -1
- package/resources/templates.d.ts.map +1 -1
- package/resources/templates.js +31 -0
- package/resources/templates.js.map +1 -1
- package/resources/templates.mjs +31 -0
- package/resources/templates.mjs.map +1 -1
- package/resources/urls.d.mts +24 -1
- package/resources/urls.d.mts.map +1 -1
- package/resources/urls.d.ts +24 -1
- package/resources/urls.d.ts.map +1 -1
- package/resources/urls.js +15 -0
- package/resources/urls.js.map +1 -1
- package/resources/urls.mjs +15 -0
- package/resources/urls.mjs.map +1 -1
- package/src/client.ts +129 -3
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/utils/query.ts +2 -18
- package/src/resources/agent-templates.ts +128 -0
- package/src/resources/agents/agents.ts +603 -0
- package/src/resources/agents/index.ts +21 -0
- package/src/resources/agents/senders.ts +79 -0
- package/src/resources/agents.ts +3 -0
- package/src/resources/broadcasts/broadcasts.ts +16 -9
- package/src/resources/calls.ts +647 -0
- package/src/resources/contacts/contacts.ts +35 -20
- package/src/resources/conversations.ts +472 -0
- package/src/resources/email-domains.ts +337 -0
- package/src/resources/functions/functions.ts +202 -0
- package/src/resources/functions/git-link.ts +398 -0
- package/src/resources/functions/index.ts +22 -0
- package/src/resources/functions/triggers.ts +227 -0
- package/src/resources/index.ts +57 -0
- package/src/resources/introspect.ts +105 -0
- package/src/resources/messages.ts +102 -0
- package/src/resources/number-10dlc/brands.ts +10 -5
- package/src/resources/number-10dlc/campaigns/campaigns.ts +8 -7
- package/src/resources/phone-numbers.ts +6 -1
- package/src/resources/senders/agent/agent.ts +23 -17
- package/src/resources/senders/agent/index.ts +4 -1
- package/src/resources/senders/agent/knowledge-bases/documents.ts +89 -0
- package/src/resources/senders/agent/knowledge-bases/index.ts +4 -0
- package/src/resources/senders/agent/knowledge-bases/knowledge-bases.ts +8 -0
- package/src/resources/senders/agent/tools/index.ts +21 -0
- package/src/resources/senders/agent/tools/tools.ts +460 -0
- package/src/resources/senders/agent/tools/webhook.ts +40 -0
- package/src/resources/senders/agent/tools.ts +1 -364
- package/src/resources/senders/index.ts +2 -0
- package/src/resources/senders/senders.ts +10 -0
- package/src/resources/senders/telegram.ts +73 -0
- package/src/resources/templates.ts +80 -0
- package/src/resources/urls.ts +35 -0
- 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
|
@@ -104,21 +104,6 @@ export class Contacts extends APIResource {
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
/**
|
|
108
|
-
* Dismiss the merge suggestion for a contact.
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* ```ts
|
|
112
|
-
* await client.contacts.dismissMergeSuggestion('contactId');
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
dismissMergeSuggestion(contactID: string, options?: RequestOptions): APIPromise<void> {
|
|
116
|
-
return this._client.delete(path`/v1/contacts/${contactID}/merge-suggestion`, {
|
|
117
|
-
...options,
|
|
118
|
-
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
107
|
/**
|
|
123
108
|
* Merge a source contact into this contact. All channels from the source contact
|
|
124
109
|
* will be moved to the target contact, and the source contact will be marked as
|
|
@@ -206,11 +191,6 @@ export interface Contact {
|
|
|
206
191
|
*/
|
|
207
192
|
profileName?: string | null;
|
|
208
193
|
|
|
209
|
-
/**
|
|
210
|
-
* ID of a contact suggested for merging.
|
|
211
|
-
*/
|
|
212
|
-
suggestedMergeWith?: string;
|
|
213
|
-
|
|
214
194
|
updatedAt?: string;
|
|
215
195
|
}
|
|
216
196
|
|
|
@@ -339,11 +319,46 @@ export interface ContactUpdateParams {
|
|
|
339
319
|
*/
|
|
340
320
|
defaultChannel?: 'sms' | 'whatsapp' | 'telegram' | 'email' | 'instagram' | 'messenger' | 'voice' | null;
|
|
341
321
|
|
|
322
|
+
/**
|
|
323
|
+
* Human-readable name for this contact. Set to null to clear it and fall back to
|
|
324
|
+
* the contact's identifier. Contacts created automatically from an inbound message
|
|
325
|
+
* have no display name until you set one.
|
|
326
|
+
*/
|
|
327
|
+
displayName?: string | null;
|
|
328
|
+
|
|
342
329
|
metadata?: { [key: string]: string };
|
|
343
330
|
}
|
|
344
331
|
|
|
345
332
|
export interface ContactListParams extends CursorParams {
|
|
333
|
+
/**
|
|
334
|
+
* Exact match on the contact's primary phone number, in E.164.
|
|
335
|
+
*/
|
|
346
336
|
phoneNumber?: string;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Free-text match over the contact's name (`displayName` and the WhatsApp profile
|
|
340
|
+
* name), phone numbers and email addresses. Case- and accent-insensitive. A phone
|
|
341
|
+
* number matches on a trailing fragment too, so `5551234` finds `+14155551234`.
|
|
342
|
+
*
|
|
343
|
+
* Contacts created automatically from an inbound message have no `displayName` —
|
|
344
|
+
* they are matched by their identifier until you set one with
|
|
345
|
+
* `PATCH /v1/contacts/{contactId}`.
|
|
346
|
+
*
|
|
347
|
+
* Results come back in relevance order rather than newest-first. `cursor` is
|
|
348
|
+
* opaque in both modes; pass back exactly what the previous response returned, and
|
|
349
|
+
* start a new pagination run when the search term changes.
|
|
350
|
+
*/
|
|
351
|
+
search?: string;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Tag name. Repeatable: `?tag=vip&tag=chile` returns contacts carrying **every**
|
|
355
|
+
* tag given, not any of them — the same rule the dashboard filter applies.
|
|
356
|
+
*
|
|
357
|
+
* Tags are matched by name, case-insensitively. An unknown tag returns 400 rather
|
|
358
|
+
* than being ignored, because a typo that silently matched every contact would be
|
|
359
|
+
* a worse answer than an error.
|
|
360
|
+
*/
|
|
361
|
+
tag?: Array<string>;
|
|
347
362
|
}
|
|
348
363
|
|
|
349
364
|
export interface ContactMergeParams {
|
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import * as MessagesAPI from './messages';
|
|
5
|
+
import { MessagesCursor } from './messages';
|
|
6
|
+
import { APIPromise } from '../core/api-promise';
|
|
7
|
+
import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
|
|
8
|
+
import { RequestOptions } from '../internal/request-options';
|
|
9
|
+
import { path } from '../internal/utils/path';
|
|
10
|
+
|
|
11
|
+
export class Conversations extends APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Get conversation
|
|
14
|
+
*/
|
|
15
|
+
retrieve(conversationID: string, options?: RequestOptions): APIPromise<ConversationRetrieveResponse> {
|
|
16
|
+
return this._client.get(path`/v1/conversations/${conversationID}`, options);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* List inbox threads, most recently active first. A conversation groups every
|
|
21
|
+
* message with one contact across channels, which is what you need to build an
|
|
22
|
+
* inbox: `GET /v1/messages` returns a flat log with no thread to hang it on.
|
|
23
|
+
*
|
|
24
|
+
* Use `senderId` to scope the list to a single number, and `channel` to keep only
|
|
25
|
+
* threads that have carried that channel.
|
|
26
|
+
*/
|
|
27
|
+
list(
|
|
28
|
+
query: ConversationListParams | null | undefined = {},
|
|
29
|
+
options?: RequestOptions,
|
|
30
|
+
): PagePromise<ConversationListResponsesCursor, ConversationListResponse> {
|
|
31
|
+
return this._client.getAPIList('/v1/conversations', Cursor<ConversationListResponse>, {
|
|
32
|
+
query,
|
|
33
|
+
...options,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Messages in this thread, newest first, across every channel it has carried.
|
|
39
|
+
* Reply with `POST /v1/messages`, passing the conversation's `senderId` as the
|
|
40
|
+
* `Zavu-Sender` header so the answer leaves from the number the contact already
|
|
41
|
+
* knows.
|
|
42
|
+
*/
|
|
43
|
+
listMessages(
|
|
44
|
+
conversationID: string,
|
|
45
|
+
query: ConversationListMessagesParams | null | undefined = {},
|
|
46
|
+
options?: RequestOptions,
|
|
47
|
+
): PagePromise<MessagesCursor, MessagesAPI.Message> {
|
|
48
|
+
return this._client.getAPIList(
|
|
49
|
+
path`/v1/conversations/${conversationID}/messages`,
|
|
50
|
+
Cursor<MessagesAPI.Message>,
|
|
51
|
+
{ query, ...options },
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Reset the thread's `unreadCount` to zero. Marks the thread read in your own
|
|
57
|
+
* inbox only: it does not send a read receipt to the contact.
|
|
58
|
+
*/
|
|
59
|
+
markAsRead(conversationID: string, options?: RequestOptions): APIPromise<ConversationMarkAsReadResponse> {
|
|
60
|
+
return this._client.post(path`/v1/conversations/${conversationID}/read`, options);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type ConversationListResponsesCursor = Cursor<ConversationListResponse>;
|
|
65
|
+
|
|
66
|
+
export interface ConversationRetrieveResponse {
|
|
67
|
+
/**
|
|
68
|
+
* An inbox thread with one contact. A conversation groups every message exchanged
|
|
69
|
+
* with that contact across channels, so a contact who writes on WhatsApp and later
|
|
70
|
+
* by email stays in one thread.
|
|
71
|
+
*/
|
|
72
|
+
conversation: ConversationRetrieveResponse.Conversation;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export namespace ConversationRetrieveResponse {
|
|
76
|
+
/**
|
|
77
|
+
* An inbox thread with one contact. A conversation groups every message exchanged
|
|
78
|
+
* with that contact across channels, so a contact who writes on WhatsApp and later
|
|
79
|
+
* by email stays in one thread.
|
|
80
|
+
*/
|
|
81
|
+
export interface Conversation {
|
|
82
|
+
id: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Every channel this thread has carried messages on.
|
|
86
|
+
*/
|
|
87
|
+
channels: Array<string>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The key this thread is filed under: a phone number in E.164, a WhatsApp
|
|
91
|
+
* business-scoped user ID (BSUID), a numeric chat ID
|
|
92
|
+
* (Telegram/Instagram/Messenger), or a group JID. It is not always a phone number,
|
|
93
|
+
* so do not parse it as one.
|
|
94
|
+
*/
|
|
95
|
+
contactIdentifier: string;
|
|
96
|
+
|
|
97
|
+
createdAt: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Denormalized preview of the most recent message, so a thread list needs no extra
|
|
101
|
+
* fetch.
|
|
102
|
+
*/
|
|
103
|
+
lastMessage: Conversation.LastMessage;
|
|
104
|
+
|
|
105
|
+
messageCount: number;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Inbound messages not yet marked read. Reset with POST
|
|
109
|
+
* /v1/conversations/{conversationId}/read.
|
|
110
|
+
*/
|
|
111
|
+
unreadCount: number;
|
|
112
|
+
|
|
113
|
+
updatedAt: string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* ID of the contact this thread belongs to. Absent on group threads and on threads
|
|
117
|
+
* whose contact has not been resolved yet.
|
|
118
|
+
*/
|
|
119
|
+
contactId?: string;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Email address of the thread, when the contact was reached by email.
|
|
123
|
+
*/
|
|
124
|
+
email?: string;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Present when the thread is a group chat rather than a one-to-one conversation.
|
|
128
|
+
*/
|
|
129
|
+
group?: Conversation.Group;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Sender that last handled this thread. Use it as the `Zavu-Sender` header when
|
|
133
|
+
* replying so the answer leaves from the same number the contact knows.
|
|
134
|
+
*/
|
|
135
|
+
senderId?: string;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* WhatsApp identity, present when the contact adopted a username.
|
|
139
|
+
*/
|
|
140
|
+
whatsapp?: Conversation.Whatsapp;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export namespace Conversation {
|
|
144
|
+
/**
|
|
145
|
+
* Denormalized preview of the most recent message, so a thread list needs no extra
|
|
146
|
+
* fetch.
|
|
147
|
+
*/
|
|
148
|
+
export interface LastMessage {
|
|
149
|
+
id: string;
|
|
150
|
+
|
|
151
|
+
at: string;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Delivery channel. Use 'auto' for intelligent routing.
|
|
155
|
+
*/
|
|
156
|
+
channel: MessagesAPI.Channel;
|
|
157
|
+
|
|
158
|
+
direction: 'inbound' | 'outbound';
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Text or caption. Empty when the last message carried no text (e.g. media).
|
|
162
|
+
*/
|
|
163
|
+
text: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Present when the thread is a group chat rather than a one-to-one conversation.
|
|
168
|
+
*/
|
|
169
|
+
export interface Group {
|
|
170
|
+
id: string;
|
|
171
|
+
|
|
172
|
+
participantCount?: number;
|
|
173
|
+
|
|
174
|
+
subject?: string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* WhatsApp identity, present when the contact adopted a username.
|
|
179
|
+
*/
|
|
180
|
+
export interface Whatsapp {
|
|
181
|
+
/**
|
|
182
|
+
* Business-scoped user ID. Can be used as `to` when sending.
|
|
183
|
+
*/
|
|
184
|
+
bsuid?: string;
|
|
185
|
+
|
|
186
|
+
username?: string;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* An inbox thread with one contact. A conversation groups every message exchanged
|
|
193
|
+
* with that contact across channels, so a contact who writes on WhatsApp and later
|
|
194
|
+
* by email stays in one thread.
|
|
195
|
+
*/
|
|
196
|
+
export interface ConversationListResponse {
|
|
197
|
+
id: string;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Every channel this thread has carried messages on.
|
|
201
|
+
*/
|
|
202
|
+
channels: Array<string>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The key this thread is filed under: a phone number in E.164, a WhatsApp
|
|
206
|
+
* business-scoped user ID (BSUID), a numeric chat ID
|
|
207
|
+
* (Telegram/Instagram/Messenger), or a group JID. It is not always a phone number,
|
|
208
|
+
* so do not parse it as one.
|
|
209
|
+
*/
|
|
210
|
+
contactIdentifier: string;
|
|
211
|
+
|
|
212
|
+
createdAt: string;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Denormalized preview of the most recent message, so a thread list needs no extra
|
|
216
|
+
* fetch.
|
|
217
|
+
*/
|
|
218
|
+
lastMessage: ConversationListResponse.LastMessage;
|
|
219
|
+
|
|
220
|
+
messageCount: number;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Inbound messages not yet marked read. Reset with POST
|
|
224
|
+
* /v1/conversations/{conversationId}/read.
|
|
225
|
+
*/
|
|
226
|
+
unreadCount: number;
|
|
227
|
+
|
|
228
|
+
updatedAt: string;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* ID of the contact this thread belongs to. Absent on group threads and on threads
|
|
232
|
+
* whose contact has not been resolved yet.
|
|
233
|
+
*/
|
|
234
|
+
contactId?: string;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Email address of the thread, when the contact was reached by email.
|
|
238
|
+
*/
|
|
239
|
+
email?: string;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Present when the thread is a group chat rather than a one-to-one conversation.
|
|
243
|
+
*/
|
|
244
|
+
group?: ConversationListResponse.Group;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Sender that last handled this thread. Use it as the `Zavu-Sender` header when
|
|
248
|
+
* replying so the answer leaves from the same number the contact knows.
|
|
249
|
+
*/
|
|
250
|
+
senderId?: string;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* WhatsApp identity, present when the contact adopted a username.
|
|
254
|
+
*/
|
|
255
|
+
whatsapp?: ConversationListResponse.Whatsapp;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export namespace ConversationListResponse {
|
|
259
|
+
/**
|
|
260
|
+
* Denormalized preview of the most recent message, so a thread list needs no extra
|
|
261
|
+
* fetch.
|
|
262
|
+
*/
|
|
263
|
+
export interface LastMessage {
|
|
264
|
+
id: string;
|
|
265
|
+
|
|
266
|
+
at: string;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Delivery channel. Use 'auto' for intelligent routing.
|
|
270
|
+
*/
|
|
271
|
+
channel: MessagesAPI.Channel;
|
|
272
|
+
|
|
273
|
+
direction: 'inbound' | 'outbound';
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Text or caption. Empty when the last message carried no text (e.g. media).
|
|
277
|
+
*/
|
|
278
|
+
text: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Present when the thread is a group chat rather than a one-to-one conversation.
|
|
283
|
+
*/
|
|
284
|
+
export interface Group {
|
|
285
|
+
id: string;
|
|
286
|
+
|
|
287
|
+
participantCount?: number;
|
|
288
|
+
|
|
289
|
+
subject?: string;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* WhatsApp identity, present when the contact adopted a username.
|
|
294
|
+
*/
|
|
295
|
+
export interface Whatsapp {
|
|
296
|
+
/**
|
|
297
|
+
* Business-scoped user ID. Can be used as `to` when sending.
|
|
298
|
+
*/
|
|
299
|
+
bsuid?: string;
|
|
300
|
+
|
|
301
|
+
username?: string;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface ConversationMarkAsReadResponse {
|
|
306
|
+
/**
|
|
307
|
+
* An inbox thread with one contact. A conversation groups every message exchanged
|
|
308
|
+
* with that contact across channels, so a contact who writes on WhatsApp and later
|
|
309
|
+
* by email stays in one thread.
|
|
310
|
+
*/
|
|
311
|
+
conversation: ConversationMarkAsReadResponse.Conversation;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export namespace ConversationMarkAsReadResponse {
|
|
315
|
+
/**
|
|
316
|
+
* An inbox thread with one contact. A conversation groups every message exchanged
|
|
317
|
+
* with that contact across channels, so a contact who writes on WhatsApp and later
|
|
318
|
+
* by email stays in one thread.
|
|
319
|
+
*/
|
|
320
|
+
export interface Conversation {
|
|
321
|
+
id: string;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Every channel this thread has carried messages on.
|
|
325
|
+
*/
|
|
326
|
+
channels: Array<string>;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The key this thread is filed under: a phone number in E.164, a WhatsApp
|
|
330
|
+
* business-scoped user ID (BSUID), a numeric chat ID
|
|
331
|
+
* (Telegram/Instagram/Messenger), or a group JID. It is not always a phone number,
|
|
332
|
+
* so do not parse it as one.
|
|
333
|
+
*/
|
|
334
|
+
contactIdentifier: string;
|
|
335
|
+
|
|
336
|
+
createdAt: string;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Denormalized preview of the most recent message, so a thread list needs no extra
|
|
340
|
+
* fetch.
|
|
341
|
+
*/
|
|
342
|
+
lastMessage: Conversation.LastMessage;
|
|
343
|
+
|
|
344
|
+
messageCount: number;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Inbound messages not yet marked read. Reset with POST
|
|
348
|
+
* /v1/conversations/{conversationId}/read.
|
|
349
|
+
*/
|
|
350
|
+
unreadCount: number;
|
|
351
|
+
|
|
352
|
+
updatedAt: string;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* ID of the contact this thread belongs to. Absent on group threads and on threads
|
|
356
|
+
* whose contact has not been resolved yet.
|
|
357
|
+
*/
|
|
358
|
+
contactId?: string;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Email address of the thread, when the contact was reached by email.
|
|
362
|
+
*/
|
|
363
|
+
email?: string;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Present when the thread is a group chat rather than a one-to-one conversation.
|
|
367
|
+
*/
|
|
368
|
+
group?: Conversation.Group;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Sender that last handled this thread. Use it as the `Zavu-Sender` header when
|
|
372
|
+
* replying so the answer leaves from the same number the contact knows.
|
|
373
|
+
*/
|
|
374
|
+
senderId?: string;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* WhatsApp identity, present when the contact adopted a username.
|
|
378
|
+
*/
|
|
379
|
+
whatsapp?: Conversation.Whatsapp;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export namespace Conversation {
|
|
383
|
+
/**
|
|
384
|
+
* Denormalized preview of the most recent message, so a thread list needs no extra
|
|
385
|
+
* fetch.
|
|
386
|
+
*/
|
|
387
|
+
export interface LastMessage {
|
|
388
|
+
id: string;
|
|
389
|
+
|
|
390
|
+
at: string;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Delivery channel. Use 'auto' for intelligent routing.
|
|
394
|
+
*/
|
|
395
|
+
channel: MessagesAPI.Channel;
|
|
396
|
+
|
|
397
|
+
direction: 'inbound' | 'outbound';
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Text or caption. Empty when the last message carried no text (e.g. media).
|
|
401
|
+
*/
|
|
402
|
+
text: string;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Present when the thread is a group chat rather than a one-to-one conversation.
|
|
407
|
+
*/
|
|
408
|
+
export interface Group {
|
|
409
|
+
id: string;
|
|
410
|
+
|
|
411
|
+
participantCount?: number;
|
|
412
|
+
|
|
413
|
+
subject?: string;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* WhatsApp identity, present when the contact adopted a username.
|
|
418
|
+
*/
|
|
419
|
+
export interface Whatsapp {
|
|
420
|
+
/**
|
|
421
|
+
* Business-scoped user ID. Can be used as `to` when sending.
|
|
422
|
+
*/
|
|
423
|
+
bsuid?: string;
|
|
424
|
+
|
|
425
|
+
username?: string;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export interface ConversationListParams extends CursorParams {
|
|
431
|
+
/**
|
|
432
|
+
* Keep only threads that have carried this channel.
|
|
433
|
+
*/
|
|
434
|
+
channel?: 'sms' | 'sms_oneway' | 'whatsapp' | 'email' | 'telegram' | 'instagram' | 'messenger' | 'voice';
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Search threads by identity: phone number (any format — `+1 (555) 123-4567` and
|
|
438
|
+
* `15551234567` both match), email address (full or local part), WhatsApp group
|
|
439
|
+
* subject, WhatsApp username, or BSUID. Matching is by whole word, with prefix
|
|
440
|
+
* matching on the last term, so `mar` finds `maria@example.com` and `+1555` finds
|
|
441
|
+
* `+15551234567`; a fragment from the middle or end of a number (`4567`) does not
|
|
442
|
+
* match.
|
|
443
|
+
*
|
|
444
|
+
* It does **not** search message bodies — only who the thread is with.
|
|
445
|
+
*
|
|
446
|
+
* Results come back ranked by relevance rather than by recency, so the usual "most
|
|
447
|
+
* recently active first" ordering does not apply while `q` is set. `senderId` and
|
|
448
|
+
* `channel` still narrow the results, and `cursor` paginates them as usual. An
|
|
449
|
+
* empty or whitespace-only `q` returns no items rather than the full list.
|
|
450
|
+
*/
|
|
451
|
+
search?: string;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Keep only threads last handled by this sender.
|
|
455
|
+
*/
|
|
456
|
+
senderId?: string;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
export interface ConversationListMessagesParams extends CursorParams {}
|
|
460
|
+
|
|
461
|
+
export declare namespace Conversations {
|
|
462
|
+
export {
|
|
463
|
+
type ConversationRetrieveResponse as ConversationRetrieveResponse,
|
|
464
|
+
type ConversationListResponse as ConversationListResponse,
|
|
465
|
+
type ConversationMarkAsReadResponse as ConversationMarkAsReadResponse,
|
|
466
|
+
type ConversationListResponsesCursor as ConversationListResponsesCursor,
|
|
467
|
+
type ConversationListParams as ConversationListParams,
|
|
468
|
+
type ConversationListMessagesParams as ConversationListMessagesParams,
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export { type MessagesCursor };
|