plazbot-cli 0.2.15 → 0.2.17
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.
|
@@ -25,12 +25,14 @@ const CHANNEL_CHOICES = [
|
|
|
25
25
|
{ name: 'WhatsApp Business', value: 'whatsapp_business' },
|
|
26
26
|
{ name: 'Instagram', value: 'instagram' },
|
|
27
27
|
{ name: 'Messenger', value: 'facebook' },
|
|
28
|
+
{ name: 'Telegram', value: 'telegram' },
|
|
28
29
|
];
|
|
29
30
|
const CHANNEL_AGENT_MAP = {
|
|
30
31
|
whatsapp: 'whatsapp',
|
|
31
32
|
whatsapp_business: 'whatsapp',
|
|
32
33
|
instagram: 'instagram',
|
|
33
|
-
facebook: '
|
|
34
|
+
facebook: 'messenger',
|
|
35
|
+
telegram: 'telegram',
|
|
34
36
|
};
|
|
35
37
|
function getIntegrationLabel(ig) {
|
|
36
38
|
if (ig.type === 'whatsapp') {
|
|
@@ -40,6 +42,9 @@ function getIntegrationLabel(ig) {
|
|
|
40
42
|
}
|
|
41
43
|
return ig.aliasName || ig.srcName || ig.id;
|
|
42
44
|
}
|
|
45
|
+
function getIntegrationKey(ig) {
|
|
46
|
+
return ig.aliasName || ig.srcName || ig.id;
|
|
47
|
+
}
|
|
43
48
|
async function fetchWorkspaceIntegrations(baseUrl, workspaceId, headers) {
|
|
44
49
|
try {
|
|
45
50
|
const wkRes = await axios_1.default.get(`${baseUrl}/api/workspace/${workspaceId}`, { headers });
|
|
@@ -114,7 +119,7 @@ async function connectChannelFlow(ctx) {
|
|
|
114
119
|
}
|
|
115
120
|
channels.push({
|
|
116
121
|
channel: CHANNEL_AGENT_MAP[channelType],
|
|
117
|
-
key: selectedIntegration
|
|
122
|
+
key: getIntegrationKey(selectedIntegration),
|
|
118
123
|
multianswer: false,
|
|
119
124
|
});
|
|
120
125
|
console.log(chalk_1.default.hex('#4ade80')(` Canal asociado: ${label}`));
|
|
@@ -209,7 +214,7 @@ async function connectChannelFlow(ctx) {
|
|
|
209
214
|
}
|
|
210
215
|
channels.push({
|
|
211
216
|
channel: CHANNEL_AGENT_MAP[channelType],
|
|
212
|
-
key: detected
|
|
217
|
+
key: getIntegrationKey(detected),
|
|
213
218
|
multianswer: false,
|
|
214
219
|
});
|
|
215
220
|
console.log(chalk_1.default.hex('#4ade80')(' Canal asociado correctamente.'));
|
package/package.json
CHANGED
|
@@ -113,13 +113,15 @@ const CHANNEL_CHOICES = [
|
|
|
113
113
|
{ name: 'WhatsApp Business', value: 'whatsapp_business' },
|
|
114
114
|
{ name: 'Instagram', value: 'instagram' },
|
|
115
115
|
{ name: 'Messenger', value: 'facebook' },
|
|
116
|
+
{ name: 'Telegram', value: 'telegram' },
|
|
116
117
|
];
|
|
117
118
|
|
|
118
119
|
const CHANNEL_AGENT_MAP: Record<string, string> = {
|
|
119
120
|
whatsapp: 'whatsapp',
|
|
120
121
|
whatsapp_business: 'whatsapp',
|
|
121
122
|
instagram: 'instagram',
|
|
122
|
-
facebook: '
|
|
123
|
+
facebook: 'messenger',
|
|
124
|
+
telegram: 'telegram',
|
|
123
125
|
};
|
|
124
126
|
|
|
125
127
|
function getIntegrationLabel(ig: any): string {
|
|
@@ -131,6 +133,10 @@ function getIntegrationLabel(ig: any): string {
|
|
|
131
133
|
return ig.aliasName || ig.srcName || ig.id;
|
|
132
134
|
}
|
|
133
135
|
|
|
136
|
+
function getIntegrationKey(ig: any): string {
|
|
137
|
+
return ig.aliasName || ig.srcName || ig.id;
|
|
138
|
+
}
|
|
139
|
+
|
|
134
140
|
async function fetchWorkspaceIntegrations(baseUrl: string, workspaceId: string, headers: any): Promise<any[]> {
|
|
135
141
|
try {
|
|
136
142
|
const wkRes = await axios.get(`${baseUrl}/api/workspace/${workspaceId}`, { headers });
|
|
@@ -217,7 +223,7 @@ async function connectChannelFlow(ctx: WizardContext): Promise<AgentChannel[]> {
|
|
|
217
223
|
|
|
218
224
|
channels.push({
|
|
219
225
|
channel: CHANNEL_AGENT_MAP[channelType],
|
|
220
|
-
key: selectedIntegration
|
|
226
|
+
key: getIntegrationKey(selectedIntegration),
|
|
221
227
|
multianswer: false,
|
|
222
228
|
});
|
|
223
229
|
console.log(chalk.hex('#4ade80')(` Canal asociado: ${label}`));
|
|
@@ -318,7 +324,7 @@ async function connectChannelFlow(ctx: WizardContext): Promise<AgentChannel[]> {
|
|
|
318
324
|
|
|
319
325
|
channels.push({
|
|
320
326
|
channel: CHANNEL_AGENT_MAP[channelType],
|
|
321
|
-
key: detected
|
|
327
|
+
key: getIntegrationKey(detected),
|
|
322
328
|
multianswer: false,
|
|
323
329
|
});
|
|
324
330
|
console.log(chalk.hex('#4ade80')(' Canal asociado correctamente.'));
|