@connection-hub/sdk 0.0.11 → 0.0.20
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 +47 -108
- package/dist/client.d.ts +0 -2
- package/dist/client.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/auth/index.js +1 -1
- package/dist/lib/connections/index.js +1 -1
- package/dist/lib/messaging/index.d.ts +79 -6
- package/dist/lib/messaging/index.js +1 -1
- package/dist/lib/webhooks/index.js +1 -1
- package/dist/types/index.d.ts +137 -10
- package/dist/types/index.js +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,108 +1,47 @@
|
|
|
1
|
-
# Connection Hub SDK
|
|
2
|
-
|
|
3
|
-
SDK oficial para integração com a API do Connection Hub.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Este SDK é parte
|
|
8
|
-
Para informações sobre preços, licenciamento e
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
apiUrl:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"channelToken",
|
|
49
|
-
"recipientId",
|
|
50
|
-
"Olá, como posso ajudar?"
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
// Instagram File (image,video)
|
|
54
|
-
const igMessage = await client.messaging.sendFileToInstagram(
|
|
55
|
-
"channelToken",
|
|
56
|
-
"recipientId",
|
|
57
|
-
"file url"
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
// Email
|
|
61
|
-
const email = await client.messaging.sendEmail(
|
|
62
|
-
"channelToken",
|
|
63
|
-
"Assunto do Email",
|
|
64
|
-
"Corpo do email",
|
|
65
|
-
"destinatario@exemplo.com",
|
|
66
|
-
[], // anexos (opcional)
|
|
67
|
-
"messageId", // inReplyTo (opcional)
|
|
68
|
-
["reference1", "reference2"] // references (opcional)
|
|
69
|
-
);
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Webhooks
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
// Configurar webhook
|
|
76
|
-
await client.webhooks.setupWebhook(
|
|
77
|
-
"channelToken",
|
|
78
|
-
"https://seu-servidor.com/webhook"
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
// Remover webhook / desconectar canal
|
|
82
|
-
await client.webhooks.removeWebhook("channelToken");
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Gerenciamento de Conexões
|
|
86
|
-
|
|
87
|
-
````typescript
|
|
88
|
-
// Listar conexões
|
|
89
|
-
const connections = await client.connections.listConnections();
|
|
90
|
-
|
|
91
|
-
// Obter conexão específica
|
|
92
|
-
const connection = await client.connections.getConnection('channelToken');
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
## Tipos
|
|
96
|
-
|
|
97
|
-
O SDK inclui tipos TypeScript para melhor desenvolvimento:
|
|
98
|
-
|
|
99
|
-
```typescript
|
|
100
|
-
import {
|
|
101
|
-
ConnectionData,
|
|
102
|
-
MessageData
|
|
103
|
-
} from '@connection-hub/sdk';
|
|
104
|
-
````
|
|
105
|
-
|
|
106
|
-
## Suporte
|
|
107
|
-
|
|
108
|
-
Para suporte, entre em contato com nossa equipe através do email suporte@connectionhub.com.br
|
|
1
|
+
# Connection Hub SDK
|
|
2
|
+
|
|
3
|
+
SDK oficial para integração com a API do Connection Hub.
|
|
4
|
+
|
|
5
|
+
## Aviso importante
|
|
6
|
+
|
|
7
|
+
Este SDK é parte de uma solução comercial e requer licenciamento adequado
|
|
8
|
+
para uso em produção. Para informações sobre preços, licenciamento e
|
|
9
|
+
suporte, entre em contato em **comercial@connectionhub.com.br**.
|
|
10
|
+
|
|
11
|
+
## Instalação
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @connection-hub/sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Início rápido
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { ConnectionHubClient } from "@connection-hub/sdk";
|
|
21
|
+
|
|
22
|
+
const client = new ConnectionHubClient({
|
|
23
|
+
accessToken: "seu-token-de-acesso", // obrigatório
|
|
24
|
+
apiUrl: "https://api.connectionhub.com.br", // opcional
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
await client.waitForValidation();
|
|
28
|
+
|
|
29
|
+
await client.messaging.sendTextToFacebook(
|
|
30
|
+
"channelToken",
|
|
31
|
+
"recipientId",
|
|
32
|
+
"Olá!"
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Documentação completa
|
|
37
|
+
|
|
38
|
+
A referência detalhada — todos os métodos, payloads de envio e formato dos
|
|
39
|
+
webhooks recebidos por canal — vive no painel do ConnectionHub:
|
|
40
|
+
|
|
41
|
+
**→ Acesse `/docs/developer` no painel contratado.**
|
|
42
|
+
|
|
43
|
+
Você precisa estar autenticado no painel para visualizar.
|
|
44
|
+
|
|
45
|
+
## Suporte
|
|
46
|
+
|
|
47
|
+
Para suporte, entre em contato com **suporte@connectionhub.com.br**.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare const axios: any;
|
|
2
|
-
declare const AuthServiceModule: any;
|
|
3
2
|
declare const MessagingServiceModule: any;
|
|
4
3
|
declare const WebhookServiceModule: any;
|
|
5
4
|
declare const ConnectionServiceModule: any;
|
|
@@ -8,7 +7,6 @@ declare class ConnectionHubClient {
|
|
|
8
7
|
private readonly config;
|
|
9
8
|
private credentialsValidated;
|
|
10
9
|
private validationPromise;
|
|
11
|
-
auth: any;
|
|
12
10
|
messaging: any;
|
|
13
11
|
webhooks: any;
|
|
14
12
|
connections: any;
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const _0x145476=_0x3356;(function(_0x18873a,_0x47bfc3){const _0x3f73b2=_0x3356,_0x2b0e7b=_0x18873a();while(!![]){try{const _0x35a267=parseInt(_0x3f73b2(0x15d))/(-0x1593+0x8e6+-0x6*-0x21d)*(-parseInt(_0x3f73b2(0x168))/(-0x1*0x14ae+-0x8ac+-0x1d5c*-0x1))+-parseInt(_0x3f73b2(0x166))/(0x56f+-0x11f9+0x99*0x15)*(-parseInt(_0x3f73b2(0x16b))/(-0x77*-0x35+-0x1fd1+0x3*0x266))+-parseInt(_0x3f73b2(0x169))/(-0x173*-0x4+-0x26c2+-0x20fb*-0x1)*(-parseInt(_0x3f73b2(0x143))/(0x11ef*-0x1+0xf6*0x1f+-0xbd5))+-parseInt(_0x3f73b2(0x151))/(-0x1450+-0x765+-0xdde*-0x2)+parseInt(_0x3f73b2(0x159))/(0x1*0x24+-0x16*-0xb1+-0xf52)*(parseInt(_0x3f73b2(0x13b))/(0x2086+-0x1931+-0x74c))+-parseInt(_0x3f73b2(0x178))/(0x20b+0x805+-0xa06)+parseInt(_0x3f73b2(0x15c))/(-0x1ae6+0x7*0x115+0x135e);if(_0x35a267===_0x47bfc3)break;else _0x2b0e7b['push'](_0x2b0e7b['shift']());}catch(_0x35ae8e){_0x2b0e7b['push'](_0x2b0e7b['shift']());}}}(_0x98a5,-0x84a9f*0x1+0x2*0xe593+0xc91bb));function _0x3356(_0x2ff4b0,_0x11592b){_0x2ff4b0=_0x2ff4b0-(0x2491+-0x1a9b*-0x1+-0x3e09);const _0x990ea5=_0x98a5();let _0x5e22e6=_0x990ea5[_0x2ff4b0];return _0x5e22e6;}const axios=require(_0x145476(0x135)),MessagingServiceModule=require(_0x145476(0x15e)+_0x145476(0x15a)),WebhookServiceModule=require(_0x145476(0x179)+_0x145476(0x127)),ConnectionServiceModule=require(_0x145476(0x14e)+_0x145476(0x176));class ConnectionHubClient{constructor(_0x27dc86){const _0x42ec8e=_0x145476,_0x179a8a={};_0x179a8a[_0x42ec8e(0x140)]=_0x42ec8e(0x133)+_0x42ec8e(0x13f)+_0x42ec8e(0x142),_0x179a8a[_0x42ec8e(0x12b)]=_0x42ec8e(0x162)+_0x42ec8e(0x139),_0x179a8a[_0x42ec8e(0x175)]=_0x42ec8e(0x12a)+_0x42ec8e(0x149),_0x179a8a[_0x42ec8e(0x134)]=_0x42ec8e(0x16d)+_0x42ec8e(0x12c)+_0x42ec8e(0x16c)+'br';const _0x1f7566=_0x179a8a;this[_0x42ec8e(0x129)+_0x42ec8e(0x153)]=![],this[_0x42ec8e(0x155)+_0x42ec8e(0x170)]=null;if(!_0x27dc86[_0x42ec8e(0x15b)+'n'])throw new Error(_0x1f7566[_0x42ec8e(0x140)]);this[_0x42ec8e(0x130)]=_0x27dc86;const _0x2d6ec7={};_0x2d6ec7[_0x42ec8e(0x125)+'pe']=_0x1f7566[_0x42ec8e(0x12b)];const _0x4b0f75=_0x2d6ec7;_0x27dc86[_0x42ec8e(0x15b)+'n']&&(_0x4b0f75[_0x1f7566[_0x42ec8e(0x175)]]=_0x42ec8e(0x171)+_0x27dc86[_0x42ec8e(0x15b)+'n']);const _0x46350f={};_0x46350f[_0x42ec8e(0x177)]=_0x27dc86[_0x42ec8e(0x14c)]||_0x1f7566[_0x42ec8e(0x134)],_0x46350f[_0x42ec8e(0x147)]=_0x4b0f75,this[_0x42ec8e(0x12d)]=axios[_0x42ec8e(0x152)](_0x46350f),this[_0x42ec8e(0x132)]=new MessagingServiceModule[(_0x42ec8e(0x161))+(_0x42ec8e(0x14f))](this[_0x42ec8e(0x12d)],this),this[_0x42ec8e(0x154)]=new WebhookServiceModule[(_0x42ec8e(0x16f))+(_0x42ec8e(0x14b))](this[_0x42ec8e(0x12d)],this),this[_0x42ec8e(0x137)+'s']=new ConnectionServiceModule[(_0x42ec8e(0x123))+(_0x42ec8e(0x14a))](this[_0x42ec8e(0x12d)],this),this[_0x42ec8e(0x155)+_0x42ec8e(0x170)]=this[_0x42ec8e(0x126)+_0x42ec8e(0x15f)]();}async[_0x145476(0x126)+_0x145476(0x15f)](){const _0x34d22d=_0x145476,_0x1a6aea={'znvzP':_0x34d22d(0x167)+_0x34d22d(0x12f),'rQswn':function(_0x18f9ef,_0x24db2b){return _0x18f9ef===_0x24db2b;},'nYRDd':function(_0x3a26ca,_0xee86ea){return _0x3a26ca(_0xee86ea);},'bXXQG':function(_0x104767,_0x228e78){return _0x104767===_0x228e78;},'AsbxE':function(_0x32acaf,_0x34d4b0){return _0x32acaf(_0x34d4b0);}};try{if(this[_0x34d22d(0x155)+_0x34d22d(0x170)])return this[_0x34d22d(0x155)+_0x34d22d(0x170)];return this[_0x34d22d(0x155)+_0x34d22d(0x170)]=new Promise(async _0x4f8322=>{const _0x9fda00=_0x34d22d;try{const _0x2edf13=await this[_0x9fda00(0x12d)][_0x9fda00(0x174)](_0x1a6aea[_0x9fda00(0x17a)]);this[_0x9fda00(0x129)+_0x9fda00(0x153)]=_0x1a6aea[_0x9fda00(0x146)](_0x2edf13[_0x9fda00(0x136)][_0x9fda00(0x16a)],!![]),_0x1a6aea[_0x9fda00(0x148)](_0x4f8322,this[_0x9fda00(0x129)+_0x9fda00(0x153)]);}catch(_0x10f439){_0x1a6aea[_0x9fda00(0x146)](_0x10f439[_0x9fda00(0x172)]?.[_0x9fda00(0x157)],-0x13b+-0x166+-0x2*-0x219)||_0x1a6aea[_0x9fda00(0x173)](_0x10f439[_0x9fda00(0x172)]?.[_0x9fda00(0x157)],-0x24fb+-0xbf8*-0x2+0xe9e)?(this[_0x9fda00(0x129)+_0x9fda00(0x153)]=![],_0x1a6aea[_0x9fda00(0x13c)](_0x4f8322,![])):(this[_0x9fda00(0x129)+_0x9fda00(0x153)]=![],_0x1a6aea[_0x9fda00(0x148)](_0x4f8322,![]));}finally{this[_0x9fda00(0x155)+_0x9fda00(0x170)]=null;}}),this[_0x34d22d(0x155)+_0x34d22d(0x170)];}catch(_0x3f4cca){return this[_0x34d22d(0x129)+_0x34d22d(0x153)]=![],![];}}[_0x145476(0x138)+_0x145476(0x160)+'ed'](){const _0x2a73c0=_0x145476;return this[_0x2a73c0(0x129)+_0x2a73c0(0x153)];}[_0x145476(0x150)+_0x145476(0x131)](_0x5d027a=!![]){const _0x45be80=_0x145476,_0x2a4216={};_0x2a4216[_0x45be80(0x156)]=_0x45be80(0x165)+_0x45be80(0x17b)+_0x45be80(0x164)+_0x45be80(0x13e)+_0x45be80(0x12e)+_0x45be80(0x158)+_0x45be80(0x16e)+_0x45be80(0x163)+_0x45be80(0x144)+'.';const _0x878ddc=_0x2a4216;if(!this[_0x45be80(0x129)+_0x45be80(0x153)]&&_0x5d027a)throw new Error(_0x878ddc[_0x45be80(0x156)]);return this[_0x45be80(0x129)+_0x45be80(0x153)];}async[_0x145476(0x124)+_0x145476(0x13a)](){const _0xff2d97=_0x145476;if(this[_0xff2d97(0x155)+_0xff2d97(0x170)])return this[_0xff2d97(0x155)+_0xff2d97(0x170)];if(this[_0xff2d97(0x129)+_0xff2d97(0x153)])return!![];return this[_0xff2d97(0x126)+_0xff2d97(0x15f)]();}[_0x145476(0x14d)+_0x145476(0x17c)](_0x222edf){const _0x1524c1=_0x145476,_0x423e69={};_0x423e69[_0x1524c1(0x128)]=_0x1524c1(0x12a)+_0x1524c1(0x149);const _0x580eae=_0x423e69;this[_0x1524c1(0x130)][_0x1524c1(0x15b)+'n']=_0x222edf,this[_0x1524c1(0x12d)][_0x1524c1(0x141)][_0x1524c1(0x147)][_0x580eae[_0x1524c1(0x128)]]=_0x1524c1(0x171)+_0x222edf,this[_0x1524c1(0x129)+_0x1524c1(0x153)]=![],this[_0x1524c1(0x155)+_0x1524c1(0x170)]=this[_0x1524c1(0x126)+_0x1524c1(0x15f)]();}}const _0xd1404c={};_0xd1404c[_0x145476(0x123)+_0x145476(0x13d)]=ConnectionHubClient,module[_0x145476(0x145)]=_0xd1404c;function _0x98a5(){const _0x1267c5=['o\x20iniciali','oken','Connection','waitForVal','Content-Ty','validateCr','ooks','IyQwV','credential','Authorizat','omgxU','i.connecti','api','s\x20credenci','date','config','Operations','messaging','AccessToke','uLnsw','axios','data','connection','isCredenti','n/json','idation','9jrmVOx','AsbxE','HubClient','tamente.\x20A','n\x20é\x20obriga','TuGVx','defaults','tório','721434TCbypZ','\x20inválidas','exports','rQswn','headers','nYRDd','ion','Service','vice','apiUrl','setAccessT','./lib/conn','ervice','canExecute','3931039YEcbUF','create','sValidated','webhooks','validation','YpMrV','status','ais\x20não\x20fo','5500696hlUpDw','aging','accessToke','3258937UhXeVp','1Ydmxqp','./lib/mess','edentials','alsValidat','MessagingS','applicatio','das\x20ou\x20são','zado\x20corre','Cliente\x20nã','149622VRUzfP','/auth/vali','638494jqLDVu','15tIZDGa','success','52rnbWUj','onhub.com.','https://ap','ram\x20valida','WebhookSer','Promise','Bearer\x20','response','bXXQG','get','rxgOX','ections','baseURL','7142190uRYaKW','./lib/webh','znvzP'];_0x98a5=function(){return _0x1267c5;};return _0x98a5();}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const _0x122315=_0x19eb;(function(_0x436571,_0x1c23d6){const _0x2e4984=_0x19eb,_0x3ddaf1=_0x436571();while(!![]){try{const _0x286e25=-parseInt(_0x2e4984(0xd8))/(0x914+-0x218+0x1*-0x6fb)*(-parseInt(_0x2e4984(0xdd))/(-0x1615*-0x1+-0x1c4b+-0x4*-0x18e))+-parseInt(_0x2e4984(0xd6))/(-0x28f*0x8+0x18f3+-0x68*0xb)+-parseInt(_0x2e4984(0xda))/(-0x48b*0x1+-0x8d7+0xd66)+parseInt(_0x2e4984(0xd3))/(0xbd5*-0x1+0x2242+-0x1668)+parseInt(_0x2e4984(0xe3))/(0xbd4+-0xbe5+0x17)*(-parseInt(_0x2e4984(0xe0))/(0xb3c*0x1+-0x7a7*0x2+-0x1*-0x419))+parseInt(_0x2e4984(0xd7))/(0x741+-0x1*-0x1a7+-0x8e0)+parseInt(_0x2e4984(0xd5))/(-0x1*0xe42+0x1794+-0x949*0x1)*(-parseInt(_0x2e4984(0xdf))/(0xcae+-0x144b+0x7a7));if(_0x286e25===_0x1c23d6)break;else _0x3ddaf1['push'](_0x3ddaf1['shift']());}catch(_0x2cd94d){_0x3ddaf1['push'](_0x3ddaf1['shift']());}}}(_0x18ee,-0xad0f1+0x1*-0xc60e9+0x1fba40));function _0x18ee(){const _0x56e5a5=['21066XYvHuO','2107130JqgkGU','HubClient','1799127Jhdgjo','1308096uZhaAR','8112976mXVPWq','128702EAmKpz','./client','259492AzVnsC','keys','./types','12SwEMsF','Connection','20NAHVIN','1491KeFJWP','exports','forEach'];_0x18ee=function(){return _0x56e5a5;};return _0x18ee();}const clientModule=require(_0x122315(0xd9));function _0x19eb(_0x1b80c9,_0x35da21){_0x1b80c9=_0x1b80c9-(-0xf8b+-0x11ea+0x2248);const _0x23066d=_0x18ee();let _0x2951e7=_0x23066d[_0x1b80c9];return _0x2951e7;}module[_0x122315(0xe1)][_0x122315(0xde)+_0x122315(0xd4)]=clientModule[_0x122315(0xde)+_0x122315(0xd4)];const types=require(_0x122315(0xdc));Object[_0x122315(0xdb)](types)[_0x122315(0xe2)](_0x2edd89=>{const _0x50d5e8=_0x122315;module[_0x50d5e8(0xe1)][_0x2edd89]=types[_0x2edd89];});
|