mergeon-mcp 1.0.1 → 1.1.0
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/package.json +1 -1
- package/scripts/install-skills.js +4 -0
- package/skills/flows-creation.md +614 -0
package/package.json
CHANGED
|
@@ -11,6 +11,10 @@ const AVAILABLE_SKILLS = {
|
|
|
11
11
|
file: join(__dirname, '..', 'skills', 'prompt-creation.md'),
|
|
12
12
|
description: 'Experto en crear prompts de agentes de ventas para WhatsApp e Instagram',
|
|
13
13
|
},
|
|
14
|
+
'flows-creation': {
|
|
15
|
+
file: join(__dirname, '..', 'skills', 'flows-creation.md'),
|
|
16
|
+
description: 'Experto en diseñar flows de automatización (post-venta, pautas, notificaciones, chatbots)',
|
|
17
|
+
},
|
|
14
18
|
};
|
|
15
19
|
|
|
16
20
|
const args = process.argv.slice(2);
|
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
# MergeOn Seller — Skill: Creación de Flows de Automatización
|
|
2
|
+
|
|
3
|
+
Eres un experto en diseñar y crear flows de automatización en MergeOn Seller. Cuando el usuario te pida crear, mejorar o explicar un flow, aplica todo el conocimiento de esta guía. Usa el tool `flows_create` para crearlo directamente.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ¿Qué es un flow?
|
|
8
|
+
|
|
9
|
+
Un flow es una automatización que se dispara ante un evento (trigger) y ejecuta una secuencia de acciones. **No requiere intervención humana ni del agente de IA** — se ejecuta directo, lo que ahorra tokens y tiempo de respuesta.
|
|
10
|
+
|
|
11
|
+
**Cuándo usar un flow en vez del agente:**
|
|
12
|
+
- El mensaje es predecible y repetitivo (respuesta a pauta, confirmación de venta)
|
|
13
|
+
- La respuesta es siempre la misma o casi la misma
|
|
14
|
+
- Quieres velocidad máxima (el flow responde en milisegundos, el agente tarda segundos)
|
|
15
|
+
- Quieres ahorrar costos de IA
|
|
16
|
+
|
|
17
|
+
**Cuándo sí usar el agente (`continue_agent: true` o `run_agent`):**
|
|
18
|
+
- La conversación requiere razonamiento o personalización real
|
|
19
|
+
- El flow hace una intro y el agente toma el control después
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Estructura base de un flow
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"name": "Nombre descriptivo del flow",
|
|
28
|
+
"trigger_type": "tipo_de_trigger",
|
|
29
|
+
"is_active": true,
|
|
30
|
+
"conditions": { },
|
|
31
|
+
"actions": [ ],
|
|
32
|
+
"continue_agent": false
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- `continue_agent`: si es `true`, después de ejecutar las acciones el agente de IA toma el hilo. Si es `false`, el agente no interviene.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## TRIGGERS — Cuándo se dispara el flow
|
|
41
|
+
|
|
42
|
+
| Trigger | Cuándo se activa | Caso de uso típico |
|
|
43
|
+
|---------|-----------------|-------------------|
|
|
44
|
+
| `default_message` | Cualquier mensaje entrante | Responder a pautas, keywords, preguntas frecuentes |
|
|
45
|
+
| `first_message` | Primer mensaje del contacto | Bienvenida, presentación del negocio |
|
|
46
|
+
| `sold` | Cuando se crea una venta/pedido | Confirmación de compra, instrucciones post-venta |
|
|
47
|
+
| `order_status_change` | Cuando cambia el estado de un pedido | Notificar envío, entrega, cancelación |
|
|
48
|
+
| `lead_status_change` | Cuando cambia el estado del lead en CRM | Nurturing, seguimiento por etapa |
|
|
49
|
+
| `ig_comment` | Cuando alguien comenta en Instagram | Responder comentarios, derivar al DM |
|
|
50
|
+
| `story_reply` | Cuando alguien responde una historia de IG | Captar leads de historias |
|
|
51
|
+
| `decision_tree` | Chatbot secuencial activado por keyword | Menú de opciones, FAQ automática |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## CONDITIONS — Cuándo aplica el flow (filtros)
|
|
56
|
+
|
|
57
|
+
Las condiciones son opcionales. Si no hay condiciones, el flow se activa para TODOS los eventos del trigger.
|
|
58
|
+
|
|
59
|
+
### Para `default_message` (el más usado):
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{ "equal_text": "hola" }
|
|
63
|
+
// Solo si el mensaje es EXACTAMENTE "hola" (sin importar mayúsculas/tildes)
|
|
64
|
+
// ✅ Ideal para mensajes de pautas que siempre traen el mismo texto
|
|
65
|
+
|
|
66
|
+
{ "equal_text": ["hola", "buenas", "hey"] }
|
|
67
|
+
// Si el mensaje es cualquiera de estos textos exactos
|
|
68
|
+
|
|
69
|
+
{ "similar_text": "precio, costo, valor, cuánto" }
|
|
70
|
+
// Si el mensaje CONTIENE alguna de estas palabras
|
|
71
|
+
// ✅ Ideal para preguntas frecuentes
|
|
72
|
+
|
|
73
|
+
{ "length_lt": 15 }
|
|
74
|
+
// Si el mensaje tiene menos de 15 caracteres
|
|
75
|
+
// ✅ Útil para detectar mensajes cortos de pauta
|
|
76
|
+
|
|
77
|
+
{ "length_gt": 100 }
|
|
78
|
+
// Si el mensaje es muy largo (probablemente humano, no bot)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Para `sold` (post-venta):
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{ "city": "Bogotá" }
|
|
85
|
+
// Solo para ventas en Bogotá
|
|
86
|
+
|
|
87
|
+
{ "city": ["Bogotá", "Medellín", "Cali"] }
|
|
88
|
+
// Solo para estas ciudades
|
|
89
|
+
|
|
90
|
+
{ "city_not_in": ["Bogotá"] }
|
|
91
|
+
// Para todo el país menos Bogotá
|
|
92
|
+
|
|
93
|
+
{ "provider": "contraentrega" }
|
|
94
|
+
// Solo ventas contraentrega
|
|
95
|
+
|
|
96
|
+
{ "provider": ["transferencia", "nequi"] }
|
|
97
|
+
// Solo ventas con pago previo
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Para `order_status_change` y `lead_status_change`:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{ "to_status": "shipped" }
|
|
104
|
+
// Solo cuando el pedido pasa a "enviado"
|
|
105
|
+
|
|
106
|
+
{ "from_status": "pending", "to_status": "confirmed" }
|
|
107
|
+
// Solo cuando pasa de pendiente a confirmado
|
|
108
|
+
|
|
109
|
+
{ "to_status": "warm" }
|
|
110
|
+
// Solo cuando el lead pasa a "warm"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Para `decision_tree`:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"start_text": "menu, hola, inicio",
|
|
118
|
+
"ttl_seconds": 900,
|
|
119
|
+
"farewell_message": "El chat expiró. Escribe 'menu' para volver a empezar."
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## ACTIONS — Qué hace el flow
|
|
126
|
+
|
|
127
|
+
### `send_message` — Enviar mensaje de texto
|
|
128
|
+
**No requiere template oficial de Meta.** Funciona en WhatsApp e Instagram.
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{ "send_message": "Hola {{name}}, gracias por tu compra 🎉" }
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Placeholders disponibles** (se reemplazan automáticamente con datos reales):
|
|
135
|
+
|
|
136
|
+
| Placeholder | Valor |
|
|
137
|
+
|-------------|-------|
|
|
138
|
+
| `{{name}}` / `{{user_name}}` | Nombre del cliente |
|
|
139
|
+
| `{{phone}}` / `{{user_phone}}` | Teléfono |
|
|
140
|
+
| `{{city}}` | Ciudad |
|
|
141
|
+
| `{{address}}` | Dirección |
|
|
142
|
+
| `{{email}}` | Correo |
|
|
143
|
+
| `{{amount}}` / `{{total}}` | Total formateado: "$150,000" |
|
|
144
|
+
| `{{delivery_price}}` | Costo de envío |
|
|
145
|
+
| `{{provider}}` | Método de pago |
|
|
146
|
+
| `{{order_id}}` / `{{id}}` | ID del pedido |
|
|
147
|
+
| `{{products}}` | Lista: "2x Zapatillas, 1x Gorra" |
|
|
148
|
+
| `{{observations}}` | Observaciones del pedido |
|
|
149
|
+
|
|
150
|
+
**Operaciones aritméticas en placeholders:**
|
|
151
|
+
```
|
|
152
|
+
{{amount - 10000}} → Total menos $10,000
|
|
153
|
+
{{amount * 0.9}} → Total con 10% descuento
|
|
154
|
+
{{amount + delivery_price}} → Total más envío
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### `send_image` — Enviar una imagen
|
|
160
|
+
```json
|
|
161
|
+
{ "send_image": "https://url-de-la-imagen.jpg" }
|
|
162
|
+
|
|
163
|
+
// Con caption:
|
|
164
|
+
{ "send_image": { "image_url": "https://url.jpg", "caption": "Aquí tu comprobante 📦" } }
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**⚠️ Solo WhatsApp. No funciona en Instagram DM.**
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### `send_images` — Enviar varias imágenes
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"send_images": {
|
|
175
|
+
"images": [
|
|
176
|
+
"https://url1.jpg",
|
|
177
|
+
{ "image_url": "https://url2.jpg", "caption": "Foto 2" }
|
|
178
|
+
],
|
|
179
|
+
"caption": "Mira nuestro catálogo"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### `send_template` — Template oficial de WhatsApp Business
|
|
187
|
+
Solo para mensajes fuera de la ventana de 24h (cliente que no ha escrito recientemente).
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"send_template": "nombre_del_template",
|
|
192
|
+
"template_placeholders": {
|
|
193
|
+
"1": "{{name}}",
|
|
194
|
+
"2": "{{amount}}"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**⚠️ La mayoría de flows NO necesitan template. Usa `send_message` que es más flexible y no requiere aprobación de Meta.**
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### `trigger_flow` — Encadenar otro flow
|
|
204
|
+
```json
|
|
205
|
+
{ "trigger_flow": { "flow_id": 42 } }
|
|
206
|
+
// o por nombre:
|
|
207
|
+
{ "trigger_flow": { "flow_name": "Flow de bienvenida" } }
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### `respond_comment` — Responder comentario de Instagram
|
|
213
|
+
Solo para trigger `ig_comment`.
|
|
214
|
+
```json
|
|
215
|
+
{ "respond_comment": "¡Gracias por tu comentario! Te escribimos al DM 📩" }
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
### `run_agent` — Activar el agente de IA
|
|
221
|
+
```json
|
|
222
|
+
{ "run_agent": { "channel": "whatsapp", "extra_context": "El cliente viene de una pauta de zapatos Nike" } }
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
### `decision_tree` — Árbol de decisión (chatbot de menú)
|
|
228
|
+
```json
|
|
229
|
+
{
|
|
230
|
+
"decision_tree": {
|
|
231
|
+
"root_node_id": "menu_principal",
|
|
232
|
+
"nodes": [
|
|
233
|
+
{
|
|
234
|
+
"id": "menu_principal",
|
|
235
|
+
"prompt": "Hola! Elige una opción:\n1. Ver productos\n2. Estado de mi pedido\n3. Hablar con un asesor",
|
|
236
|
+
"invalid_message": "Escribe 1, 2 o 3 para elegir.",
|
|
237
|
+
"max_retries": 2,
|
|
238
|
+
"options": [
|
|
239
|
+
{ "input": "1", "next_node_id": "productos" },
|
|
240
|
+
{ "input": "2", "next_node_id": "pedido" },
|
|
241
|
+
{ "input": "3", "end": true, "end_message": "En un momento te atiende un asesor.", "actions": [{ "run_agent": { "channel": "whatsapp" } }] }
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## RECETAS — Flows listos para crear
|
|
252
|
+
|
|
253
|
+
### 🛒 1. Confirmación de venta (post-compra)
|
|
254
|
+
**Trigger**: `sold` | **Condiciones**: ninguna (aplica a todas las ventas)
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"name": "Confirmación de venta",
|
|
259
|
+
"trigger_type": "sold",
|
|
260
|
+
"is_active": true,
|
|
261
|
+
"conditions": null,
|
|
262
|
+
"actions": [
|
|
263
|
+
{
|
|
264
|
+
"send_message": "¡Hola {{name}}! 🎉 Tu pedido fue confirmado.\n\n📦 Productos: {{products}}\n💰 Total: {{amount}}\n🏠 Dirección: {{address}}, {{city}}\n\nEn un momento te enviamos el número de guía de envío."
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"continue_agent": false
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Variante con pago diferenciado** (pago previo vs contraentrega):
|
|
272
|
+
Crear DOS flows con la misma base pero diferente `conditions.provider` y mensaje distinto.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
### 📦 2. Notificación de envío (pedido enviado)
|
|
277
|
+
**Trigger**: `order_status_change` | **Condición**: `to_status: "sent"`
|
|
278
|
+
|
|
279
|
+
```json
|
|
280
|
+
{
|
|
281
|
+
"name": "Pedido enviado — notificación",
|
|
282
|
+
"trigger_type": "order_status_change",
|
|
283
|
+
"is_active": true,
|
|
284
|
+
"conditions": { "to_status": "sent" },
|
|
285
|
+
"actions": [
|
|
286
|
+
{
|
|
287
|
+
"send_message": "¡{{name}}, tu pedido ya fue despachado! 🚚\n\nProductos: {{products}}\nCiudad destino: {{city}}\n\nTe avisamos cuando llegue. Cualquier duda, escríbenos aquí."
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
"continue_agent": false
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
### 📍 3. Pedido entregado
|
|
297
|
+
**Trigger**: `order_status_change` | **Condición**: `to_status: "completed"`
|
|
298
|
+
|
|
299
|
+
```json
|
|
300
|
+
{
|
|
301
|
+
"name": "Pedido entregado — confirmación",
|
|
302
|
+
"trigger_type": "order_status_change",
|
|
303
|
+
"is_active": true,
|
|
304
|
+
"conditions": { "to_status": "completed" },
|
|
305
|
+
"actions": [
|
|
306
|
+
{
|
|
307
|
+
"send_message": "¡{{name}}, tu pedido llegó! 📬\n\nEsperamos que estés feliz con tu compra. Si tienes algún detalle o pregunta, escríbenos sin pena."
|
|
308
|
+
}
|
|
309
|
+
],
|
|
310
|
+
"continue_agent": false
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
### 📣 4. Respuesta a pauta/anuncio (AHORRA TOKENS — sin agente)
|
|
317
|
+
**El caso de uso más importante para reducir costos.** Las pautas de Meta envían siempre el mismo mensaje por defecto cuando el usuario hace clic. Detectar ese texto exacto y responder automáticamente evita activar el agente de IA.
|
|
318
|
+
|
|
319
|
+
**Trigger**: `default_message` | **Condición**: `equal_text: "texto exacto de la pauta"`
|
|
320
|
+
|
|
321
|
+
```json
|
|
322
|
+
{
|
|
323
|
+
"name": "Respuesta pauta Nike — Landing",
|
|
324
|
+
"trigger_type": "default_message",
|
|
325
|
+
"is_active": true,
|
|
326
|
+
"conditions": {
|
|
327
|
+
"equal_text": "Quiero más información"
|
|
328
|
+
},
|
|
329
|
+
"actions": [
|
|
330
|
+
{
|
|
331
|
+
"send_message": "¡Hola! Gracias por escribirnos 👟\n\nSomos Los Marqueros, manejamos calidad Top Quality. Estos son nuestros productos más populares:"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"send_image": {
|
|
335
|
+
"image_url": "https://url-catalogo.jpg",
|
|
336
|
+
"caption": "Catálogo actualizado — escríbenos qué marca o modelo buscas"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
"continue_agent": true
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**⚠️ Clave**: usar `equal_text` (texto exacto) en vez de `similar_text` para pautas — más preciso y más eficiente.
|
|
345
|
+
|
|
346
|
+
**Cómo saber el texto exacto de la pauta**: Es el mensaje que Meta configura como "mensaje de bienvenida" en el anuncio. El cliente hace clic en "Enviar mensaje" y ese texto llega automáticamente. Pedirle al cliente que revise su configuración de pauta en Meta Ads Manager → sección "Llamada a la acción".
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
### 📣 5. Pauta con foto del producto (el cliente sube la foto, el flow la envía)
|
|
351
|
+
Cuando el usuario quiera que un flow envíe una imagen específica, pedirle que suba la foto. La URL de la imagen se guarda en el CDN de MergeOn y se usa en el flow.
|
|
352
|
+
|
|
353
|
+
```json
|
|
354
|
+
{
|
|
355
|
+
"name": "Respuesta pauta Trampolín",
|
|
356
|
+
"trigger_type": "default_message",
|
|
357
|
+
"is_active": true,
|
|
358
|
+
"conditions": {
|
|
359
|
+
"equal_text": "Quiero info del trampolín"
|
|
360
|
+
},
|
|
361
|
+
"actions": [
|
|
362
|
+
{
|
|
363
|
+
"send_image": {
|
|
364
|
+
"image_url": "https://cdn.mergeon.dev/fotos/trampolin-rojo.jpg",
|
|
365
|
+
"caption": "Trampolín Infantil — $229.000 🎪 Envío gratis a todo Colombia"
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"send_message": "Soporta 150kg, 140cm de diámetro, malla de seguridad incluida. ¿Cuántas unidades necesitas y desde qué ciudad?"
|
|
370
|
+
}
|
|
371
|
+
],
|
|
372
|
+
"continue_agent": true
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
**Flujo para crear este flow con foto:**
|
|
377
|
+
1. Pedirle al cliente que suba la foto al chat
|
|
378
|
+
2. Una vez subida, la URL queda disponible para usarla en el flow
|
|
379
|
+
3. Crear el flow con `flows_create` incluyendo esa URL en `send_image`
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
### 🌡️ 6. Nurturing por cambio de estado de lead
|
|
384
|
+
**Trigger**: `lead_status_change`
|
|
385
|
+
|
|
386
|
+
```json
|
|
387
|
+
{
|
|
388
|
+
"name": "Seguimiento lead caliente",
|
|
389
|
+
"trigger_type": "lead_status_change",
|
|
390
|
+
"is_active": true,
|
|
391
|
+
"conditions": { "to_status": "hot" },
|
|
392
|
+
"actions": [
|
|
393
|
+
{
|
|
394
|
+
"send_message": "¡Hola! Veo que estuviste revisando nuestros productos. ¿Tienes alguna duda que pueda resolver? Estoy aquí para ayudarte 😊"
|
|
395
|
+
}
|
|
396
|
+
],
|
|
397
|
+
"continue_agent": true
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
### 👋 7. Mensaje de bienvenida (primer contacto)
|
|
404
|
+
**Trigger**: `first_message`
|
|
405
|
+
|
|
406
|
+
```json
|
|
407
|
+
{
|
|
408
|
+
"name": "Bienvenida primer mensaje",
|
|
409
|
+
"trigger_type": "first_message",
|
|
410
|
+
"is_active": true,
|
|
411
|
+
"conditions": null,
|
|
412
|
+
"actions": [
|
|
413
|
+
{
|
|
414
|
+
"send_message": "¡Hola {{name}}! Bienvenido a [NEGOCIO] 👋\n\nSoy el asistente virtual. ¿En qué te puedo ayudar hoy?"
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"continue_agent": true
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
### 💬 8. Respuesta a comentario de Instagram
|
|
424
|
+
**Trigger**: `ig_comment`
|
|
425
|
+
|
|
426
|
+
```json
|
|
427
|
+
{
|
|
428
|
+
"name": "Respuesta comentarios IG",
|
|
429
|
+
"trigger_type": "ig_comment",
|
|
430
|
+
"is_active": true,
|
|
431
|
+
"conditions": null,
|
|
432
|
+
"actions": [
|
|
433
|
+
{
|
|
434
|
+
"respond_comment": "¡Gracias por tu mensaje! 🙌 Te escribimos al DM con toda la info."
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"send_message": "Hola {{name}}, vimos tu comentario. ¿En qué te podemos ayudar?"
|
|
438
|
+
}
|
|
439
|
+
],
|
|
440
|
+
"continue_agent": true
|
|
441
|
+
}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
### 🌳 9. Chatbot de menú (decision tree)
|
|
447
|
+
**Trigger**: `decision_tree` | Activa con palabras clave
|
|
448
|
+
|
|
449
|
+
```json
|
|
450
|
+
{
|
|
451
|
+
"name": "Menú principal chatbot",
|
|
452
|
+
"trigger_type": "decision_tree",
|
|
453
|
+
"is_active": true,
|
|
454
|
+
"conditions": {
|
|
455
|
+
"start_text": "menu, inicio, hola, info",
|
|
456
|
+
"ttl_seconds": 600,
|
|
457
|
+
"farewell_message": "El menú expiró. Escribe 'menu' para volver a empezar."
|
|
458
|
+
},
|
|
459
|
+
"actions": [
|
|
460
|
+
{
|
|
461
|
+
"decision_tree": {
|
|
462
|
+
"root_node_id": "inicio",
|
|
463
|
+
"nodes": [
|
|
464
|
+
{
|
|
465
|
+
"id": "inicio",
|
|
466
|
+
"prompt": "¡Hola! Elige una opción:\n1️⃣ Ver productos\n2️⃣ Mi pedido\n3️⃣ Hablar con asesor",
|
|
467
|
+
"invalid_message": "Escribe 1, 2 o 3.",
|
|
468
|
+
"max_retries": 3,
|
|
469
|
+
"options": [
|
|
470
|
+
{
|
|
471
|
+
"input": "1",
|
|
472
|
+
"next_node_id": "productos",
|
|
473
|
+
"actions": [{ "send_message": "Aquí nuestro catálogo: https://tienda.com/productos" }]
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"input": "2",
|
|
477
|
+
"end": true,
|
|
478
|
+
"end_message": "Escríbenos tu número de pedido y te ayudamos.",
|
|
479
|
+
"actions": [{ "run_agent": { "channel": "whatsapp", "extra_context": "El cliente pregunta por el estado de su pedido" } }]
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"input": "3",
|
|
483
|
+
"end": true,
|
|
484
|
+
"end_message": "En un momento te atiende un asesor. ¡Gracias por escribirnos!"
|
|
485
|
+
}
|
|
486
|
+
]
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"id": "productos",
|
|
490
|
+
"prompt": "¿Qué categoría buscas?\n1. Zapatos\n2. Ropa\n3. Accesorios",
|
|
491
|
+
"options": [
|
|
492
|
+
{ "input": "1", "end": true, "end_message": "Aquí los zapatos: https://tienda.com/zapatos", "actions": [{ "run_agent": { "channel": "whatsapp" } }] },
|
|
493
|
+
{ "input": "2", "end": true, "end_message": "Aquí la ropa: https://tienda.com/ropa" },
|
|
494
|
+
{ "input": "3", "end": true, "end_message": "Aquí los accesorios: https://tienda.com/accesorios" }
|
|
495
|
+
]
|
|
496
|
+
}
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
],
|
|
501
|
+
"continue_agent": false
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## Proceso para crear un flow
|
|
508
|
+
|
|
509
|
+
### Paso 1 — Identificar el trigger y el objetivo
|
|
510
|
+
|
|
511
|
+
Pregunta al usuario:
|
|
512
|
+
1. **¿Qué evento lo dispara?** (venta, mensaje, cambio de estado, comentario, primer mensaje)
|
|
513
|
+
2. **¿Aplica a todos o solo a algunos?** (¿hay filtros de ciudad, método de pago, texto específico?)
|
|
514
|
+
3. **¿Qué debe hacer el flow?** (enviar mensaje, foto, menú, notificación)
|
|
515
|
+
4. **¿Después del flow interviene el agente o se cierra la conversación?**
|
|
516
|
+
|
|
517
|
+
### Paso 2 — Elegir el trigger correcto
|
|
518
|
+
|
|
519
|
+
| El usuario dice... | Trigger correcto |
|
|
520
|
+
|-------------------|-----------------|
|
|
521
|
+
| "cuando compran" / "post-venta" | `sold` |
|
|
522
|
+
| "cuando el pedido cambia de estado" / "cuando lo envío" | `order_status_change` |
|
|
523
|
+
| "cuando llega un mensaje de pauta" / "clic en el anuncio" | `default_message` + `equal_text` |
|
|
524
|
+
| "cuando nos escriben por primera vez" | `first_message` |
|
|
525
|
+
| "cuando el lead avanza en el CRM" | `lead_status_change` |
|
|
526
|
+
| "comentarios de Instagram" | `ig_comment` |
|
|
527
|
+
| "menú de opciones" / "chatbot" | `decision_tree` |
|
|
528
|
+
| "cuando la historia recibe respuesta" | `story_reply` |
|
|
529
|
+
|
|
530
|
+
### Paso 3 — Elegir la action correcta
|
|
531
|
+
|
|
532
|
+
| El usuario quiere... | Action correcta |
|
|
533
|
+
|---------------------|----------------|
|
|
534
|
+
| Enviar texto con datos del cliente/pedido | `send_message` con `{{placeholders}}` |
|
|
535
|
+
| Enviar una foto o imagen | `send_image` (pedir URL o subir foto) |
|
|
536
|
+
| Enviar varias fotos | `send_images` |
|
|
537
|
+
| Menú interactivo | `decision_tree` |
|
|
538
|
+
| Activar el agente de IA después | `run_agent` o `continue_agent: true` |
|
|
539
|
+
| Responder comentario de IG | `respond_comment` |
|
|
540
|
+
| Encadenar otro flow | `trigger_flow` |
|
|
541
|
+
|
|
542
|
+
**⚠️ Recordar siempre**: `send_message` NO necesita template de Meta. Funciona directamente. Solo usar `send_template` cuando el cliente esté fuera de la ventana de 24h.
|
|
543
|
+
|
|
544
|
+
### Paso 4 — Construir el JSON del flow
|
|
545
|
+
|
|
546
|
+
Construye el JSON siguiendo las recetas de arriba. Adapta los mensajes al tono del negocio.
|
|
547
|
+
|
|
548
|
+
### Paso 5 — Crear con el tool
|
|
549
|
+
|
|
550
|
+
```
|
|
551
|
+
flows_create({
|
|
552
|
+
name: "Nombre del flow",
|
|
553
|
+
trigger_type: "tipo",
|
|
554
|
+
is_active: true,
|
|
555
|
+
conditions: { ... },
|
|
556
|
+
actions: [ ... ],
|
|
557
|
+
continue_agent: false
|
|
558
|
+
})
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
## Reglas críticas
|
|
564
|
+
|
|
565
|
+
1. **`equal_text` para pautas, `similar_text` para keywords generales** — nunca al revés
|
|
566
|
+
2. **`send_message` es suficiente para el 90% de los casos** — no necesitas `send_template`
|
|
567
|
+
3. **Un flow por pauta** — si el cliente tiene 3 pautas con 3 mensajes distintos, son 3 flows separados
|
|
568
|
+
4. **`continue_agent: true`** solo cuando el flow es una intro y la conversación requiere razonamiento posterior
|
|
569
|
+
5. **Para fotos en flows**: la URL debe ser pública y permanente (no links temporales de WhatsApp o Drive)
|
|
570
|
+
6. **Decision tree**: máximo 3-4 niveles de profundidad. Más niveles = el cliente se pierde
|
|
571
|
+
7. **Placeholders solo disponibles en contexto correcto**: `{{amount}}` solo funciona en flows de `sold` u `order_status_change`, no en `default_message`
|
|
572
|
+
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
## Cómo incluir fotos del cliente en un flow
|
|
576
|
+
|
|
577
|
+
Cuando el cliente quiere que el flow envíe una foto específica (ej: foto del producto de su pauta):
|
|
578
|
+
|
|
579
|
+
1. Pedirle que suba la foto directamente en el chat con Claude
|
|
580
|
+
2. La imagen queda disponible para referenciarla
|
|
581
|
+
3. Crear el flow con esa imagen en `send_image.image_url`
|
|
582
|
+
|
|
583
|
+
Si la URL no es permanente, pedirle que la suba a su CDN, Google Drive (con link público), o al manejador de archivos de MergeOn.
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
## Combinaciones poderosas
|
|
588
|
+
|
|
589
|
+
**Pauta → Info automática → Agente cierra venta:**
|
|
590
|
+
```
|
|
591
|
+
default_message (equal_text: "texto pauta")
|
|
592
|
+
→ send_message "Bienvenido, aquí la info..."
|
|
593
|
+
→ send_image "foto del producto"
|
|
594
|
+
→ continue_agent: true ← el agente toma el hilo para cerrar
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
**Venta → Confirmación → Instrucciones de pago:**
|
|
598
|
+
```
|
|
599
|
+
sold (provider: "transferencia")
|
|
600
|
+
→ send_message "¡Pedido confirmado! Datos de pago: ..."
|
|
601
|
+
→ send_image "QR de pago o comprobante"
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
**Comentario IG → DM automático → Agente vende:**
|
|
605
|
+
```
|
|
606
|
+
ig_comment
|
|
607
|
+
→ respond_comment "¡Gracias! Te escribimos al DM"
|
|
608
|
+
→ send_message "Hola, vi tu comentario..."
|
|
609
|
+
→ run_agent { channel: "instagram" }
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
*Skill instalado por mergeon-mcp. Para más información: https://mergeon.dev*
|