@zavudev/sdk 0.59.0 → 0.60.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 +24 -0
- package/package.json +1 -1
- package/src/types.ts +114 -23
- package/src/v2/types.ts +105 -21
- package/src/version.ts +1 -1
- package/types.d.mts +112 -24
- package/types.d.mts.map +1 -1
- package/types.d.ts +112 -24
- package/types.d.ts.map +1 -1
- package/v2/types.d.mts +103 -22
- package/v2/types.d.mts.map +1 -1
- package/v2/types.d.ts +103 -22
- package/v2/types.d.ts.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.60.0 (unreleased)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **v2/contacts:** `Contact.whatsapp` (`ContactWhatsapp`: `bsuid`, `username`),
|
|
8
|
+
regenerated from the spec, which already returned it.
|
|
9
|
+
|
|
10
|
+
### Documentation
|
|
11
|
+
|
|
12
|
+
* **10dlc:** `TenDlcBrandCreateRequest.ein` is required to submit every entity
|
|
13
|
+
type except `SOLE_PROPRIETOR`, and a sole proprietor's `phone` must be a
|
|
14
|
+
mobile number. The `submit` `400` names the missing EIN.
|
|
15
|
+
* **webhooks:** `message.inbound` and `contact.identity_linked` descriptions
|
|
16
|
+
regenerated from the spec (BSUID, `contactId`, `conversationId`).
|
|
17
|
+
|
|
18
|
+
## 0.59.1 (unreleased)
|
|
19
|
+
|
|
20
|
+
### Documentation
|
|
21
|
+
|
|
22
|
+
* **messages:** `MessageContent.replyToMessageId` documents quoting when
|
|
23
|
+
sending: on WhatsApp and Telegram, a send quotes an earlier message of the
|
|
24
|
+
same conversation and sender, and is refused with `400` when it cannot. The
|
|
25
|
+
other `replyTo*` fields are read-only. Same text in `@zavudev/sdk/v2`.
|
|
26
|
+
|
|
3
27
|
## 0.59.0 (unreleased)
|
|
4
28
|
|
|
5
29
|
### Features
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -440,25 +440,42 @@ export interface MessageContent {
|
|
|
440
440
|
/** Message ID to react to. */
|
|
441
441
|
reactToMessageId?: string;
|
|
442
442
|
/**
|
|
443
|
-
* Zavu message ID of the quoted message this message replies to.
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
443
|
+
* Zavu message ID of the quoted message this message replies to.
|
|
444
|
+
*
|
|
445
|
+
* **When sending:** set it to make the message a quoted reply to an earlier
|
|
446
|
+
* message in the same conversation, such as the `data.messageId` of a
|
|
447
|
+
* `message.inbound` webhook. Supported on WhatsApp (every message type except
|
|
448
|
+
* `reaction`) and Telegram. The quoted message must belong to this project
|
|
449
|
+
* (otherwise `404`), must have gone out on the same channel as this send, must
|
|
450
|
+
* belong to the conversation `to` addresses, must have been sent or received by
|
|
451
|
+
* the sender this message goes out from (pass it in `Zavu-Sender`), and must have
|
|
452
|
+
* a `providerMessageId`. A failed message and a Telegram button tap cannot be
|
|
453
|
+
* quoted. Any other case returns `400` instead of sending the message unquoted.
|
|
454
|
+
* The stored message then carries the rest of the `replyTo*` fields.
|
|
455
|
+
*
|
|
456
|
+
* **When receiving:** present on inbound messages that quote an earlier message.
|
|
457
|
+
* Omitted when the quoted message is not found in Zavu (e.g. an old or unknown
|
|
458
|
+
* message) — use replyToProviderMessageId in that case.
|
|
447
459
|
*/
|
|
448
460
|
replyToMessageId?: string;
|
|
449
461
|
/**
|
|
450
|
-
* Provider message ID (WhatsApp WAMID) of the quoted
|
|
451
|
-
* inbound message is a reply, even if the
|
|
462
|
+
* Provider message ID (WhatsApp WAMID, or Telegram message ID) of the quoted
|
|
463
|
+
* message. Present whenever an inbound WhatsApp message is a reply, even if the
|
|
464
|
+
* quoted message is not stored in Zavu, and on outbound quoted replies. Read-only:
|
|
465
|
+
* to quote when sending, set replyToMessageId.
|
|
452
466
|
*/
|
|
453
467
|
replyToProviderMessageId?: string;
|
|
454
|
-
/**
|
|
468
|
+
/**
|
|
469
|
+
* Sender of the quoted message (phone number in E.164 format, or the Telegram chat
|
|
470
|
+
* ID). Read-only.
|
|
471
|
+
*/
|
|
455
472
|
replyToFrom?: string;
|
|
456
473
|
/**
|
|
457
|
-
* Truncated snippet of the quoted message's text, for
|
|
458
|
-
* quoted message has no text (e.g. media).
|
|
474
|
+
* Truncated snippet (up to 200 characters) of the quoted message's text, for
|
|
475
|
+
* display. Empty when the quoted message has no text (e.g. media). Read-only.
|
|
459
476
|
*/
|
|
460
477
|
replyToText?: string;
|
|
461
|
-
/** Type of the quoted message (text, image, video, etc.). */
|
|
478
|
+
/** Type of the quoted message (text, image, video, etc.). Read-only. */
|
|
462
479
|
replyToMessageType?: string;
|
|
463
480
|
/** Template ID for template messages. */
|
|
464
481
|
templateId?: string;
|
|
@@ -909,11 +926,16 @@ export type TemplateCreateRequestButtonsItemOtpType = 'COPY_CODE' | 'ONE_TAP';
|
|
|
909
926
|
* **Inbound events:**
|
|
910
927
|
* - `message.inbound`: New message received from a contact. `data.conversationId`,
|
|
911
928
|
* the inbox thread id (deep-link with
|
|
912
|
-
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`), is
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
*
|
|
916
|
-
* a
|
|
929
|
+
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`), is always
|
|
930
|
+
* set: the webhook is sent once the message has been filed in its thread, so the
|
|
931
|
+
* first message of a new thread carries the same id as `conversation.new`.
|
|
932
|
+
* `data.contactId` is the Zavu contact, and unlike `data.from` it does not
|
|
933
|
+
* change when a WhatsApp contact's identifier switches from a business-scoped
|
|
934
|
+
* user ID (BSUID) to a phone number, unless the switch reveals two contacts for
|
|
935
|
+
* one person; they are then merged and `contact.identity_linked` names the one
|
|
936
|
+
* that went away in `mergedContactId`. On WhatsApp, `data.whatsapp` carries the
|
|
937
|
+
* contact's `bsuid` and `username` when known. Reactions carry none of these
|
|
938
|
+
* three. Reactions are delivered as `message.inbound` with
|
|
917
939
|
* `messageType='reaction'`. When the contact replied to (quoted) an earlier
|
|
918
940
|
* message, `data.content` carries the reply context: `replyToMessageId`,
|
|
919
941
|
* `replyToProviderMessageId`, `replyToFrom`, `replyToText`, and
|
|
@@ -939,6 +961,21 @@ export type TemplateCreateRequestButtonsItemOtpType = 'COPY_CODE' | 'ONE_TAP';
|
|
|
939
961
|
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`), the
|
|
940
962
|
* `phoneNumber` or `email` key, `channel`, `firstMessageId`, `firstMessageText`,
|
|
941
963
|
* and `profileName`.
|
|
964
|
+
* - `contact.identity_linked`: A WhatsApp contact known by BSUID was tied to a
|
|
965
|
+
* phone number, a contact known by phone received a BSUID, or a contact changed
|
|
966
|
+
* their number. `data` carries `contactId`, `bsuid`, `phoneNumber` and `reason`:
|
|
967
|
+
* `provider_reported` (WhatsApp sent the phone and the BSUID together on an
|
|
968
|
+
* inbound message), `contact_shared` (the contact shared their phone number in
|
|
969
|
+
* reply to a `request_contact_info` message), `phone_changed` (the contact
|
|
970
|
+
* changed their number; `previousPhoneNumber` carries the old one, and `bsuid`
|
|
971
|
+
* is `null` when WhatsApp never reported one for the contact), or
|
|
972
|
+
* `bsuid_changed` (WhatsApp reported a new BSUID for the same number).
|
|
973
|
+
* `contactId` is the contact that remains if two were merged, and
|
|
974
|
+
* `mergedContactId` the one folded into it. `previousBsuid` is a BSUID you may
|
|
975
|
+
* have stored that no longer identifies the contact. Sent once per link, not on
|
|
976
|
+
* every message. `data.from` on `message.inbound` is the phone only when
|
|
977
|
+
* WhatsApp includes it, so it can still be the BSUID afterwards; key on
|
|
978
|
+
* `contactId`.
|
|
942
979
|
* - `template.status_changed`: WhatsApp template approval status changed. `data`
|
|
943
980
|
* carries `templateId`, `name`, `previousStatus`, `currentStatus`,
|
|
944
981
|
* `rejectionReason`, and `category` — the category Meta currently bills the
|
|
@@ -1000,6 +1037,7 @@ export type WebhookEvent =
|
|
|
1000
1037
|
| 'message.unsupported'
|
|
1001
1038
|
| 'broadcast.status_changed'
|
|
1002
1039
|
| 'conversation.new'
|
|
1040
|
+
| 'contact.identity_linked'
|
|
1003
1041
|
| 'template.status_changed'
|
|
1004
1042
|
| 'invitation.status_changed'
|
|
1005
1043
|
| 'call.initiated'
|
|
@@ -1050,14 +1088,29 @@ export interface WebhookMessageData {
|
|
|
1050
1088
|
messageType?: MessageType;
|
|
1051
1089
|
/**
|
|
1052
1090
|
* ID of the conversation (inbox thread) this message belongs to. Sent on
|
|
1053
|
-
* `message.inbound` for
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
*
|
|
1091
|
+
* `message.inbound` on every channel, except for reactions. Use it to deep-link to
|
|
1092
|
+
* the dashboard inbox:
|
|
1093
|
+
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`. The webhook
|
|
1094
|
+
* is sent once the message has been filed in its thread, so this is always the
|
|
1095
|
+
* thread the message is in: on the first message of a new thread it is the id
|
|
1096
|
+
* `conversation.new` carries, and on the WhatsApp message that ties a BSUID to a
|
|
1097
|
+
* phone number it is the thread that remains once the two are joined.
|
|
1059
1098
|
*/
|
|
1060
1099
|
conversationId?: string | null;
|
|
1100
|
+
/**
|
|
1101
|
+
* ID of the Zavu contact that sent the message. Sent on `message.inbound` on every
|
|
1102
|
+
* channel, except for reactions. It does not change when a WhatsApp contact's
|
|
1103
|
+
* `from` switches from a business-scoped user ID (BSUID) to a phone number, so use
|
|
1104
|
+
* it, not `from`, as your key for the person. `null` only when no contact could be
|
|
1105
|
+
* resolved.
|
|
1106
|
+
*/
|
|
1107
|
+
contactId?: string | null;
|
|
1108
|
+
/**
|
|
1109
|
+
* WhatsApp identity of the sender. Present on WhatsApp `message.inbound` when Zavu
|
|
1110
|
+
* knows the sender's business-scoped user ID (BSUID), and absent otherwise. Same
|
|
1111
|
+
* shape as `whatsapp` on a contact or a conversation.
|
|
1112
|
+
*/
|
|
1113
|
+
whatsapp?: WebhookMessageDataWhatsapp;
|
|
1061
1114
|
/**
|
|
1062
1115
|
* Text body or media caption. Present on `message.inbound` when the message has
|
|
1063
1116
|
* text.
|
|
@@ -1085,6 +1138,16 @@ export interface WebhookMessageData {
|
|
|
1085
1138
|
referral?: AdReferral;
|
|
1086
1139
|
}
|
|
1087
1140
|
|
|
1141
|
+
export interface WebhookMessageDataWhatsapp {
|
|
1142
|
+
/**
|
|
1143
|
+
* Business-scoped user ID. Stable for the person on your WhatsApp Business
|
|
1144
|
+
* Account, whether or not `from` is a phone number.
|
|
1145
|
+
*/
|
|
1146
|
+
bsuid: string;
|
|
1147
|
+
/** The WhatsApp username, when the sender has one and Meta reported it. */
|
|
1148
|
+
username?: string;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1088
1151
|
/** Webhook configuration for the sender. */
|
|
1089
1152
|
export interface SenderWebhook {
|
|
1090
1153
|
/** HTTPS URL that will receive webhook events. */
|
|
@@ -1357,6 +1420,13 @@ export interface Contact {
|
|
|
1357
1420
|
countryCode?: string;
|
|
1358
1421
|
/** Contact's WhatsApp profile name. Only available for WhatsApp contacts. */
|
|
1359
1422
|
profileName?: string | null;
|
|
1423
|
+
/**
|
|
1424
|
+
* WhatsApp identity. Present when Zavu has a business-scoped user ID (BSUID) for
|
|
1425
|
+
* the contact, and absent otherwise. A contact with a username can be reached
|
|
1426
|
+
* under its BSUID, its phone number, or both; they are the same contact. Look one
|
|
1427
|
+
* up by BSUID with the `bsuid` query parameter of the list endpoint.
|
|
1428
|
+
*/
|
|
1429
|
+
whatsapp?: ContactWhatsapp;
|
|
1360
1430
|
/** List of available messaging channels for this contact. */
|
|
1361
1431
|
availableChannels: Array<string>;
|
|
1362
1432
|
/** Preferred channel for this contact. */
|
|
@@ -1370,6 +1440,13 @@ export interface Contact {
|
|
|
1370
1440
|
updatedAt?: string;
|
|
1371
1441
|
}
|
|
1372
1442
|
|
|
1443
|
+
export interface ContactWhatsapp {
|
|
1444
|
+
/** Business-scoped user ID. Can be used as `to` when sending. */
|
|
1445
|
+
bsuid: string;
|
|
1446
|
+
/** The WhatsApp username, when Meta reported one. */
|
|
1447
|
+
username?: string;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1373
1450
|
export type ContactDefaultChannel =
|
|
1374
1451
|
| 'sms'
|
|
1375
1452
|
| 'whatsapp'
|
|
@@ -3095,12 +3172,19 @@ export interface TenDlcBrandCreateRequest {
|
|
|
3095
3172
|
displayName: string;
|
|
3096
3173
|
/** Legal company name. */
|
|
3097
3174
|
companyName?: string;
|
|
3098
|
-
/**
|
|
3175
|
+
/**
|
|
3176
|
+
* Employer Identification Number (format: XX-XXXXXXX). Required to submit every
|
|
3177
|
+
* entity type except `SOLE_PROPRIETOR`: a brand without it can be created as a
|
|
3178
|
+
* draft, and `POST /v1/10dlc/brands/{brandId}/submit` refuses it with `400`.
|
|
3179
|
+
*/
|
|
3099
3180
|
ein?: string;
|
|
3100
3181
|
firstName?: string;
|
|
3101
3182
|
lastName?: string;
|
|
3102
3183
|
email: string;
|
|
3103
|
-
/**
|
|
3184
|
+
/**
|
|
3185
|
+
* Contact phone in E.164 format. For a `SOLE_PROPRIETOR`, a mobile number: the
|
|
3186
|
+
* carrier texts a verification code to it.
|
|
3187
|
+
*/
|
|
3104
3188
|
phone: string;
|
|
3105
3189
|
street: string;
|
|
3106
3190
|
city: string;
|
|
@@ -4750,6 +4834,13 @@ export interface ContactsListParams {
|
|
|
4750
4834
|
* start a new pagination run when the search term changes.
|
|
4751
4835
|
*/
|
|
4752
4836
|
search?: string;
|
|
4837
|
+
/**
|
|
4838
|
+
* Exact WhatsApp business-scoped user ID (e.g. `CO.13491208655302741918`). Returns
|
|
4839
|
+
* the contact that holds it, or an empty list. Combines with `phoneNumber` and
|
|
4840
|
+
* `tag` as a filter, and cannot be combined with `search` (400). A value that is
|
|
4841
|
+
* not shaped like a BSUID returns 400.
|
|
4842
|
+
*/
|
|
4843
|
+
bsuid?: string;
|
|
4753
4844
|
/**
|
|
4754
4845
|
* Tag name. Repeatable: `?tag=vip&tag=chile` returns contacts carrying **every**
|
|
4755
4846
|
* tag given, not any of them — the same rule the dashboard filter applies.
|
package/src/v2/types.ts
CHANGED
|
@@ -652,6 +652,13 @@ export interface Contact {
|
|
|
652
652
|
countryCode?: string;
|
|
653
653
|
/** Contact's WhatsApp profile name. Only available for WhatsApp contacts. */
|
|
654
654
|
profileName?: string | null;
|
|
655
|
+
/**
|
|
656
|
+
* WhatsApp identity. Present when Zavu has a business-scoped user ID (BSUID) for
|
|
657
|
+
* the contact, and absent otherwise. A contact with a username can be reached
|
|
658
|
+
* under its BSUID, its phone number, or both; they are the same contact. Look one
|
|
659
|
+
* up by BSUID with the `bsuid` query parameter of the list endpoint.
|
|
660
|
+
*/
|
|
661
|
+
whatsapp?: ContactWhatsapp;
|
|
655
662
|
/** List of available messaging channels for this contact. */
|
|
656
663
|
availableChannels: Array<string>;
|
|
657
664
|
/** Preferred channel for this contact. */
|
|
@@ -665,6 +672,13 @@ export interface Contact {
|
|
|
665
672
|
updatedAt?: string;
|
|
666
673
|
}
|
|
667
674
|
|
|
675
|
+
export interface ContactWhatsapp {
|
|
676
|
+
/** Business-scoped user ID. Can be used as `to` when sending. */
|
|
677
|
+
bsuid: string;
|
|
678
|
+
/** The WhatsApp username, when Meta reported one. */
|
|
679
|
+
username?: string;
|
|
680
|
+
}
|
|
681
|
+
|
|
668
682
|
export type ContactDefaultChannel =
|
|
669
683
|
| 'sms'
|
|
670
684
|
| 'whatsapp'
|
|
@@ -1044,25 +1058,42 @@ export interface MessageContent {
|
|
|
1044
1058
|
/** Message ID to react to. */
|
|
1045
1059
|
reactToMessageId?: string;
|
|
1046
1060
|
/**
|
|
1047
|
-
* Zavu message ID of the quoted message this message replies to.
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1061
|
+
* Zavu message ID of the quoted message this message replies to.
|
|
1062
|
+
*
|
|
1063
|
+
* **When sending:** set it to make the message a quoted reply to an earlier
|
|
1064
|
+
* message in the same conversation, such as the `data.messageId` of a
|
|
1065
|
+
* `message.inbound` webhook. Supported on WhatsApp (every message type except
|
|
1066
|
+
* `reaction`) and Telegram. The quoted message must belong to this project
|
|
1067
|
+
* (otherwise `404`), must have gone out on the same channel as this send, must
|
|
1068
|
+
* belong to the conversation `to` addresses, must have been sent or received by
|
|
1069
|
+
* the address this message goes out from (`from`), and must have a
|
|
1070
|
+
* `providerMessageId`. A failed message and a Telegram button tap cannot be
|
|
1071
|
+
* quoted. Any other case returns `400` instead of sending the message unquoted.
|
|
1072
|
+
* The stored message then carries the rest of the `replyTo*` fields.
|
|
1073
|
+
*
|
|
1074
|
+
* **When receiving:** present on inbound messages that quote an earlier message.
|
|
1075
|
+
* Omitted when the quoted message is not found in Zavu (e.g. an old or unknown
|
|
1076
|
+
* message) — use replyToProviderMessageId in that case.
|
|
1051
1077
|
*/
|
|
1052
1078
|
replyToMessageId?: string;
|
|
1053
1079
|
/**
|
|
1054
|
-
* Provider message ID (WhatsApp WAMID) of the quoted
|
|
1055
|
-
* inbound message is a reply, even if the
|
|
1080
|
+
* Provider message ID (WhatsApp WAMID, or Telegram message ID) of the quoted
|
|
1081
|
+
* message. Present whenever an inbound WhatsApp message is a reply, even if the
|
|
1082
|
+
* quoted message is not stored in Zavu, and on outbound quoted replies. Read-only:
|
|
1083
|
+
* to quote when sending, set replyToMessageId.
|
|
1056
1084
|
*/
|
|
1057
1085
|
replyToProviderMessageId?: string;
|
|
1058
|
-
/**
|
|
1086
|
+
/**
|
|
1087
|
+
* Sender of the quoted message (phone number in E.164 format, or the Telegram chat
|
|
1088
|
+
* ID). Read-only.
|
|
1089
|
+
*/
|
|
1059
1090
|
replyToFrom?: string;
|
|
1060
1091
|
/**
|
|
1061
|
-
* Truncated snippet of the quoted message's text, for
|
|
1062
|
-
* quoted message has no text (e.g. media).
|
|
1092
|
+
* Truncated snippet (up to 200 characters) of the quoted message's text, for
|
|
1093
|
+
* display. Empty when the quoted message has no text (e.g. media). Read-only.
|
|
1063
1094
|
*/
|
|
1064
1095
|
replyToText?: string;
|
|
1065
|
-
/** Type of the quoted message (text, image, video, etc.). */
|
|
1096
|
+
/** Type of the quoted message (text, image, video, etc.). Read-only. */
|
|
1066
1097
|
replyToMessageType?: string;
|
|
1067
1098
|
/** Template ID for template messages. */
|
|
1068
1099
|
templateId?: string;
|
|
@@ -1667,11 +1698,16 @@ export interface TemplateSubmitRequest {
|
|
|
1667
1698
|
* **Inbound events:**
|
|
1668
1699
|
* - `message.inbound`: New message received from a contact. `data.conversationId`,
|
|
1669
1700
|
* the inbox thread id (deep-link with
|
|
1670
|
-
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`), is
|
|
1671
|
-
*
|
|
1672
|
-
*
|
|
1673
|
-
*
|
|
1674
|
-
* a
|
|
1701
|
+
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`), is always
|
|
1702
|
+
* set: the webhook is sent once the message has been filed in its thread, so the
|
|
1703
|
+
* first message of a new thread carries the same id as `conversation.new`.
|
|
1704
|
+
* `data.contactId` is the Zavu contact, and unlike `data.from` it does not
|
|
1705
|
+
* change when a WhatsApp contact's identifier switches from a business-scoped
|
|
1706
|
+
* user ID (BSUID) to a phone number, unless the switch reveals two contacts for
|
|
1707
|
+
* one person; they are then merged and `contact.identity_linked` names the one
|
|
1708
|
+
* that went away in `mergedContactId`. On WhatsApp, `data.whatsapp` carries the
|
|
1709
|
+
* contact's `bsuid` and `username` when known. Reactions carry none of these
|
|
1710
|
+
* three. Reactions are delivered as `message.inbound` with
|
|
1675
1711
|
* `messageType='reaction'`. When the contact replied to (quoted) an earlier
|
|
1676
1712
|
* message, `data.content` carries the reply context: `replyToMessageId`,
|
|
1677
1713
|
* `replyToProviderMessageId`, `replyToFrom`, `replyToText`, and
|
|
@@ -1697,6 +1733,21 @@ export interface TemplateSubmitRequest {
|
|
|
1697
1733
|
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`), the
|
|
1698
1734
|
* `phoneNumber` or `email` key, `channel`, `firstMessageId`, `firstMessageText`,
|
|
1699
1735
|
* and `profileName`.
|
|
1736
|
+
* - `contact.identity_linked`: A WhatsApp contact known by BSUID was tied to a
|
|
1737
|
+
* phone number, a contact known by phone received a BSUID, or a contact changed
|
|
1738
|
+
* their number. `data` carries `contactId`, `bsuid`, `phoneNumber` and `reason`:
|
|
1739
|
+
* `provider_reported` (WhatsApp sent the phone and the BSUID together on an
|
|
1740
|
+
* inbound message), `contact_shared` (the contact shared their phone number in
|
|
1741
|
+
* reply to a `request_contact_info` message), `phone_changed` (the contact
|
|
1742
|
+
* changed their number; `previousPhoneNumber` carries the old one, and `bsuid`
|
|
1743
|
+
* is `null` when WhatsApp never reported one for the contact), or
|
|
1744
|
+
* `bsuid_changed` (WhatsApp reported a new BSUID for the same number).
|
|
1745
|
+
* `contactId` is the contact that remains if two were merged, and
|
|
1746
|
+
* `mergedContactId` the one folded into it. `previousBsuid` is a BSUID you may
|
|
1747
|
+
* have stored that no longer identifies the contact. Sent once per link, not on
|
|
1748
|
+
* every message. `data.from` on `message.inbound` is the phone only when
|
|
1749
|
+
* WhatsApp includes it, so it can still be the BSUID afterwards; key on
|
|
1750
|
+
* `contactId`.
|
|
1700
1751
|
* - `template.status_changed`: WhatsApp template approval status changed. `data`
|
|
1701
1752
|
* carries `templateId`, `name`, `previousStatus`, `currentStatus`,
|
|
1702
1753
|
* `rejectionReason`, and `category` — the category Meta currently bills the
|
|
@@ -1756,6 +1807,7 @@ export type WebhookEvent =
|
|
|
1756
1807
|
| 'message.unsupported'
|
|
1757
1808
|
| 'broadcast.status_changed'
|
|
1758
1809
|
| 'conversation.new'
|
|
1810
|
+
| 'contact.identity_linked'
|
|
1759
1811
|
| 'template.status_changed'
|
|
1760
1812
|
| 'invitation.status_changed'
|
|
1761
1813
|
| 'call.initiated'
|
|
@@ -1788,14 +1840,29 @@ export interface WebhookMessageData {
|
|
|
1788
1840
|
messageType?: MessageType;
|
|
1789
1841
|
/**
|
|
1790
1842
|
* ID of the conversation (inbox thread) this message belongs to. Sent on
|
|
1791
|
-
* `message.inbound` for
|
|
1792
|
-
*
|
|
1793
|
-
*
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1843
|
+
* `message.inbound` on every channel, except for reactions. Use it to deep-link to
|
|
1844
|
+
* the dashboard inbox:
|
|
1845
|
+
* `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`. The webhook
|
|
1846
|
+
* is sent once the message has been filed in its thread, so this is always the
|
|
1847
|
+
* thread the message is in: on the first message of a new thread it is the id
|
|
1848
|
+
* `conversation.new` carries, and on the WhatsApp message that ties a BSUID to a
|
|
1849
|
+
* phone number it is the thread that remains once the two are joined.
|
|
1797
1850
|
*/
|
|
1798
1851
|
conversationId?: string | null;
|
|
1852
|
+
/**
|
|
1853
|
+
* ID of the Zavu contact that sent the message. Sent on `message.inbound` on every
|
|
1854
|
+
* channel, except for reactions. It does not change when a WhatsApp contact's
|
|
1855
|
+
* `from` switches from a business-scoped user ID (BSUID) to a phone number, so use
|
|
1856
|
+
* it, not `from`, as your key for the person. `null` only when no contact could be
|
|
1857
|
+
* resolved.
|
|
1858
|
+
*/
|
|
1859
|
+
contactId?: string | null;
|
|
1860
|
+
/**
|
|
1861
|
+
* WhatsApp identity of the sender. Present on WhatsApp `message.inbound` when Zavu
|
|
1862
|
+
* knows the sender's business-scoped user ID (BSUID), and absent otherwise. Same
|
|
1863
|
+
* shape as `whatsapp` on a contact or a conversation.
|
|
1864
|
+
*/
|
|
1865
|
+
whatsapp?: WebhookMessageDataWhatsapp;
|
|
1799
1866
|
/**
|
|
1800
1867
|
* Text body or media caption. Present on `message.inbound` when the message has
|
|
1801
1868
|
* text.
|
|
@@ -1823,6 +1890,16 @@ export interface WebhookMessageData {
|
|
|
1823
1890
|
referral?: AdReferral;
|
|
1824
1891
|
}
|
|
1825
1892
|
|
|
1893
|
+
export interface WebhookMessageDataWhatsapp {
|
|
1894
|
+
/**
|
|
1895
|
+
* Business-scoped user ID. Stable for the person on your WhatsApp Business
|
|
1896
|
+
* Account, whether or not `from` is a phone number.
|
|
1897
|
+
*/
|
|
1898
|
+
bsuid: string;
|
|
1899
|
+
/** The WhatsApp username, when the sender has one and Meta reported it. */
|
|
1900
|
+
username?: string;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1826
1903
|
/**
|
|
1827
1904
|
* What a `POST` to your /v2 webhook carries. Signed like every Zavu webhook
|
|
1828
1905
|
* (`X-Zavu-Signature`, with the webhook's `signatureVersion`); the event name is
|
|
@@ -2306,6 +2383,13 @@ export interface ConversationsListMessagesParams {
|
|
|
2306
2383
|
/** Params for `contacts.list`. */
|
|
2307
2384
|
export interface ContactsListParams {
|
|
2308
2385
|
search?: string;
|
|
2386
|
+
/**
|
|
2387
|
+
* Exact WhatsApp business-scoped user ID (e.g. `CO.13491208655302741918`). Returns
|
|
2388
|
+
* the contact that holds it, or an empty list. Combines with `phoneNumber` and
|
|
2389
|
+
* `tag` as a filter, and cannot be combined with `search` (400). A value that is
|
|
2390
|
+
* not shaped like a BSUID returns 400.
|
|
2391
|
+
*/
|
|
2392
|
+
bsuid?: string;
|
|
2309
2393
|
tag?: Array<string>;
|
|
2310
2394
|
/** @defaultValue `50` */
|
|
2311
2395
|
limit?: number;
|
package/src/version.ts
CHANGED