Componentes, propiedades y la accion complete confirmados contra los docs oficiales. Lo unico sin confirmar es el numero de version: las paginas del changelog no estaban accesibles. Queda anotado que hacer si el editor la rechaza. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
270 lines
11 KiB
Plaintext
270 lines
11 KiB
Plaintext
================================================================================
|
|
CREAR FLOWS DE WHATSAPP — PALMAS360
|
|
Instrucciones para el administrador de Meta Business
|
|
================================================================================
|
|
|
|
|
|
CONFIGURACION COMUN
|
|
--------------------------------------------------------------------------------
|
|
|
|
WhatsApp Manager -> cuenta de WhatsApp Business -> Flows -> Crear flujo
|
|
|
|
Para los dos flujos:
|
|
|
|
Categoria .......... Otro / Personalizado
|
|
Endpoint ........... DEJAR VACIO
|
|
Plantilla .......... desde cero (JSON)
|
|
|
|
El endpoint vacio es lo importante. Si se configura uno, Meta exige cifrado y
|
|
clave publica, y no hace falta: el bot manda los datos al abrir el formulario y
|
|
recibe todo al cerrarlo.
|
|
|
|
|
|
CUAL PRIMERO
|
|
--------------------------------------------------------------------------------
|
|
|
|
Ciclos. Es una sola pantalla, sin ranuras ni maximos que definir, y ataca el
|
|
paso mas molesto del bot actual: elegir varios lotes hoy son seis mensajes de
|
|
ida y vuelta.
|
|
|
|
|
|
================================================================================
|
|
FLOW 1 — CICLOS
|
|
Nombre: Ciclos
|
|
================================================================================
|
|
|
|
Un solo Flow cubre las doce combinaciones (seis tipos de ciclo x abrir/cerrar),
|
|
porque el titulo y la lista de lotes los manda el bot en cada envio.
|
|
|
|
Sin maximos que definir: el CheckboxGroup es un solo componente cuya lista de
|
|
opciones viene de los datos, asi que da igual si la finca tiene 5 lotes o 40.
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
{
|
|
"version": "7.0",
|
|
"screens": [
|
|
{
|
|
"id": "CICLOS",
|
|
"title": "Ciclos de lotes",
|
|
"terminal": true,
|
|
"data": {
|
|
"titulo": { "type": "string", "__example__": "Abrir ciclos — Cosecha" },
|
|
"fecha": { "type": "string", "__example__": "2026-08-04" },
|
|
"lotes": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": { "type": "string" },
|
|
"title": { "type": "string" }
|
|
}
|
|
},
|
|
"__example__": [
|
|
{ "id": "4", "title": "REPOSO 1A" },
|
|
{ "id": "7", "title": "REPOSO 1B" },
|
|
{ "id": "9", "title": "REPOSO 2A" }
|
|
]
|
|
}
|
|
},
|
|
"layout": {
|
|
"type": "SingleColumnLayout",
|
|
"children": [
|
|
{ "type": "TextHeading", "text": "${data.titulo}" },
|
|
{
|
|
"type": "Form",
|
|
"name": "form_ciclos",
|
|
"children": [
|
|
{
|
|
"type": "DatePicker",
|
|
"name": "fecha",
|
|
"label": "Fecha",
|
|
"required": true,
|
|
"init-value": "${data.fecha}"
|
|
},
|
|
{
|
|
"type": "CheckboxGroup",
|
|
"name": "lotes",
|
|
"label": "Lotes",
|
|
"required": true,
|
|
"data-source": "${data.lotes}"
|
|
},
|
|
{
|
|
"type": "Footer",
|
|
"label": "Enviar",
|
|
"on-click-action": {
|
|
"name": "complete",
|
|
"payload": {
|
|
"fecha": "${form.fecha}",
|
|
"lotes": "${form.lotes}"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
|
|
================================================================================
|
|
FLOW 2 — PLUVIOMETRIA
|
|
Nombre: Pluviometria
|
|
================================================================================
|
|
|
|
Aca si hay un maximo, y es por una razon tecnica: cada finca lleva un valor
|
|
distinto, asi que necesita su propio campo. Hay ocho ranuras y el bot muestra
|
|
solo las que existen; las demas quedan ocultas.
|
|
|
|
Si alguna empresa llegara a tener mas de ocho fincas, hay que republicar el
|
|
Flow con mas ranuras. CONFIRMAR EL MAXIMO ANTES DE PUBLICAR.
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
{
|
|
"version": "7.0",
|
|
"screens": [
|
|
{
|
|
"id": "PLUVIOMETRIA",
|
|
"title": "Registrar pluviometría",
|
|
"terminal": true,
|
|
"data": {
|
|
"fecha": { "type": "string", "__example__": "2026-08-04" },
|
|
"finca_1_label": { "type": "string", "__example__": "REPOSO" },
|
|
"finca_1_visible": { "type": "boolean", "__example__": true },
|
|
"finca_2_label": { "type": "string", "__example__": "ROSA BLANCA" },
|
|
"finca_2_visible": { "type": "boolean", "__example__": true },
|
|
"finca_3_label": { "type": "string", "__example__": "" },
|
|
"finca_3_visible": { "type": "boolean", "__example__": false },
|
|
"finca_4_label": { "type": "string", "__example__": "" },
|
|
"finca_4_visible": { "type": "boolean", "__example__": false },
|
|
"finca_5_label": { "type": "string", "__example__": "" },
|
|
"finca_5_visible": { "type": "boolean", "__example__": false },
|
|
"finca_6_label": { "type": "string", "__example__": "" },
|
|
"finca_6_visible": { "type": "boolean", "__example__": false },
|
|
"finca_7_label": { "type": "string", "__example__": "" },
|
|
"finca_7_visible": { "type": "boolean", "__example__": false },
|
|
"finca_8_label": { "type": "string", "__example__": "" },
|
|
"finca_8_visible": { "type": "boolean", "__example__": false }
|
|
},
|
|
"layout": {
|
|
"type": "SingleColumnLayout",
|
|
"children": [
|
|
{ "type": "TextBody", "text": "Milímetros de lluvia registrados por finca." },
|
|
{
|
|
"type": "Form",
|
|
"name": "form_pluvio",
|
|
"children": [
|
|
{ "type": "DatePicker", "name": "fecha", "label": "Fecha", "required": true, "init-value": "${data.fecha}" },
|
|
|
|
{ "type": "TextInput", "name": "finca_1", "label": "${data.finca_1_label}", "input-type": "number", "visible": "${data.finca_1_visible}" },
|
|
{ "type": "TextInput", "name": "finca_2", "label": "${data.finca_2_label}", "input-type": "number", "visible": "${data.finca_2_visible}" },
|
|
{ "type": "TextInput", "name": "finca_3", "label": "${data.finca_3_label}", "input-type": "number", "visible": "${data.finca_3_visible}" },
|
|
{ "type": "TextInput", "name": "finca_4", "label": "${data.finca_4_label}", "input-type": "number", "visible": "${data.finca_4_visible}" },
|
|
{ "type": "TextInput", "name": "finca_5", "label": "${data.finca_5_label}", "input-type": "number", "visible": "${data.finca_5_visible}" },
|
|
{ "type": "TextInput", "name": "finca_6", "label": "${data.finca_6_label}", "input-type": "number", "visible": "${data.finca_6_visible}" },
|
|
{ "type": "TextInput", "name": "finca_7", "label": "${data.finca_7_label}", "input-type": "number", "visible": "${data.finca_7_visible}" },
|
|
{ "type": "TextInput", "name": "finca_8", "label": "${data.finca_8_label}", "input-type": "number", "visible": "${data.finca_8_visible}" },
|
|
|
|
{
|
|
"type": "Footer",
|
|
"label": "Enviar",
|
|
"on-click-action": {
|
|
"name": "complete",
|
|
"payload": {
|
|
"fecha": "${form.fecha}",
|
|
"finca_1": "${form.finca_1}",
|
|
"finca_2": "${form.finca_2}",
|
|
"finca_3": "${form.finca_3}",
|
|
"finca_4": "${form.finca_4}",
|
|
"finca_5": "${form.finca_5}",
|
|
"finca_6": "${form.finca_6}",
|
|
"finca_7": "${form.finca_7}",
|
|
"finca_8": "${form.finca_8}"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
|
|
================================================================================
|
|
PUBLICAR
|
|
================================================================================
|
|
|
|
Guardar -> Publicar.
|
|
|
|
Despues de publicado la estructura no se edita: los cambios son una version
|
|
nueva. Por eso conviene definir las ranuras de pluviometria de una vez.
|
|
|
|
|
|
================================================================================
|
|
QUE SE NECESITA DE VUELTA
|
|
================================================================================
|
|
|
|
Los dos Flow ID. Son numeros largos que aparecen en la lista de flujos o en la
|
|
URL al abrirlos. Es lo unico que falta para conectarlos desde el bot.
|
|
|
|
Ciclos ............. _______________________
|
|
Pluviometria ....... _______________________
|
|
|
|
|
|
================================================================================
|
|
ANTES DE PUBLICAR — DOS VERIFICACIONES
|
|
================================================================================
|
|
|
|
1. VERSION DEL JSON <-- LO UNICO SIN CONFIRMAR
|
|
|
|
Esta puesta "7.0" en los dos JSON, pero NO pude confirmar que esa version
|
|
exista: las paginas del changelog de Meta no estaban accesibles.
|
|
|
|
Lo que si esta documentado es que la 6.1 existe (es la que introdujo el
|
|
componente CalendarPicker).
|
|
|
|
QUE HACER: el editor de Flows muestra las versiones disponibles al pegar el
|
|
JSON. Poner la mas reciente que ofrezca. Si rechaza la 7.0, bajar a 6.1.
|
|
|
|
Ninguno de los dos Flows usa componentes nuevos, asi que funcionan igual con
|
|
una version anterior.
|
|
|
|
El resto del JSON SI esta verificado contra la documentacion oficial:
|
|
- DatePicker con init-value en formato YYYY-MM-DD (v5.0+)
|
|
- CheckboxGroup con "data-source" y opciones {id, title}
|
|
- TextInput con input-type "number"
|
|
- "visible" es propiedad valida en los componentes
|
|
- Footer con "label" y "on-click-action"
|
|
- accion "complete" con "payload" — sintaxis identica a la documentada
|
|
- "terminal": true requiere un Footer en la pantalla
|
|
|
|
2. MAXIMO DE FINCAS (solo pluviometria)
|
|
Hay ocho ranuras. Confirmar que ninguna empresa vaya a superar ese numero,
|
|
porque cambiarlo despues obliga a republicar el Flow.
|
|
Ciclos no tiene este problema.
|
|
|
|
|
|
================================================================================
|
|
NOTAS TECNICAS (para quien conecte el bot)
|
|
================================================================================
|
|
|
|
- Los valores __example__ son solo para la vista previa del editor. Los reales
|
|
los siembra el bot en flow_action_payload.data al enviar el mensaje.
|
|
|
|
- Ambos Flows usan flow_action "navigate" (sin endpoint). La respuesta llega al
|
|
webhook como mensaje interactive de tipo nfm_reply, con el contenido en
|
|
response_json.
|
|
|
|
- En Ciclos, el bot resuelve antes en chat el tipo de ciclo y la accion
|
|
(apertura/cierre), porque eso determina que lotes sembrar: apertura ofrece
|
|
todos los lotes de la finca, cierre solo los que estan abiertos.
|
|
|
|
- Falta construir del lado del bot: envio de mensajes tipo flow en
|
|
WhatsAppSender, recepcion de nfm_reply en WpWebhook, y un tipo de flujo que
|
|
siembre los datos y arme el POST.
|