fierce-daybreak-40159
10/11/2025, 12:04 AMastonishing-dream-61762
10/11/2025, 1:10 AMwhite-nest-40686
10/11/2025, 6:20 AMfierce-daybreak-40159
10/11/2025, 1:22 PMworkflow.phone = event.tags.conversation['whatsapp:userPhone'];
Then the condition / expression is
(
Array.isArray(workflow.lookup)
? workflow.lookup.length
: (
workflow.lookup && workflow.lookup.items
? workflow.lookup.items.length
: 0
)
) > 0
Then inside the if_exists the code is
// Use the row we already found
const r = workflow.lookup
const row = Array.isArray(r) ? r[0] : r?.items?.[0]
if (row) {
workflow.userRow = row
workflow.userId = row.id
workflow.userName = row.fields?.Name || null
workflow.NombreEmpresa = row.fields?.NombreEmpresa || null
workflow.TiempoEmpresa = row.fields?.TiempoEmpresa || null
// Cache to user scope for future conversations
if (workflow.userName) user.name = workflow.userName
if (workflow.NombreEmpresa) user.company = workflow.NombreEmpresa
if (workflow.TiempoEmpresa) user.yearsAtCompany = workflow.TiempoEmpresa
}
Sorry I'm new into this and coding is not my best
https://cdn.discordapp.com/attachments/1426359711216697465/1426560529077637150/image.png?ex=68ebab86&is=68ea5a06&hm=25fc35d933ccbc9d4b2518846f73d529cdbc17ac37fedc77b47711688fcb2056&
https://cdn.discordapp.com/attachments/1426359711216697465/1426560529379491941/Screenshot_2025-10-11_at_2.41.41_p.m..png?ex=68ebab86&is=68ea5a06&hm=9a1c90c4e16f24aeff0bc0e707f8961d35d7b2a6fcf00bc7ce2b8e0c20f8f5e7&
https://cdn.discordapp.com/attachments/1426359711216697465/1426560529643737170/image.png?ex=68ebab86&is=68ea5a06&hm=9f57c6a09837a6a3a5b020d681bd3c8d55ce95a3b8bb615926eb5141dc324571&white-nest-40686
10/11/2025, 4:21 PMuser.phone = event.tags.conversation['whatsapp:userPhone'].
- I would simplify the transition expression to: workflow.lookup && workflow.lookup.length > 0.
- I would store values only in user scope variables, as the user scope is visible throughout all the bot workflows.
ts
// Use the row we already found
const row = workflow.lookup[0]
user.userRow = row
user.userId = row.id
user.name = row.Name
user.company = row.NombreEmpresa
user.yearsAtCompany = row.TiempoEmpresa
- in text and in the single choice
Hola! {{user.name}} Bienvenido de vuelta!
Bienvenido {{user.name}} a Bistro 702,