Pular para o conteúdo principal

Set ViewBag

Contacts

Set ViewBag

Sets a key-value pair in the contact's ViewBag

Node typecontact.setViewBag
CategoriaContacts
Setups obrigatoriosNenhum

Painel de configuracao

Esta visualizacao usa o frontend real do ConfigPanel em modo embed, carregando um no de exemplo com o JSON base desta documentacao.

Preview real do painel

Nao foi possivel carregar o painel embedado automaticamente.

JSON base do node
{
  "_nodeType": "contact.setViewBag",
  "contactId": "",
  "key": "",
  "value": "",
  "valueObject": {}
}

Portas

Entradas

Input
input · control

Saidas

Output
default · control
Error
error · error

Notas de uso

Output: local.<nodeId>.viewBag → full updated ViewBag object after the key is set.

**Fields:**
- `contactId`: Leave EMPTY when wa.trigger is the entry — auto-resolves from `{{input.contactId}}`.
- `key`: The ViewBag key name (e.g., `"cpf"`, `"email"`, `"etapa"`, `"nome_completo"`).
- `value`: Value to store. Supports Handlebars: `{{input.text}}` to save user's last message, `{{local.NODE_ID.response}}` to save a node result. Parsed as JSON if valid, otherwise stored as string.

**Use cases:**
- Save collected data: key=`"cpf"`, value=`{{input.text}}` after asking the user for their CPF.
- Save state/step: key=`"etapa"`, value=`"aguardando_confirmacao"` for state-machine flows.
- Save computed data: key=`"total"`, value=`{{local.node_calc.response}}` after a transform/API call.

**Error port:** Fires when contactId is invalid or contact not found.

**IMPORTANT:** This is the PRIMARY way to persist data per-contact. Always use setViewBag to store data the user provides (CPF, email, name, preferences, scores, etc.).