@zapyapi/sdk 1.0.0-beta.8 → 1.0.0-beta.9
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/README.md +3 -3
- package/index.cjs +4 -4
- package/index.js +4 -4
- package/package.json +1 -1
- package/src/generated/Api.d.ts +10 -10
- package/src/types/messages.types.d.ts +1 -1
- package/src/utils/phone.d.ts +1 -1
- package/src/version.d.ts +1 -1
package/README.md
CHANGED
|
@@ -272,14 +272,14 @@ normalizePhone('+5511999999999'); // '5511999999999'
|
|
|
272
272
|
|
|
273
273
|
// Validate phone numbers
|
|
274
274
|
isValidPhone('5511999999999'); // true
|
|
275
|
-
isValidPhone('5511999999999@
|
|
275
|
+
isValidPhone('5511999999999@s.whatsapp.net'); // true
|
|
276
276
|
|
|
277
277
|
// Check if JID is a group
|
|
278
278
|
isGroup('123456789@g.us'); // true
|
|
279
|
-
isGroup('5511999999999@
|
|
279
|
+
isGroup('5511999999999@s.whatsapp.net'); // false
|
|
280
280
|
|
|
281
281
|
// Extract phone from JID
|
|
282
|
-
extractPhone('5511999999999@
|
|
282
|
+
extractPhone('5511999999999@s.whatsapp.net'); // '5511999999999'
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
## Webhook Event Types
|
package/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var axios = require('axios');
|
|
4
4
|
|
|
5
5
|
/** SDK version - auto-generated from package.json */
|
|
6
|
-
const SDK_VERSION = '1.0.0-beta.
|
|
6
|
+
const SDK_VERSION = '1.0.0-beta.9';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Custom error classes for @zapyapi/sdk
|
|
@@ -1487,7 +1487,7 @@ const ZapyEventTypes = {
|
|
|
1487
1487
|
* normalizePhone('11999999999') // '5511999999999'
|
|
1488
1488
|
* normalizePhone('5511999999999') // '5511999999999'
|
|
1489
1489
|
* normalizePhone('+5511999999999') // '5511999999999'
|
|
1490
|
-
* normalizePhone('5511999999999@
|
|
1490
|
+
* normalizePhone('5511999999999@s.whatsapp.net') // '5511999999999@s.whatsapp.net'
|
|
1491
1491
|
*/
|
|
1492
1492
|
function normalizePhone(phone) {
|
|
1493
1493
|
// If it's already a WhatsApp ID, return as-is
|
|
@@ -1516,7 +1516,7 @@ function normalizePhone(phone) {
|
|
|
1516
1516
|
function isValidPhone(phone) {
|
|
1517
1517
|
// WhatsApp IDs are valid
|
|
1518
1518
|
if (phone.includes('@')) {
|
|
1519
|
-
return phone.endsWith('@c.us') || phone.endsWith('@g.us') || phone.endsWith('@lid');
|
|
1519
|
+
return phone.endsWith('@s.whatsapp.net') || phone.endsWith('@c.us') || phone.endsWith('@g.us') || phone.endsWith('@lid');
|
|
1520
1520
|
}
|
|
1521
1521
|
// Clean and check if it's a valid number
|
|
1522
1522
|
const cleaned = phone.replace(/[^\d]/g, '');
|
|
@@ -1766,7 +1766,7 @@ class HttpClient {
|
|
|
1766
1766
|
*
|
|
1767
1767
|
* Formatos de Mensagem
|
|
1768
1768
|
* - Números de Telefone: Formato brasileiro (11999999999) ou internacional (5511999999999)
|
|
1769
|
-
* - IDs do WhatsApp: Pessoal (@
|
|
1769
|
+
* - IDs do WhatsApp: Pessoal (@s.whatsapp.net), Grupos (@g.us), LIDs (@lid)
|
|
1770
1770
|
* - Mídia: Arquivos codificados em Base64 ou URLs públicas
|
|
1771
1771
|
*
|
|
1772
1772
|
* Suporte
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
|
|
3
3
|
/** SDK version - auto-generated from package.json */
|
|
4
|
-
const SDK_VERSION = '1.0.0-beta.
|
|
4
|
+
const SDK_VERSION = '1.0.0-beta.9';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Custom error classes for @zapyapi/sdk
|
|
@@ -1485,7 +1485,7 @@ const ZapyEventTypes = {
|
|
|
1485
1485
|
* normalizePhone('11999999999') // '5511999999999'
|
|
1486
1486
|
* normalizePhone('5511999999999') // '5511999999999'
|
|
1487
1487
|
* normalizePhone('+5511999999999') // '5511999999999'
|
|
1488
|
-
* normalizePhone('5511999999999@
|
|
1488
|
+
* normalizePhone('5511999999999@s.whatsapp.net') // '5511999999999@s.whatsapp.net'
|
|
1489
1489
|
*/
|
|
1490
1490
|
function normalizePhone(phone) {
|
|
1491
1491
|
// If it's already a WhatsApp ID, return as-is
|
|
@@ -1514,7 +1514,7 @@ function normalizePhone(phone) {
|
|
|
1514
1514
|
function isValidPhone(phone) {
|
|
1515
1515
|
// WhatsApp IDs are valid
|
|
1516
1516
|
if (phone.includes('@')) {
|
|
1517
|
-
return phone.endsWith('@c.us') || phone.endsWith('@g.us') || phone.endsWith('@lid');
|
|
1517
|
+
return phone.endsWith('@s.whatsapp.net') || phone.endsWith('@c.us') || phone.endsWith('@g.us') || phone.endsWith('@lid');
|
|
1518
1518
|
}
|
|
1519
1519
|
// Clean and check if it's a valid number
|
|
1520
1520
|
const cleaned = phone.replace(/[^\d]/g, '');
|
|
@@ -1764,7 +1764,7 @@ class HttpClient {
|
|
|
1764
1764
|
*
|
|
1765
1765
|
* Formatos de Mensagem
|
|
1766
1766
|
* - Números de Telefone: Formato brasileiro (11999999999) ou internacional (5511999999999)
|
|
1767
|
-
* - IDs do WhatsApp: Pessoal (@
|
|
1767
|
+
* - IDs do WhatsApp: Pessoal (@s.whatsapp.net), Grupos (@g.us), LIDs (@lid)
|
|
1768
1768
|
* - Mídia: Arquivos codificados em Base64 ou URLs públicas
|
|
1769
1769
|
*
|
|
1770
1770
|
* Suporte
|
package/package.json
CHANGED
package/src/generated/Api.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export interface ListInstancesResponseDto {
|
|
|
55
55
|
status: "stopped" | "manually_stopped" | "connecting" | "pending_qr_code_scan" | "connected" | "error" | "created" | "qr_timeout" | "payment_pending";
|
|
56
56
|
/**
|
|
57
57
|
* JID do WhatsApp quando conectado
|
|
58
|
-
* @example "5511999999999@
|
|
58
|
+
* @example "5511999999999@s.whatsapp.net"
|
|
59
59
|
*/
|
|
60
60
|
whatsappJid: object | null;
|
|
61
61
|
/**
|
|
@@ -381,7 +381,7 @@ export interface WebhookResumeResponseDto {
|
|
|
381
381
|
export interface SendMessageDto {
|
|
382
382
|
/**
|
|
383
383
|
* WhatsApp number or group ID to send the message to
|
|
384
|
-
* @example "5511999999999@
|
|
384
|
+
* @example "5511999999999@s.whatsapp.net"
|
|
385
385
|
*/
|
|
386
386
|
to: string;
|
|
387
387
|
/**
|
|
@@ -410,7 +410,7 @@ export interface CommonSendMessageResponseDto {
|
|
|
410
410
|
export interface SendImageMessageDto {
|
|
411
411
|
/**
|
|
412
412
|
* WhatsApp number or group ID to send the image to
|
|
413
|
-
* @example "5511999999999@
|
|
413
|
+
* @example "5511999999999@s.whatsapp.net"
|
|
414
414
|
*/
|
|
415
415
|
to: string;
|
|
416
416
|
/**
|
|
@@ -438,7 +438,7 @@ export interface SendImageMessageDto {
|
|
|
438
438
|
export interface SendVideoMessageDto {
|
|
439
439
|
/**
|
|
440
440
|
* WhatsApp number or group ID to send the video to
|
|
441
|
-
* @example "5511999999999@
|
|
441
|
+
* @example "5511999999999@s.whatsapp.net"
|
|
442
442
|
*/
|
|
443
443
|
to: string;
|
|
444
444
|
/**
|
|
@@ -500,7 +500,7 @@ export interface SendAudioFileMessageDto {
|
|
|
500
500
|
export interface SendDocumentMessageDto {
|
|
501
501
|
/**
|
|
502
502
|
* WhatsApp number or group ID to send the document to
|
|
503
|
-
* @example "5511999999999@
|
|
503
|
+
* @example "5511999999999@s.whatsapp.net"
|
|
504
504
|
*/
|
|
505
505
|
to: string;
|
|
506
506
|
/**
|
|
@@ -536,7 +536,7 @@ export interface ForwardMessageDto {
|
|
|
536
536
|
export interface EditMessageDto {
|
|
537
537
|
/**
|
|
538
538
|
* Whatsapp Message ID of the message to edit
|
|
539
|
-
* @example "73C5222F61C8DB541672CE65D79C7E4B@
|
|
539
|
+
* @example "73C5222F61C8DB541672CE65D79C7E4B@s.whatsapp.net_3EB0C767D71CC8C55E"
|
|
540
540
|
*/
|
|
541
541
|
messageId: string;
|
|
542
542
|
/**
|
|
@@ -562,7 +562,7 @@ export interface ReadMessageResponseDto {
|
|
|
562
562
|
export interface SendLocationDto {
|
|
563
563
|
/**
|
|
564
564
|
* WhatsApp number or group ID to send the location to
|
|
565
|
-
* @example "5511999999999@
|
|
565
|
+
* @example "5511999999999@s.whatsapp.net"
|
|
566
566
|
*/
|
|
567
567
|
to: string;
|
|
568
568
|
/**
|
|
@@ -615,7 +615,7 @@ export interface ContactInfoDto {
|
|
|
615
615
|
export interface SendContactDto {
|
|
616
616
|
/**
|
|
617
617
|
* WhatsApp number or group ID to send the contact to
|
|
618
|
-
* @example "5511999999999@
|
|
618
|
+
* @example "5511999999999@s.whatsapp.net"
|
|
619
619
|
*/
|
|
620
620
|
to: string;
|
|
621
621
|
/** Contact information to send */
|
|
@@ -629,7 +629,7 @@ export interface SendContactDto {
|
|
|
629
629
|
export interface SendStickerDto {
|
|
630
630
|
/**
|
|
631
631
|
* WhatsApp number or group ID to send the sticker to
|
|
632
|
-
* @example "5511999999999@
|
|
632
|
+
* @example "5511999999999@s.whatsapp.net"
|
|
633
633
|
*/
|
|
634
634
|
to: string;
|
|
635
635
|
/**
|
|
@@ -1728,7 +1728,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
1728
1728
|
*
|
|
1729
1729
|
* Formatos de Mensagem
|
|
1730
1730
|
* - Números de Telefone: Formato brasileiro (11999999999) ou internacional (5511999999999)
|
|
1731
|
-
* - IDs do WhatsApp: Pessoal (@
|
|
1731
|
+
* - IDs do WhatsApp: Pessoal (@s.whatsapp.net), Grupos (@g.us), LIDs (@lid)
|
|
1732
1732
|
* - Mídia: Arquivos codificados em Base64 ou URLs públicas
|
|
1733
1733
|
*
|
|
1734
1734
|
* Suporte
|
|
@@ -11,7 +11,7 @@ export interface BaseMessageOptions {
|
|
|
11
11
|
* Formats supported:
|
|
12
12
|
* - Brazilian format: 11999999999
|
|
13
13
|
* - International format: 5511999999999
|
|
14
|
-
* - WhatsApp ID: 5511999999999@
|
|
14
|
+
* - WhatsApp ID: 5511999999999@s.whatsapp.net (personal) or ...@g.us (group)
|
|
15
15
|
*/
|
|
16
16
|
to: string;
|
|
17
17
|
/**
|
package/src/utils/phone.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* normalizePhone('11999999999') // '5511999999999'
|
|
12
12
|
* normalizePhone('5511999999999') // '5511999999999'
|
|
13
13
|
* normalizePhone('+5511999999999') // '5511999999999'
|
|
14
|
-
* normalizePhone('5511999999999@
|
|
14
|
+
* normalizePhone('5511999999999@s.whatsapp.net') // '5511999999999@s.whatsapp.net'
|
|
15
15
|
*/
|
|
16
16
|
export declare function normalizePhone(phone: string): string;
|
|
17
17
|
/**
|
package/src/version.d.ts
CHANGED