pangea-server 3.3.161 → 3.3.163
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/dist/database/index.d.ts +0 -1
- package/dist/database/index.js +0 -1
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/instagram.helpers.d.ts +9 -0
- package/dist/helpers/instagram.helpers.js +22 -0
- package/dist/helpers/whatsapp.helpers.d.ts +2 -2
- package/dist/helpers/whatsapp.helpers.js +2 -2
- package/package.json +1 -1
package/dist/database/index.d.ts
CHANGED
package/dist/database/index.js
CHANGED
|
@@ -24,6 +24,5 @@ __exportStar(require("./models"), exports);
|
|
|
24
24
|
__exportStar(require("./base-service.class"), exports);
|
|
25
25
|
__exportStar(require("./database.types"), exports);
|
|
26
26
|
__exportStar(require("./db-client"), exports);
|
|
27
|
-
__exportStar(require("./db.class"), exports);
|
|
28
27
|
__exportStar(require("./seed.helpers"), exports);
|
|
29
28
|
__exportStar(require("./use-auto-commit"), exports);
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './file-storage.helpers';
|
|
|
7
7
|
export * from './gemini.helpers';
|
|
8
8
|
export * from './google.helpers';
|
|
9
9
|
export * from './html-sanitize.helpers';
|
|
10
|
+
export * from './instagram.helpers';
|
|
10
11
|
export * from './job.helpers';
|
|
11
12
|
export * from './mailer.helpers';
|
|
12
13
|
export * from './multer.helpers';
|
package/dist/helpers/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __exportStar(require("./file-storage.helpers"), exports);
|
|
|
23
23
|
__exportStar(require("./gemini.helpers"), exports);
|
|
24
24
|
__exportStar(require("./google.helpers"), exports);
|
|
25
25
|
__exportStar(require("./html-sanitize.helpers"), exports);
|
|
26
|
+
__exportStar(require("./instagram.helpers"), exports);
|
|
26
27
|
__exportStar(require("./job.helpers"), exports);
|
|
27
28
|
__exportStar(require("./mailer.helpers"), exports);
|
|
28
29
|
__exportStar(require("./multer.helpers"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Instagram = void 0;
|
|
4
|
+
const GRAPH_VERSION = 'v21.0';
|
|
5
|
+
class Instagram {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.__accountId = config.accountId;
|
|
8
|
+
this.__accessToken = config.accessToken;
|
|
9
|
+
}
|
|
10
|
+
async sendText(to, text) {
|
|
11
|
+
const response = await fetch(`https://graph.facebook.com/${GRAPH_VERSION}/${this.__accountId}/messages`, {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${this.__accessToken}` },
|
|
14
|
+
body: JSON.stringify({ recipient: { id: to }, message: { text } }),
|
|
15
|
+
});
|
|
16
|
+
const data = await response.json();
|
|
17
|
+
if (!response.ok)
|
|
18
|
+
throw new Error(`instagram sendText failed: ${JSON.stringify(data)}`);
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Instagram = Instagram;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare class Whatsapp {
|
|
2
|
+
private __phoneNumberId;
|
|
2
3
|
private __accessToken;
|
|
3
|
-
private __phoneNumber;
|
|
4
4
|
constructor(config: {
|
|
5
|
+
phoneNumberId: string;
|
|
5
6
|
accessToken: string;
|
|
6
|
-
phoneNumber: string;
|
|
7
7
|
});
|
|
8
8
|
sendText(to: string, text: string): Promise<import("@whatsapp-cloudapi/types/cloudapi", { with: { "resolution-mode": "import" } }).CloudAPIResponse>;
|
|
9
9
|
}
|
|
@@ -7,11 +7,11 @@ exports.Whatsapp = void 0;
|
|
|
7
7
|
const client_1 = __importDefault(require("@whatsapp-cloudapi/client"));
|
|
8
8
|
class Whatsapp {
|
|
9
9
|
constructor(config) {
|
|
10
|
+
this.__phoneNumberId = config.phoneNumberId;
|
|
10
11
|
this.__accessToken = config.accessToken;
|
|
11
|
-
this.__phoneNumber = config.phoneNumber;
|
|
12
12
|
}
|
|
13
13
|
sendText(to, text) {
|
|
14
|
-
return client_1.default.sendTextMessage({
|
|
14
|
+
return client_1.default.sendTextMessage({ from: this.__phoneNumberId, to, text, accessToken: this.__accessToken });
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.Whatsapp = Whatsapp;
|