@open-wa/wa-automate-types-only 4.62.5 → 4.64.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { Page } from 'puppeteer';
3
3
  import { Chat, LiveLocationChangedEvent, ChatState, ChatMuteDuration, GroupChatCreationResponse, EphemeralDuration } from './model/chat';
4
- import { Contact, NumberCheck } from './model/contact';
4
+ import { BusinessProfile, Contact, NumberCheck } from './model/contact';
5
5
  import { Message, MessageInfo, PollData } from './model/message';
6
6
  import { AxiosRequestConfig } from 'axios';
7
7
  import { NewCommunityGroup, ParticipantChangedEventModel, GenericGroupChangeEvent, GroupMetadata } from './model/group-metadata';
@@ -591,6 +591,13 @@ export declare class Client {
591
591
  *
592
592
  * {@license:insiders@}
593
593
  *
594
+ * :::danger
595
+ *
596
+ * WA BIZ accounts CANNOT send buttons. This is a WA limitation. DO NOT get a license solely for access to buttons on wa business accounts.
597
+ * THIS IS NOT WORKING FOR GROUPS YET.
598
+ *
599
+ * :::
600
+ *
594
601
  * Send generic quick reply buttons. This is an insiders feature for MD accounts.
595
602
  *
596
603
  * @param {ChatId} to chat id
@@ -607,9 +614,13 @@ export declare class Client {
607
614
  * :::danger
608
615
  *
609
616
  * Template messages (URL & CALL buttons) are broken for the foreseeable future. Please DO NOT get a license solely for access to URL or CALL buttons. They are no longer reliable due to recent changes at WA.
617
+ * WA BIZ accounts CANNOT send buttons. This is a WA limitation. DO NOT get a license solely for access to buttons on wa business accounts.
618
+ *
619
+ * THIS IS NOT WORKING FOR GROUPS YET.
610
620
  *
611
621
  * :::
612
622
  *
623
+ *
613
624
  * Send advanced buttons with media body. This is an insiders feature for MD accounts.
614
625
  *
615
626
  * Body can be location, image, video or document. Buttons can be quick reply, url or call buttons.
@@ -635,6 +646,13 @@ export declare class Client {
635
646
  *
636
647
  * {@license:insiders@}
637
648
  *
649
+ * :::danger
650
+ *
651
+ * It is not currently possible to send a listmessage to a group chat. This is a WA limitation.
652
+ * Please DO NOT get a license solely for access to list messages in group chats.
653
+ *
654
+ * :::
655
+ *
638
656
  * Send a list message. This will not work when being sent from business accounts!
639
657
  *
640
658
  * @param {ChatId} to
@@ -875,10 +893,17 @@ export declare class Client {
875
893
  /**
876
894
  * Find any product listings of the given number. Use this to query a catalog
877
895
  *
878
- * @param id id of buseinss profile (i.e the number with @c.us)
896
+ * @param id id of business profile (i.e the number with @c.us)
879
897
  * @returns None
880
898
  */
881
899
  getBusinessProfilesProducts(id: ContactId): Promise<any>;
900
+ /**
901
+ * Get the business info of a given contact id
902
+ *
903
+ * @param id id of business profile (i.e the number with @c.us)
904
+ * @returns None
905
+ */
906
+ getBusinessProfile(id: ContactId): Promise<BusinessProfile>;
882
907
  /**
883
908
  * Sends product with image to chat
884
909
  * @param imgBase64 Base64 image data
@@ -1068,6 +1093,16 @@ export declare class Client {
1068
1093
  * @returns array of [Chat]
1069
1094
  */
1070
1095
  getAllChatsWithMessages(withNewMessageOnly?: boolean): Promise<Chat[]>;
1096
+ /**
1097
+ * Returns a properly formatted array of messages from to send to the openai api
1098
+ *
1099
+ * @param last The amount of previous messages to retrieve. Defaults to 10
1100
+ * @returns
1101
+ */
1102
+ getGptArray(chatId: ChatId, last?: number): Promise<{
1103
+ role: "user" | "assistant";
1104
+ content: string;
1105
+ }[]>;
1071
1106
  /**
1072
1107
  * Retrieve all groups
1073
1108
  * @returns array of groups
@@ -8,6 +8,92 @@ export interface NumberCheck {
8
8
  canReceiveMessage: boolean;
9
9
  numberExists: boolean;
10
10
  }
11
+ export interface BizCategory {
12
+ id: string;
13
+ localized_display_name: string;
14
+ }
15
+ export interface BizProfileOptions {
16
+ commerceExperience: "catalog" | "none" | "shop";
17
+ cartEnabled: boolean;
18
+ }
19
+ export interface BusinessHours {
20
+ config: {
21
+ [day in "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun"]: {
22
+ mode: "specific_hours" | "open_24h" | "appointment_only";
23
+ hours: number[][];
24
+ };
25
+ };
26
+ timezone: string;
27
+ }
28
+ export interface BusinessProfile {
29
+ /**
30
+ * The Contact ID of the business
31
+ */
32
+ id: ContactId;
33
+ /**
34
+ * Some special string that identifies the business (?)
35
+ */
36
+ tag: string;
37
+ /**
38
+ * The business description
39
+ */
40
+ description: string;
41
+ /**
42
+ * The business' categories
43
+ */
44
+ categories: BizCategory[];
45
+ /**
46
+ * The business' profile options
47
+ */
48
+ profileOptions: BizProfileOptions;
49
+ /**
50
+ * The business' email address
51
+ */
52
+ email: string;
53
+ /**
54
+ * Array of strings that represent the business' websites
55
+ */
56
+ website: string[];
57
+ /**
58
+ * The operating hours of the business
59
+ */
60
+ businessHours: BusinessHours;
61
+ /**
62
+ * The status of the business' catalog
63
+ */
64
+ catalogStatus: "catalog_exists" | string;
65
+ /**
66
+ * The address of the business
67
+ */
68
+ address: string;
69
+ /**
70
+ * The facebook page of the business
71
+ */
72
+ fbPage: any;
73
+ /**
74
+ * The instagram profile of the business
75
+ */
76
+ igProfessional: any;
77
+ isProfileLinked: boolean;
78
+ coverPhoto: {
79
+ /**
80
+ * The id of the cover photo
81
+ */
82
+ id: string;
83
+ /**
84
+ * The URL of the cover photo. It might download as an .enc but just change the extension to .jpg
85
+ */
86
+ url: string;
87
+ };
88
+ /**
89
+ * The latitude of the business location if set
90
+ */
91
+ latitude: number;
92
+ /**
93
+ * The longitude of the business location if set
94
+ */
95
+ longitude: number;
96
+ }
11
97
  export interface Contact {
12
98
  formattedName: string;
13
99
  id: ContactId;
@@ -48,4 +134,10 @@ export interface Contact {
48
134
  verifiedName: string;
49
135
  isOnline?: boolean;
50
136
  lastSeen?: number;
137
+ /**
138
+ * If the contact is a business, the business information will be added to the contact object.
139
+ *
140
+ * In some circumstances this will be out of date or lacking certain fields. In those cases you have to use `client.getBusinessProfile`
141
+ */
142
+ businessProfile?: BusinessProfile;
51
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate-types-only",
3
- "version": "4.62.5",
3
+ "version": "4.64.0",
4
4
  "description": "Types generated from the @open-wa/wa-automate package",
5
5
  "scripts": {
6
6
  "build": "tsc",