@natyapp/meta 1.4.0 → 1.5.1

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.
@@ -29,8 +29,7 @@ const axiosInstanceGeneral = ({ url = "https://graph.facebook.com/v18.0/", acces
29
29
  });
30
30
  exports.axiosInstanceGeneral = axiosInstanceGeneral;
31
31
  const api = axios_1.default.create({
32
- // baseURL: "https://whatsapi.secretarianaty.com/v1",
33
- baseURL: "https://meta.api.secretarianaty.com/v1",
32
+ baseURL: "https://api.meta.naty.app/v1",
34
33
  headers: axiosInterceptors_1.configInterceptors,
35
34
  });
36
35
  exports.api = api;
@@ -19,6 +19,7 @@ export declare class WhatsappResponse {
19
19
  private getApiInstanceToken;
20
20
  updateClientNumber(clientNumber: string): Promise<void>;
21
21
  get_account_info(): Promise<connectionEvent["accountInfo"] | null>;
22
+ get_account_profile(): Promise<connectionEvent["accountInfo"] | null>;
22
23
  get_old_messages({ page, size, }: {
23
24
  page: number;
24
25
  size: number;
@@ -50,6 +50,19 @@ class WhatsappResponse {
50
50
  return null;
51
51
  }
52
52
  }
53
+ async get_account_profile() {
54
+ try {
55
+ if (!this.apiCall)
56
+ await this.getApiInstanceToken();
57
+ const getAccount = await this.apiCall.get("/whatsapp_business_profile");
58
+ return getAccount.data;
59
+ }
60
+ catch (err) {
61
+ console.log("Não foi possível requisitar informações da conta");
62
+ console.log(err.response.data.error);
63
+ return null;
64
+ }
65
+ }
53
66
  async get_old_messages({ page, size, }) {
54
67
  try {
55
68
  const getOldMessages = await messages_1.default.getAll({
@@ -393,7 +406,6 @@ class WhatsappResponse {
393
406
  accessToken: this.token,
394
407
  });
395
408
  const { data } = await getAxiosApi.get(`/${media_id}`);
396
- // a imagem só será disponível por 5 minutos, após esse tempo terá de gerar novamente
397
409
  return data;
398
410
  }
399
411
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natyapp/meta",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",